using scripts in dialogs

Started by Babar, Mon 01/09/2003 13:16:27

Previous topic - Next topic

Babar

I used run-script 2 in one of my dialogs. In the script I called another dialog with Run-dialog 11. I got an error when I tested the game saying that I was already in one dialog and could not call another, so I put StopDialog in the script before using Rundialog, but I still get the message that I am already in one dialog and cannot call another. I know I am reaally bad at scripting so it is probably something stupid I did, but I need help to get it right
The ultimate Professional Amateur

Now, with his very own game: Alien Time Zone

Ishmael

I have had that problem also. What you could try (not tested, though):

in dialog point where you want to swich to another dialog:

run-script 2
run-script 3

or if 2 and 3 are in use, pick ones that are not.

and in dialog_request:
for run-script 1:
StopDialog();
and for run-script 2:
RunDialog(11);

might work, but I'm not sure, not at all.
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Babar

No.....It doesn't work. I didn't think it would anyways, because if the dialog is stopped in script 1 then then it would not go back to the dialog to check script 2 at all. I would be really grateful if I could get help to solve this problem, because I really can't think of anyway around it in the game I am making
The ultimate Professional Amateur

Now, with his very own game: Alien Time Zone

SSH

Quote from: Babloyi on Mon 01/09/2003 13:16:27
I used run-script 2 in one of my dialogs. In the script I called another dialog with Run-dialog 11.

Is that the last thing in the script? WHy not just let it return to the dialog script and do an:

goto-dialog 11

straight after your run-script 2


12

Babar

I can't do that.... the script I call from the dialog checks some variable and if it is 0 it goes to dialog 10 and if it is 1 it goes to 9
The ultimate Professional Amateur

Now, with his very own game: Alien Time Zone

Scummbuddy

Then set up a new dialog to be sent to that picks up where you left off and with the dialog choices you want.
- Oh great, I'm stuck in colonial times, tentacles are taking over the world, and now the toilets backing up.
- No, I mean it's really STUCK. Like adventure-game stuck.
-Hoagie from DOTT

SSH

AH, I see.

Well, one possibility is to let it drop out of the dialog completely, having set some global variable and then check that global variable after you call the original dialog.

Is that clear?

e.g.

RunDialog(1); // this is your dialog which calls the run-script 2
if (GetGlobalInt(77)==1) {
RunDialog(9);
} else if (GetGlobalInt(77)==2) {
RunDialog(10);
}

and then your dialog_request has:
SetGlobalInt(77, whatever_is_appropriate);
StopDialog();

Although this is pretty unwieldy!


Alterntaively, merge your two alternative dialogs into one and then use your run-script to turn off the wrong set of options and turn on the correct ones...?
12

Babar

Its not working!!! :'(. I tried what you said SSH, and it solved the problem with the error messages, but now everything else is messed up. No matter which value is assigned to the GlobalInt, it always goes to the same dialog. There are two scripts that were used for the Talk to character interaction. I don't remember why I put them as two, but I thought it will make no difference so I didn't change it back to one:
1st Script:
RunDialog(0);

2nd Script:
If (GetGlobalInt(11)==1) RunDialog(9);
If (GetGlobalInt(11)==0) RunDialog(10);

In Dialog(0) one of the option 3 has:
run-script 2
Stop

in the dialog_request function in the global script there is this:
if (xvalue==2) {
string buffer;
InputBox ("PASSWORD",buffer);
if (buffer=="whatever the password is") {
SetGlobalInt(11,1);
}

The problem is probably with something in my scripting. If anyone can see it, PLEAAAASE help me.
The ultimate Professional Amateur

Now, with his very own game: Alien Time Zone

Gilbert

Quote
if (buffer=="whatever the password is") {

That is the problem. You cannot use '=', '==', '>', '<', etc. to assign or compare strings, instead, that line should be:

if (StrComp(buffer,"whatever the password is")==0) {

Babar

It worked! It worked!  :) :) :) :) :)
Thank you Gilbot! Pardon my stupidty
The ultimate Professional Amateur

Now, with his very own game: Alien Time Zone

SMF spam blocked by CleanTalk