Rapid code is not working.
EugeneB
✭
Trying to add value to the variable - 'number', and if 'number' == 5 then do message box. Not working. My variable remains in 0.
My PROC:
What I'm doing wrong?
My PROC:
PROC user_selection()
VAR num answer;
VAR num number;
VAR btnres answer2;
!Testing TPReadFK and IF, IFELSE statements.
!PulseDO\PLength:=1.5, doFeedBkwd_W1_R1;
!can be up to 5 uptions. If less then 5 write - stEmpty
TPReadFK answer,"Select which way to go","Left","Right","Center","CheckLoop","Dispose Mudule";
IF answer=1 THEN
Pth_2_left;
number := number + 1;
ELSEIF answer=2 THEN
Pth_3_right;
number := number + 1;
ELSEIF answer=4 THEN
t_LogicLoopStop;
number := number + 1;
ELSEIF answer=5 THEN
disposeModule;
number := number + 1;
ELSE
Pth_1_center;
number := number + 1;
ENDIF
IF number = 5 THEN
UIMsgBox\Header:="UIMsgBox Header","Number is 5"\MsgLine2:=""\MsgLine3:=""\MsgLine4:=""\MsgLine5:=" "\Buttons:=btnOKCancel\Icon:=iconInfo\Result:=answer2;
IF answer = resOK disposeModule;
ENDIF
!
ENDPROC What I'm doing wrong?
Tagged:
0
Best Answer
-
I move my variable outside of my proc and it worked. Thanks.0
Answers
-
Do you get an error message?
0 -
Try putting:
TPWrite NumToStr(number, 0);
Stop;
at different places to see what the value is before and after you do number+1.
Also, then put the VAR as a Global variable by putting it at the top of the module, outside a proc, and see if that changes the way it counts.
0 -
Nothing. Variable = 0;
No error messages.0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 312 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 793 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings