Axe Software Forums
  Quest Developer Forum
  String Variables


Author Topic:   String Variables
Fred posted 28-04-2002 15:04 GMT     
Would it be possible to add/subract amounts from string variables? For example, the programmer could supply a list of strings to go in the variable, then they could use the command to add/subtract values (but with strings) to step up the list of strings. Like this:

Very Slow
Moderately Slow
Slightly Slow
Slow
Slightly Quick
Moderately Quick
Quick
Very Quick

Then you could change the variable to adjust the variable along those strings.

Alex posted 29-04-2002 05:55 GMT          
I would suggest using a numeric variable, which you can add or subtract from in the usual way, and then having a function to convert the number into the required string whenever you needed to output "Moderately Slow" or whatever.
Fred posted 29-04-2002 15:22 GMT          
How exactly do I do that?
carlii posted 30-04-2002 03:26 GMT          
Just make a numeric variable (I'm assuming you're using QDK Editor) and whenever you want to show (print) to the reader how "quick" you're going or whatever make a conditional. In the conditional state that if that variable = 1, print Very Slow or if that variable = 2, print Moderately Slow, etc, etc. (The higher the number, the faster I suppose.) You get what I mean now Fred?

Welcome to the forum BTW! :)

Alex posted 30-04-2002 05:04 GMT          
As carlii says, use conditional scripts - but put them all inside a function. Create a function, called "status" or whatever. In that function, use a conditional script to check the contents of your numeric variable and print the desired string.

In ASL it might look like this:

if ( %speed% = 1 ) then msg <Very Slow>
if ( %speed% = 2 ) then msg <Moderately Slow>

etc....

Then, in any script parameter where you want to display the string, use "$status$". For example, choose the "Print a message" script, and then enter "Your current speed is $status$" in the message box.

Computer Whizz posted 30-04-2002 11:18 GMT          
You want this to be used by the player to chose a speed I presume?

If you use QDK you can open a menu and have a menu select a choice, but feed a number into a function.

I think Al should give a little demo, because he's better at explaining then me!
: )

Computer Whizz

carlii posted 01-05-2002 04:12 GMT          
Hmmm. Where are you Fred?