arrays in UI XML

Discussion of Inner Space

Moderators: Lavish Software Team, Moderators

Post Reply
litewave
GamingTools Subscriber
Posts: 9
Joined: Tue Feb 01, 2005 5:43 pm

arrays in UI XML

Post by litewave » Mon Apr 20, 2009 4:06 pm

I have experimented (and searched) but can't seem to find a way to set a script variable (Array element) from the console or xml (UI) file. I can retrieve values but not set them. whats the right way to do this other than calling a atom?

to read i am doing this:
echo ${Script[test].VariableScope.HideID[${Script[test].VariableScope.HideIDcnt}]}

I have tried quite a few variations of:
Script[test].Variable[HideID[${Script[test].VariableScope.HideIDcnt}]]:Set[${99}]

and nada happens, the echo will show original value rather than the new value.

the test script:

variable int HideID[50]
variable int HideIDcnt=1


function main()
{

HideID[2]:Set[19]
HideID[1]:Set[72]


do
{
if ${QueuedCommands}
ExecuteQueued
waitframe

}
while 1

}


Thanks. Hopefully I am just having a brain fart and the answer is simple.

Lax
Owner
Posts: 6634
Joined: Fri Jun 18, 2004 6:08 pm

Post by Lax » Tue Apr 21, 2009 11:58 am

The simple answer is you can set the variable as global instead of script-scope and access it the same way you would in the script.

Code: Select all

variable(global) int HideIDcnt
I'd have to do some digging to get you a proper example with script-scope, and I'm moving in a couple days so that's not something I have time to do at the moment

litewave
GamingTools Subscriber
Posts: 9
Joined: Tue Feb 01, 2005 5:43 pm

Post by litewave » Tue Apr 21, 2009 12:54 pm

ok thanks, i will use that and make sure var name is unique enough that its not likely to already exist. I am curious what the script syntax will be but no rush. Good luck with your move!

Post Reply