i would like to use a variable within a dialog. what i actually want, is proofe, if all dialog options has been used, and if thats true, enable a new option for the next time, the player comunicates with the character.
Something like that:
// dialog script file
@S // dialog startup entry point
ROGER: crmpff..
ROGER: aaaajfjf
ROGER: ufff...
return
@1 // option 1
ROGER: Just hanging around ...
option-off 1
myVar++;
return
@2 // option 2
ROGER: Sure. You could cut this rope.
EGO: I dont have a knife.
ROGER: You may try biting through it.
EGO: nah.
ROGER: hmff..
option-off 2
myVar++;
return
@3 // option 3
ROGER: Its not as comfortable as it looks like.
EGO: I see.
option-off 3
myVar++;
return
@4 // option 4
ROGER: Ok. Bye then.
// Enable Option 5, if everything has been said.
if ( myVAR == 3 ) { option-on 5 }
unset myVar;
stop
@5 // option 5 ...
...
...
how could i realize something like that ?
thanks !
I don't understand. Shouldn't global vars do the trick?
donno. i am new to this.
the script like i wrote it above wont work, so ;)
I think your problem is you're trying to run a global script from the dialog script. That's not possible in AGS.
Try the following approach:
(A) You can have references to your global script from the dialog script. For example:
@3 //option 3 clicked
ego: But I have never seen a white rabbit before!
run-script 1
return
The command in italics will run a script under the dialog_request function of your game (check the global script of the demo game - you can even do a search within the script to see how to create this function).
So this basically runs a script from the dialog.
(B) inside your dialog_request function
if (int param == 1) // if the dialog script requested is number 1 (remember run-script 1)
{
//your code here
//setglobalint
etc.
}
hmm. i got an error: undefined token: setGlobalInt
Code:
function dialog_request (int parameter) {////////////////////////////////////////////Dialog request
/**/////////PUT YOUR SCRIPTS HERE IF POSSIBLE///////////
if (parameter == 1) {
/// Dialog with Roger (UpdateStatus)
setGlobalInt(1,GetGlobalInt(1)+1);
}
if (parameter == 2) {
/// Dialog with Roger (Prepare2ndChoice)
/// Proove Dialog Status...
if (getGlobalInt(1) == 5) {
/// Expand Possibilities
setDialogOption(0,6,1);
}
}
/**/////////////////////////////////////////////////////
}
SetGlobalInt, GetGlobalInt <- capitals ;)
thanks ;)