Addressing Monitor.value

Discuss problems and solutions.
Post Reply
schoko
Newbie
Posts: 38
Joined: 07 Feb 2015 17:54

Addressing Monitor.value

Post by schoko »

Hi folks!

Maybe someone could help me out.

I want to store strings in several Monitor objects, because its one of the few possibil. to store data(which is represent at re-start).
i put the strings in an array:
-> array = getattribute(findobject(wordfind),'content')
and then i have to store this collected object to a Monitor
-> savecatlib1.value = array
the problem is, that i couldn't find a proper way to dynamically store the values in the according monitor
(depending on where another switch is pressed) -> savecatlibX.value = array
X should be dynamically adressed.

i also tried some kind like this:

mon = {savecatlib1.value,savecatlib2.value,...}
mon = array;

Any suggestion / help..?

thanks!

schoko
ndivuyo
Regular
Posts: 278
Joined: 23 May 2014 00:24

Re: Addressing Monitor.value

Post by ndivuyo »

I think storing values in an array is much cleaner and easier option (and they are saved until next restart as long as you don't assign them an initial value). And keep in mind they only hold up to 256 elements per array.

You can use a loop or individual assignments to store/recall data:

//STORING
storeArray[index] = value;
storeArray = {val1, val2, val3};

//some loop {
storeArray = value;
}

//RECALL
value = storeArray[index];

Hope that helps
schoko
Newbie
Posts: 38
Joined: 07 Feb 2015 17:54

Re: Addressing Monitor.value

Post by schoko »

yepp, thanks for your reply, i tried that before...

the problem is, that i have a lot of lists, >100, so i need to deal with changing names of arrays....
anyway i found a possible solution..., in case some needs that...

i have an object with switches, "under" this object i create expressions (arrays) with a defined naming schem..

the switches are called "selection"
the array has a naming like "L_LIB[x]_[y]
relevant code:
-------------
decl nameone = 'selection.L_LIB' + i + '_' + j;
decl tempparray = getexpression(selection,nameone);
//loop begin
temparray = getattribute(findobject(words),'content')) // text objects i input with a keyboard (ipadasciikeyboard template modified)
setexpression(selection,nameone,temparray); //write to L_LIB....
//loop end
-----------
with this you can address different arrays (with different names) with quite easy string conc.

needs to be fully test..., seems to work here.. :-)
ndivuyo
Regular
Posts: 278
Joined: 23 May 2014 00:24

Re: Addressing Monitor.value

Post by ndivuyo »

You are on the right track, you definitely need to tie multiple arrays like that for large storage in lemur.
That's why the [findchild()] and [getexpression()] methods are useful in this situation
Post Reply