|
AVM Object Recognition from Canada [6 posts] |
13 year
|
When I use the AVM plugin I, having problems accessing the variable NV_ARR_OBJ_IDX. I'm trying to get RoboRealm/AVM to recognize 2 (or more) objects and speak their name. All is fine with the recognition part and their name is displayed properly in the AVM display as well as their IDX number. However any attempt to use the If.. statement to speak either name properly always fails and it either speaks only the first name (of two objects) or speaks it when the object is not visible.
Can't figure out why the logic in the If...then statement is not working.
Like: If NV_ARR_OBJ_IDX = 0 then speak First Object
and the a second If statement:
If NV_ARR_OBJ_IDX = 1 then speak Second Object.
I'm using the latest version 2.29.2 program.robo
|
|
|
EDV [328 posts] |
13 year
|
The variable NV_ARR_OBJ_IDX is array.
You should use VBScript for this task:
TotalObj = GetVariable("NV_OBJECTS_TOTAL")
ObjIdx = GetArrayVariable("NV_ARR_OBJ_IDX")
ReDim ObjName(20)
ObjName(0) = "1"
ObjName(1) = "2"
ObjName(2) = "3"
ObjName(3) = "4"
ObjName(4) = "5"
SpeakStr = "I see"
for i = 0 to TotalObj-1 step 1
SpeakStr = SpeakStr + " " + ObjName(ObjIdx(i))
next
if TotalObj = 0 then SpeakStr = SpeakStr + " nothing"
SetVariable "SPEAK_STR", SpeakStr
See also attached Speak_Objects.robo file. program.robo
|
|
|
from Canada [6 posts] |
13 year
|
Yes! That works great.
Thank you very much.
I wouldn't have considered using VB Script.
Tom
|
|