Home   Help Search Login Register  

Author Topic: metavariables  (Read 385 times)

0 Members and 1 Guest are viewing this topic.

boner

  • Guest
metavariables
« on: 02 Apr 2004, 20:58:36 »
hi, i need to use dinamic named variables, same as car1,car2, carN, for that i think need use the format comand, but i try whit this, and the script dosent work, any idea to help me?

i think the name for this variables is metavariables, i see in this tutorial http://www.ofpec.com/editors/resource_view.php?id=64, but this example code dosent work for me  :'(

script used

Code: [Select]
max=3
cont=0

#bucle
format [""car%1 = 1"",cont]
cont = cont + 1;
?(cont==max):exit
goto "bucle"

sorry for my english  ::)
« Last Edit: 02 Apr 2004, 21:00:20 by boner »

Offline Spinor

  • Members
  • *
  • I'm a llama!
    • The chain of command
Re:metavariables
« Reply #1 on: 02 Apr 2004, 23:12:31 »
Hi,

the format command only casts (creates) a string from other variable types. In order to execute the string as code you also have to use the call command. This should work:

Code: [Select]
max=3
cont=0

#bucle
call format ["car%1 = 1",cont]
cont = cont + 1;
?(cont==max):exit
goto "bucle"

boner

  • Guest
Re:metavariables
« Reply #2 on: 03 Apr 2004, 00:56:12 »
works nice, very thx for your help  ;)