Ok. First I have a little intro where some characters talk back and forth, and one moves around. That all works fine. Afterwards, I added these lines of script:
DisplaySpeech(JER, "...");
DisplaySpeech(JER, "...");
ObjectOn(0);
DisplaySpeech(JER, "...");
ObjectOff(0);
ObjectOn(1);
DisplaySpeech(JER, "...");
DisplaySpeech(JER, "...");
DisplaySpeech(JER, "...");
DisplaySpeech(JER, "...");
(ObjectOff(1);
ObjectOn(0);
DisplaySpeech(JER, "...");
ObjectOff(0);
DisplaySpeech(JER, "...");
DisplaySpeech(JER, "...");
ObjectOn(2);
DisplaySpeech(JER, "...");
DisplaySpeech(JER, "...");
DisplaySpeech(JER, "...");
DisplaySpeech(JER, "...");
DisplaySpeech(JER, "...");
DisplaySpeech(JER, "...");
ObjectOff(2);
I don't know of any "wait this amount of time" command, so I figured having a character pause to think would be good enough. However, AGS thinks it's funny and it is deleting all of the above lines as soon as I save the script. The objects I'm trying to turn on and off are text images (logos, you could say) I've created that I want to show (which contain the game name, credits, etc.).
Hmm, it's rather strange that AGS deletes them, are you sure about that?
Anyways, to pause a script use a Wait function:
ObjectOn(0);
Wait(40);
ObjectOff(0);
Wait(60);
ObjectOn(1);
Wait(100);
The amount of time being passed to Wait is measured in game loops. By default a game runs at 40 game loops per second so typing Wait(120); will make AGS wait for 3 seconds.
Thanks. That worked.
I had known about the Wait command, but I wasn't exactly sure how it worked. That'll help a lot in scripting.
Edit: Ok. Here's another thing... What if I want the player to be able to move around in the current room for a bit until the next action happens? I guess it'd be similar to what happens in Maniac Mansion (random cutscenes).
Basically I have the character... floating around in an area and he can't move around, but he can look, interact, and talk. And I want to give the player a about a minute to do these things until the next part of the intro plays. How would I do this?
You can have a special timer variable to store the current time (in game loops). You check its value from within the room's repeatedly execute interaction:
at the top of room script:
// room script:
int timer = 1000;
room's repeatedly execute:
if (timer == 1000) {
// first cutscene here
}
else if (timer == 800) {
// second cutscene here
}
else if (timer == 500) {
// third cutscene here
}
else if (timer == 100) {
// fourth cutscene here
}
if ((timer > 0) && (IsGamePaused()==0)) timer--; // makes the timer tick
Ok. I actually decided just to make the intro wait a bit and continue without letting the player do anything, but thanks. I'm sure that info will come in handy later.