problem with the script sequence

Started by ekcnepta, Thu 26/08/2004 10:11:26

Previous topic - Next topic

ekcnepta

hi! i have this problem, i need to move a character to a point, then move another character to other point. then a dialogue between them starts and when it ends, one of the characters moves out of the screen. here is my script:
function room_a() {
MoveCharacterBlocking  (OLDMAN, 145, 164, 1);
MoveCharacterBlocking(OPTUHOH, 175, 152, 1); 
RunDialog (0);
MoveCharacterBlocking  (OLDMAN, 340, 164, 1);
the problem here is that the dialog starts after the old guy leaves the screen (340, 161)
what is wrong?

Gilbert

Because of engine limitations, Rundialog() will always be executed as the last action in a script, you may read Scorpious' post in this thread and see if it helps fixing your problem.

Barbarian

#2
I'm no scripting expert, so I could be wrong, or someone with more knowledge may offer you better advice.. but.. because a Dialog is (I think) considered running a script, and I think with AGS you can't be running more than one particular script at a time, so the problem is your script wants to finish all of it's commands before it goes to run a new script.

If this is the case, then, within the Dialog/Topic 0 script, you can add the command within it to have the OLDMAN leave the screen once the dialog finishes, but, running a command within a Dialog script is a bit different than running a regular script. You need to perpare ahead of time the command, then call upon it within the Dialog script when you want to use it.

SO, as an example, here's how you might set up two series of commands that you can run within a Dialog script:

Open up the Global Script, and underneath the first part:

Code: ags
// main global script file


You add something that might look like this:

Code: ags
function dialog_request (int parameter) 
{ Ã,  if (parameter == 1) 
{ // enter your commands you want performed here, called by run-script 1 Ã,  Ã, 
Display("This is Parameter 1");}

else if (parameter == 2)
{ // called by run-script 2
Display("This is Parameter 2");
MoveCharacterBlocking Ã, (OLDMAN, 340, 164, 1);}
}


Now, go to Dialogs, Topic 0 (or whatever the topic number is for where you want to run the script), and click the "Edit Script" button, and you now should be able to use those commands when you need to, so for example, your Dialog script might look like:

Code: ags
// dialog script file
@S Ã, // dialog startup entry point
return
@1 Ã, // option 1

run-script 1

OLDMAN: "You just choose Parameter 1."
option-off 1

return
@2 Ã, // option 2

OLDMAN: "You choose Parameter 2, so I leave now!"

option-off 1
option-off 2

run-script 2

stop


Ã,  Well, there may be other or more better ways to do it, but, I hope something of that is of help and might work for you. Good luck.
Conan: "To crush your enemies, see them driven before you, and to hear the lamentation of the women!"
Mongol General: "That is good."

Blade of Rage: www.BladeOfRage.com

ekcnepta

thanks a lot guys u have really helped me  :-*

SMF spam blocked by CleanTalk