Castle Paradox Forum Index Castle Paradox

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Gamelist   Review List   Song List   All Journals   Site Stats   Search Gamelist   IRC Chat Room

Using Wait() in an autorun-script

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
Bobert-Rob
The guy from years ago who made one good game




Joined: 13 Jun 2010
Posts: 17

PostPosted: Sun Jun 20, 2010 8:25 pm    Post subject: Using Wait() in an autorun-script Reply with quote

So does wait() not work with the autorun script of a map? Because I've been trying to fix a little graphic problem. See, on some maps, the hero's walkabout sprites are replaced with tiny versions. You know, like Chrono Trigger's world map. Anyway, this change always happens AFTER the fade in, so you'll see them huge for a second or tiny for a second before changing. Livable, but annoying.

My idea was to set up the changing script to use 'tweak palette (-63,-63,-63)' at the start, do the changes, and then fade back in when all was done. Only it didn't work, it faded in too early like it always does. So I figured using a wait (10) command after the scripted change and before the 'fade screen in' would give it enough time to perform it. This approach works in other scripts, but for some reason it won't work in the autorun script.

I guess something to do with the door's fade in overriding the scripted one... Is there a way around that?
Back to top
View user's profile Send private message Visit poster's website
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Sun Jun 20, 2010 9:04 pm    Post subject: Reply with quote

It should work perfectly if you have no wait commands in your map autorun script. There is a one tick delay before the map fades in during which you can make changes like that. And if you do use "tweak palette (-63, -63, -63)", then a single "wait(1)" is enough.

So it sounds like another script is interfering with your autorun script. Any script which is triggered at the same time and contains a wait command could delay the start of the autorun script, if the engine decides to run it first. I'm not sure what types of script get preference over autorun scripts. Do you have a wait command in your onkeypress script? That's always a bad idea.

Another possibility is that you are using one of those few commands that cause an implicit wait. There aren't many of these: teleport to map, use door, fight formation, use npc are the only unobvious ones, I think.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Bobert-Rob
The guy from years ago who made one good game




Joined: 13 Jun 2010
Posts: 17

PostPosted: Fri Jun 25, 2010 10:34 am    Post subject: Reply with quote

Hm, well, I suppose it could be in the onkeypress script. Though the wait() is only gone through when a certain key is pressed. Like, press Z and it goes through the jump script, which has a few 'wait' commands in it. Otherwise it shouldn't be waiting. Would that do this? I can't imagine what else would do it, really. It goes through checking about 30-ish heroes, changing pictures and palettes, but that shouldn't be bad I think. Is there some alternative to wait() that would work for the same purposes in an onkeypress script?
Back to top
View user's profile Send private message Visit poster's website
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Sat Jun 26, 2010 1:28 am    Post subject: Reply with quote

Well, if you don't press z, then I suppose that's not the problem.

Unfortunately it's really hard to track down this sort of bug. You can try using the script debugger (ugh!). Stand next to a door that leads to the world map and press F10 twice, then press P (for Play). Press an arrow key to walk onto the door, and you should see the game advance one frame (you may have to press it multiple times before it actually registers and starts to walk). Then just hit it a few more times until the hero finishes walking onto the door. The screen should fade out and then come back instantly on the new map. You are now looking at the single tick on the new map before the screen would normally fade in (but the fade has been overridden so that you can see the debugger). You will probably see that the map autorun and onkeypress scripts have been triggered:



(You may see more scripts below those two, or maybe an on-footstep or something as well, but it doesn't matter).

Now, press an arrow key (I advise not pressing random keys, some of them do things) once more. Since your autorun script isn't working, you should now see some script (look at the topmost script) is waiting for something, blocking the map autorun script from starting or completing. If it's not clear what's going on, take a screenshot and show me (don't press F12, it doesn't work in the debugger; use printscreen)

And no, you're not expected to be able to use the script debugger. I'm working on a much friendlier version.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
chronoboy
Into the past with a splash




Joined: 04 Jun 2010
Posts: 162
Location: Canada

PostPosted: Wed Oct 13, 2010 1:19 pm    Post subject: Reply with quote

The Mad Cacti wrote:
Stand next to a door that leads to the world map and press F10 twice, then press P (for Play).

Thank you very much for this, I never knew you could press the "P" key here.

I've compiled this nice list of what scripts superceeds others for my own debugging pleasure(it really should be in the wiki):
Code:
Map init script
New game/load game script

Keypress
Instead-of-battle
After-battle
Finish Instead of battle script
each-step


To compile this, I simply made a test game file with plotscripts for each basically with a textbox bluntly saying the name of the script. :p

This list has saved my life many times in the never ending war we called debugging.
_________________
Current project: Chronoboy Adventures

Website: http://www.chronoboy.com/
Back to top
View user's profile Send private message Visit poster's website
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Thu Oct 14, 2010 4:40 am    Post subject: Reply with quote

That 'P' key is perhaps the hackiest part of the debugger, but it is documented in the F1 help page.

(The script debugger cleanup I mentioned in this thread was never completed, it's been sitting unfinished on my computer for the last 4 months. But coincidentally I resumed work on it last weekend and should get it done this weekend)

I thought that list *was* on the wiki, but I can't find it. I must have posted it somewhere in this forum instead. I really need to copy more of my responses to new wiki pages.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP! All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group