It appears that Changing the cursor graphic to a DynamicSprite causes a problem.
I first started with this:
mouse.ChangeModeGraphic(eModePointer, oMysub.Graphic);
Now, this does work. But since the graphic I'm using needs cropping, I cropped it using the DynamicSprite's Crop function and passed the resulting graphic as the one to use as the mouse pointer. The game compiled fine, but when I ran the function in question, the game quit with the following error:
Quote from: Error message.
---------------------------
Illegal exception
---------------------------
An exception 0xC0000005 occured in ACWIN.EXE at EIP = 0x00427E88 ; program pointer is +5, ACI version 2.72.918, gtags (0,0)
AGS cannot continue, this exception was fatal. Please note down the numbers above, remember what you were doing at the time and ... etc
---------------------
OKÃ, Ã,Â
---------------------
I played around with cropping the sprite more or less, until I discovered that even this wouldn't work at all (despite basically being the same as the above code)
DynamicSprite *my_sub_sprite = DynamicSprite.CreateFromExistingSprite(oMysub.Graphic);
Mouse.ChangeModeGraphic(eModePointer, my_sub_sprite.Graphic);
I tried it out with RC2a and still the same trouble. Hope this helps.
Quote from: Colxfile on Mon 26/06/2006 14:53:05
DynamicSprite *my_sub_sprite = DynamicSprite.CreateFromExistingSprite(oMysub.Graphic);
Mouse.ChangeModeGraphic(eModePointer, my_sub_sprite.Graphic);
I tried it out with RC2a and still the same trouble. Hope this helps.
Since this code was presumably inside a function, as soon as the function ended my_sub_sprite would have gone out of scope and thus been deleted... hence your error. All non-temporary dynamic sprites must be global variables decleared outside of any function.
That's the one! Thank you ;D
where are you declaring dynamic sprite to make them global?
I tried out of a function in the beginning of global script and I get this error
---------------------------
Compile Error
---------------------------
There was an error compiling your script. The problem was:
In: 'Global script'
Error (line 31): cannot assign initial value to global pointer
Do you want to fix the script now? (Your game has not been saved).
Did you read the error message?
Do "DynamicSprite*ds;" outside any function, then assign something to it in game_start or whenever.
Thanks KhrisMUC
I have not understand the meaning of the error message but your answer make it clearer.
now it 's good :)
thanks again to you and every member who helps newbies with silly questions :)