Aceboss
The last couple of days I have been struggling with Elseif's which do not appear to be recognized by ARC (latest version) as an Elseif but rather as an If in the structure as can be seen below:-
This of course is just an example template to illustrate the issue. If I replace the
statements instead with an endif / if combination the structure appears fine, it is only when I introduce an elseif into the equation that the structure fails.Quote:
Elseif
I have only noticed this problem since upgrading to Windows 10, and the code appears to run OK.
Actual code that exhibits this behavior also appears below:
$standRandomResult=0
:standingLoop
if ($autonomous = true)
print("something")
if ($isStanding = true)
$standRandomResult=getRandomUnique(1,50)
print($standRandomResult)
$autoAction=true
if ($standRandomResult=1)
ControlCommand("Auto Position", AutoPositionAction, "Thinking")
pause(3000)
elseif ($standRandomResult=2)
ControlCommand("Auto Position", AutoPositionAction, "Bow")
pause(3000)
endif
$autoAction=false
endif
endif
SleepRandom( 5000, 20000 )
goto(standingLoop)
The only reason for the
print("something")
statement is that I read EZ-Script does not like there to be no statements in between an If/EndIf pair.
Has anyone experienced similar before, and what could be going on here? This has occurred with multiple scripts I have written over the last 2 days and persists between saves or even if the code is pasted into a new script.
I don't have any issues in my tests...
I would check that you don't have the variable being used somewhere else in another script.
If you press FORMAT CODE button, that is how the compiler parses the conditions.
Thanks DJ, weird thing is that your code looks OK when I paste it into a script, and I can add extra elseif's no problem with the bracketed indicators to the left of the line numbers correctly showing the grouping of if/endif sections.
However if I try any combination of the original script I pasted, then the bracketed indicators to the left of the line numbers show an imbalance of if/endif's once elseif is introduced.
Anyway, I guess the most important thing is that the script itself runs OK, it's just I am rather pedantic about things looking correct. Thanks for the assistance.
Incidentally I see I stupidly added pauses instead of sleeps in the sample code I pasted, I have since corrected that and pressed FORMAT CODE without any change to the original issue.
Thanks.
Oh - yes, do not let the bracket indicators be a source of confusion. That's actually part of the editor, which is separate than the compiler. The editor is a little silly and doesn't parse things perfectly. If you can, ignore the editor's bracketing and focus on the indent parsing and operation.
you're good to go
@Aceboss, I can run your script just fine.
Thanks a lot DJ and Justin, I'll ignore the editor's bracketing in future
Regards,