Axe Software Forums
  Quest Developer Forum
  Help with variables


Author Topic:   Help with variables
melbrown2k posted 16-05-2002 12:41 BST     
Right, i'm trying to use a numeric variable as part of a string variable. I tried this:

set numeric <num; 1>
msg <Who is person %num%?>
enter <person%num%>
msg <#person%num%#>

But it doesn't work. Is it possible to do what i'm trying to do? Or is there another way round it? Please help.

Mel

MaDbRiT posted 16-05-2002 13:51 BST          
I don't know what you are trying to do - but I think it looks like you need to use an array: Here's how I'd do it;

quote:

set numeric <num; 1>
set string <temp>
msg <Who is person %num%?>
enter <temp>
set string <person[%num%];#temp#>
set <num; 2>
msg <Who is person %num%?>
enter <temp>
set string <person[%num%];#temp#>
msg <Person 1 is #person[1]#, person 2 is #person[num]#>

You can use the either a literal or the 'num' variable to access an array of names this way - which is what I guess is what you want to do.

Al

melbrown2k posted 16-05-2002 17:15 BST          
Thanks a lot, its working now.

Mel