Post new topic    
Liquid Metal Slime
Send private message
Possible bug discovered 
 PostSun Jan 12, 2014 9:32 pm
Send private message Reply with quote
I currently have a code which is executed every time I talk to an NPC. When this code is executed it suspends the player and then changes my hero's sprite to a saluting sprite. Once all the final textbox is reached another script carries out resuming player movement.

I would expect my game to function as follows: My character activates the NPC to begin talking, my character switches to saluting sprite, the player advances through the textboxes, then upon finishing the last textbox the resume player script carries out.

What actually appears to happen: My character activates the NPC, my character switches to saluting sprite, player movement is suspended BUT by clicking on any of the arrow keys my hero reverts from the saluting sprite and becomes hero walking sprite, then everything carries out the same.

I do have separate code which does automatically change my hero's sprite to hero walking while the arrows are pressed but do not see any reason why the arrow keys should carry out the code while player is suspended.

I'm not sure if this is a bug or a result of my coding method. Let me know either way. If you need more info like my current script or a video showing the potential bug please let me know.
⊕ P E R S O N A L M U S I C: https://open.spotify.com/album/6fEo3fCm5C3XhtFRflfANr
⍠ C O L L A B M U S I C: https://dustpuppets.bandcamp.com/releases
Metal King Slime
Send private message
Re: Possible bug discovered 
 PostSun Jan 12, 2014 9:48 pm
Send private message Reply with quote
sheamkennedy wrote:

I do have separate code which does automatically change my hero's sprite to hero walking while the arrows are pressed but do not see any reason why the arrow keys should carry out the code while player is suspended.


There's your problem. Suspend Player only suspends the default walking around stuff, any scripts that use arrows or keys will still work as designed. To fix it, you should do something like...

Code:

script,supersuspendplayer,begin
suspendplayer
settag (WhateverTagYouWant,on)
end

script,SuperResumePlayer,begin
ResumePlayer
Settag (SameTagAsBefore,off)
end


and then make sure your arrow key code only works if that tag is turned off, and use SuperSuspendPlayer and SuperResumePlayer whenever you want to stop both the player from walking around manually and your special scripty stuff from happening.
Liquid Metal Slime
Send private message
Re: Possible bug discovered 
 PostSun Jan 12, 2014 10:00 pm
Send private message Reply with quote
Gizmog wrote:
sheamkennedy wrote:

I do have separate code which does automatically change my hero's sprite to hero walking while the arrows are pressed but do not see any reason why the arrow keys should carry out the code while player is suspended.


There's your problem. Suspend Player only suspends the default walking around stuff, any scripts that use arrows or keys will still work as designed. To fix it, you should do something like...

Code:

script,supersuspendplayer,begin
suspendplayer
settag (WhateverTagYouWant,on)
end

script,SuperResumePlayer,begin
ResumePlayer
Settag (SameTagAsBefore,off)
end


and then make sure your arrow key code only works if that tag is turned off, and use SuperSuspendPlayer and SuperResumePlayer whenever you want to stop both the player from walking around manually and your special scripty stuff from happening.


Awesome, Thanks!

EDIT: Just tried and it works perfectly!
⊕ P E R S O N A L M U S I C: https://open.spotify.com/album/6fEo3fCm5C3XhtFRflfANr
⍠ C O L L A B M U S I C: https://dustpuppets.bandcamp.com/releases
Metal King Slime
Send private message
 
 PostMon Jan 13, 2014 8:25 am
Send private message Reply with quote
If it is an unbroken sequence of textboxes then normally there is no need to suspendplayer as having a textbox up has the same affect. (Also, this is why my "hero will move" script checks both for suspendplayer and for textboxes.)
Liquid Metal Slime
Send private message
 
 PostTue Jan 14, 2014 3:48 pm
Send private message Reply with quote
TMC wrote:
If it is an unbroken sequence of textboxes then normally there is no need to suspendplayer as having a textbox up has the same affect. (Also, this is why my "hero will move" script checks both for suspendplayer and for textboxes.)


Haha, sorry. For some reason I like trying to do stuff my own way. I like to get advice and then use some of it to do stuff my own way. It probably gives me more of a headache than it's worth but I just like to know exactly what my script is doing through my own thought process.
⊕ P E R S O N A L M U S I C: https://open.spotify.com/album/6fEo3fCm5C3XhtFRflfANr
⍠ C O L L A B M U S I C: https://dustpuppets.bandcamp.com/releases
Display posts from previous: