Reply to Re: New *WORKING* cross-platform editor
If you don't have an account, just leave the password field blank.
Not sure what you mean. I have the following code:
And when I talk and wait 5 seconds, it says "Hi" and then "Bye".
When I talk, then hit it before the 5 seconds are over, it says "Hi" but no "Bye".
With ¤t_sprite being available in an external() script... Let me start somewhere else for a moment.
Every in-game sprite has a script-number. Anything that happens to the sprite (talking, hitting, death, push, desire to attack... those kind of things) will launch a procedure of that script. You can get this script number in DinkC by using the "is_script_attached()" function.
The other thing is that every script has a sprite number. This is the value of ¤t_sprite. However, it is *not* necessarily true that is_script_attached(¤t_sprite) == ¤t_script. For example: calling external() will keep ¤t_sprite, but the external-script will be a separate script instance and thus have a different script number than the script that did the call to external().
Finally, using script_attach(), you *only* modify the value of ¤t_sprite. Checking if ¤t_sprite is 1000... might actually work. If it does, it'll be the case for spawn()'ed scripts, and for scripts that have used script_attach(1000).
However: It doesn't override the is_script_attached() value of the sprite you attach it to.
As far as I know, the only command that changes the is_script_attached() value of a sprite is sp_script(). However, this spawns a new script number (which gets returned, so you're not completely left in the dark). As far as I know, it's not possible in DinkC to tell the engine "Any hit/talk/etc stuff on this sprite should now run a procedure in this other script number".
// sprite.c void talk( void ) { say_stop("Hi",¤t_sprite); external("waiter","proc"); say_stop("Bye",¤t_sprite); } void hit( void ) { } // waiter.c void proc( void ) { wait(5000); }
And when I talk and wait 5 seconds, it says "Hi" and then "Bye".
When I talk, then hit it before the 5 seconds are over, it says "Hi" but no "Bye".
With ¤t_sprite being available in an external() script... Let me start somewhere else for a moment.
Every in-game sprite has a script-number. Anything that happens to the sprite (talking, hitting, death, push, desire to attack... those kind of things) will launch a procedure of that script. You can get this script number in DinkC by using the "is_script_attached()" function.
The other thing is that every script has a sprite number. This is the value of ¤t_sprite. However, it is *not* necessarily true that is_script_attached(¤t_sprite) == ¤t_script. For example: calling external() will keep ¤t_sprite, but the external-script will be a separate script instance and thus have a different script number than the script that did the call to external().
Finally, using script_attach(), you *only* modify the value of ¤t_sprite. Checking if ¤t_sprite is 1000... might actually work. If it does, it'll be the case for spawn()'ed scripts, and for scripts that have used script_attach(1000).
However: It doesn't override the is_script_attached() value of the sprite you attach it to.
As far as I know, the only command that changes the is_script_attached() value of a sprite is sp_script(). However, this spawns a new script number (which gets returned, so you're not completely left in the dark). As far as I know, it's not possible in DinkC to tell the engine "Any hit/talk/etc stuff on this sprite should now run a procedure in this other script number".