#1 29-08-2008 16:53

ZAZ
Registered: 05-12-2007
Posts: 55

50 locals and more in one Cleo.s at same time

Can I have much more local variables in one script (not mission script)?
We know that threads can running in more instances
But will it work in a valid way ?
If not, i assume its because the thread is registrated by its thread_name and can handle only 31 locals and 2 timers.

Ok, i wrote now a thread_starter.cs with 5 create_thread commands with parameter
0A92: create_custom_thread "Test_new_thread.s" 0 1 2 3 4 5 6 7 8 9 10 11
to start allways the same script which includes 5 threads
A jump_table in the "Test_new_thread.s" selects first to jump to each of 5 threads with different thread_names
And i can see that one script displays alltogether 60 different values of 60 local variables
5x 0@ - 11@
My question now: Is it a valid way of Cleo scripting ?
Does it work stable in every situation ?

>>Click here to download the scripts>>

Offline

#2 30-08-2008 08:27

Devan_LT
Registered: 29-08-2007
Posts: 21

Re: 50 locals and more in one Cleo.s at same time

I don't know how this would work, but maybe it would be easier to save variables into the files by using 0A9A.

Offline

#3 01-09-2008 04:18

Seemann
Registered: 07-08-2006
Posts: 2,155

Re: 50 locals and more in one Cleo.s at same time

@ZAZ - yes, you can run multiple threads with different initial values for the locals.
But in your example you can just include the content of Test_new_thread.s (the whole jump_table thing) in your script and not create new threads and you will get the same effect. I don't know the reason of creating new threads to set the values of the local variables just for displaying them. For the temporary manipulating with local variables when you don't need to store their values for long, there's a useful thing called scm_function. Read more about it in the help, or check some scripts using it (like this).

Offline

#4 07-09-2008 07:32

ZAZ
Registered: 05-12-2007
Posts: 55

Re: 50 locals and more in one Cleo.s at same time

Thanks very much for answer smile

I don't know the reason of creating new threads to set the values of the local variables just for displaying them.

Its just for displaying the effect. I forgot to mention an important aspect:
More Loops are runing in a script and each can handle its own 34 locals
The text_draw codes needs to run in a loop. So you can see these different loops.
I tried 0AB1: Its seems to work like a gosub with transporting values.
I couldnt start more loops with it.

But in your example you can just include the content of Test_new_thread.s (the whole jump_table thing) in your script and not create new threads and you will get the same effect.

Dont know how to can start 5 loops which are running parallel without create thread from other script.

0AB1: and 0AA6: jumps to my first thread and submits the values
But I have no Idea what I can insert into the first 2 params
Maybe the first is the call_method-ID, but the second ?

0AB1: call_scm_func @Test_new_thread1_1 12 0 1 2 3 4 5 6 7 8 9 10 11
0AA6: call_method 4509088 12195720 num_params 12 pop 0 0 1 2 3 4 5 6 7 8 9 10 11

One more question:
Is it possible to use 0929: in a cleo script to start a cleo script ?

Offline

Board footer

Powered by FluxBB