elfege
USA
Asked
— Edited
Has anyone figured out way to get the goto() function to work with variable so it can goto the last defined loop such as this :
$lastLoop = ""
:loop1
$last = "loop1"
left(200, 0)
sleep(100)
print($last)
goto($last)
this would allow to have the equivalent to calling a function and resuming the current loop after its execution. It would prevent me from using too many scripts and avoid lots of redundancies. My project currently has 50 scripts so I'm trying to find a way to shrink this number.

Dave,
Most computers have 4 cores now. Even most Atom processors have 4 cores now. It is possible that you have a pc with 2 cores, but if that is the case, there is a technology that was used to make these look like 4 cores at the time.
The OS (I think XP and above but maybe even before them) allowed multiple cores. I know Windows 3.51 supported multiple cores. The OS has the ability to handle multiple cores and it is built into the OS at no additional cost.
The more cores the better within reason. You could go crazy and get a server class machine with 64+ cores. 4 is normally sufficient.
Each control that is currently running is one thread. The thread gets an available core and uses it. If the cores are busy, the OS tries to time slice into a core that is being used. Because each control uses its own thread, it is often times better to use multiple scripts to accomplish something. It is what I have said in other posts and one of the reasons that I code the way that I do. Another benefit is re-usability. A script can call another script and either forget about it or wait for a variable to be set which would tell the initial script that the second script completed. Doing everything in a single script limits ARCs ability to utilize multiple threads. Now, it may be that you want something to run in series instead of parallel. If this is the case putting this in the same script is not an issue, but... it is good practice to break up your scripts for a few reasons.
There are probably more reasons, but off the top of my head, these are the most important reasons for me.
@DJ: I said ARC->EZB not the other way,
my background is c++ and c#, i understand how the analog servo works, the point was more to have more control over the task performed by the firmware.
The time is really a constrain thanks for replying back.
@ptp Hey sorry man, I just answered the question you asked...And thanks for reminding us of how smart you are, I had almost forgot... Cheers..
Thanks @David, that is great info too...
@Richard
I'm always polite, i try to do Devils advocate, etc etc. Did i said something wrong to get a sarcastic answer from you ?
I only mention my background because DJ mention something like the ajax, json, html, although i know what they are, i'm not familiar with them, so i mention my background.
Thanks for your motivation, it seams you re happy trashing other people's questions when they are trying to figure out how the things work.
It's my bad there are a lot of SDK code, like for example the Universal bot where i can learn more, so i'm guilt of being lazy and ask the question.
Thanks David, Your a great teacher. I already know some of your answer and guessed some of the rest but your guidance cleared up everything.
As for cores, I do know I only have two in my old Dell. I was wondering if I'm throttling my busy project when many controls are running at once or popping on and off (I do try to have proper sleep commands in them). I notice (I do have the latest version of ARC) when long audio is streaming and something like the AutoPosition control is running that I am getting broken audio sometimes. I thought more cores then two would assist but it could be something else. I'm sending Serial commands through the Uarts at the same time also so I could be also be having Comm flooding going on. Humm, resource management. Can't wait for the new EZB to come out.
@Dave... I am going to go out on a limb (hopefully @DJ will back me up here) and say the the soon to be release ezb4.1/2 will/may eliminate most if not all your "lag" issues... Communication is only as fast as the weakest link in the proverbial communication chain so to speak... I know that the ezb4.1/2 is much faster than the current ezb4... Here's egg on my face if it doesn't, though...
Here is the danger... The faster the pc, the easier it is to flood the communication channel. I think the weak link will be the pc when the 4 1/2 comes out especially if using the usb comm board. It is easy to check if your processor is being pegged though through the resource monitor on your computer. If it is at 100% while seeing the issue, it is your processor.
@David... ahh... very good point... Maybe ARC needs a "throttle" control (for fast PC)... LOL