Setting Variables In Dialog

Started by , Sat 18/09/2004 16:42:35

Previous topic - Next topic

Plog

I need it so if you say a certain thing in a dialog it sets a certain variable to 1.

But my newbish ways means I can't work it out even after reading the tutorial. :s

Thanks in advance.

Ashen unlogged

If you're using GlobalInts, you could use the set-globalint dialog script command, which is the same as using SetGobalInt (e.g set-globalint 1 3 will set GlobalInt 1 to 3).
But, if you're using your own ints, you'll need to use the run-script command, and set up the dialog_request function if it's not already there.

Plog

Oh god...
Remind me what a GlobalInt is. nd if possible how do I set it out exactly.

Excuse my newbieness.

Ashen hasn't logged in

Well, an int in AGS can be any whole number between â€"2,147,483,648 and 2,147,483,647. They can be script specific (i.e. can only be accessed by one specific script), room specific (can be accessed by any script in that room, but not from another room), or global (can be accessed by any script in any room). You create them yourself, e.g.
Code: ags

int my_int;


  The GlobalInts are a set of 50 ints hardcoded into the engine to be accessable from any room, using the GetGlobalInt (int) and SetGlobalInt (int, value) commands. They have the benefit of being built into AGD, so you can just use them without having to worry if you've declared and imported them properly, but since they're just refered to by number it can be a little hared to keep track of what they're refering to.
(e.g. using a custom int called door_puzzle to track the players progress on a puzzle about a door is more obvious than GlobalInt (1), but both work perfectly well)

Did any of that make sense, or have I confused you more?

Plog

Well um a bit...

Heres my Dialog script...

// dialog script file
@S  // dialog startup entry point
return
@1  // option 1
GUARD: Haha. What kind of idiot do you take me for. Now shut up, scum.
stop
@2  // option 2
GUARD: No you have a perfectly good toilet in there. Now shut up, scum.
stop
@3  // option 3
GUARD: Well shut up then, scum.
stop

I need the variable change between the GUARD's line and stop on @2. How would I go about doing that and then how would I recognise that I had changed it to make something else happen somehwere else if that is set as whatever.

PS: The dialog options also take like 5 seconds to appear anyone know why its a pain in the ass.

Ashen

#5
A bit of sense, or a bit more confused?
Anyway, the short answer is - depends what exactly you want to happen.

@2Ã,  // option 2
GUARD: No you have a perfectly good toilet in there. Now shut up, scum.
set-globalint 1 2
stop

Then, for example, in the toilet object (or hotspot) interaction:
Code: ags

if (GetGlobalInt (1) == 0) { //before speaking to guard
Ã,  Display ("I'm not using that unless I *really* have to.");
}
 
else if (GetGlobalInt (1) == 2 { //after speaking to guard
Ã,  Display ("Well, if I must.....");
Ã,  Display ("I can't, not with you watching.");
}


oh, and in my last post
QuoteThey have the benefit of being built into AGD
should have been
QuoteThey have the benefit of being built into AGS
, but I wasn't logged in and couldn't fix it.
I know what you're thinking ... Don't think that.

Plog

Thanks!

Now my only problem is why the hell it takes 5-7 seconds for the options to appear in the dialog space at the bottom... It's really frustrating. :(

BorisZ

Maybe you used "..." as dialog message. It means silence for few seconds.

SMF spam blocked by CleanTalk