I know about SR[R] , R[] , AR[] . What is AR ? Can i write SR[]='ANY STRING' ?
STRING REGISTER
-
Gunjan Trivedi -
December 4, 2019 at 3:14 PM -
Thread is Unresolved
-
-
1. AR is an Argument Register, which means it takes a value that you pass to it at declaration. Example, you can call a program SQUARE(2,3) and then SQUARE will read something along the lines of R[AR[1]] = AR[2] * AR[2], which will then place the value of 3 squared into register 2.
2. Yes, you can use any string, within limits, in a string register. There will be some characters that i am sure you cannot make, and length limitations, but otherwise, a string is a string.
-
Fun fact about the String Registers, you can add them together and use them to indirectly call programs or vision processes.
SR[1] = 'ANY'
SR[2] = ' STRING'
SR[3] = SR[1] + SR[2]
Now SR[3] = 'ANY STRING'
I use them a lot for choosing vision processes when my system has several different parts it needs to check or move.
-
-
I can show a Register or String Register in a User Alarm?
-
Regarding manipulating SRs in TP (not KAREL), the trick of calling a subroutine with strings as arguments seen in Post #4 above works for me, but the direct assignment shown in Post #3 doesn't. So,
CALL MAKE_STR ('Any', 'String') works
SR[1] = AR[1] + AR[2] inside MAKE_STR works
SR[1] = SR[2] + SR[3] works
SR[1] = 'Any string' will not build in RoboGuide (I'm writing .LS files and compiling them to .TP).
Is there a trick to doing this, or am I just running into an inherent limitation of TP language?
-
Nope, setting a string directly is not allowed in TP. You have to call a 'setting' program like the make_str defined above.
I think post #3 was just defining what was in the string registers.