Asked — Edited

Invalid Boolean Script Error

Hey guys. I don't want to give away my current project so I wont say much other than the code and my problem.

In the following script I get this error:

Error:

6:07:26 PM - Error on line 13: String was not recognized as a valid Boolean.

This is the script. No idea what is causing it, other than perhaps there is too many phrases.

Script:


#This is the Control script. Theta's functions all  
#are started by this script. It must be running to 
#allow Theta to operate. Kill this script to slowly 
#stop Theta. 

#Variables
$returngreeting = 0
$reply = "error"

:loop
$spoken = Waitforspeech( 120, "hello Theta", "good morning Theta", "good afternoon Theta", "good evening Theta", "good night Theta", "hey Theta", "Theta", "bye Theta", "see you later Theta")
#Error is on next line
if ( $spoken = "hello Theta" OR "hey Theta" OR "Theta" )
ControlCommand("Script Manager AI", ScriptStart, "Greeting" )
$spoken = "error"
Elseif ( $spoken = "good night Theta" OR "bye Theta" OR "see you later Theta" )
ControlCommand("Script Manager AI", ScriptStart, "Leaving")
$spoken = "error"
Elseif ( $spoken = "timeout" )
saywait("I missed that")
$spoken = "error"
endif 

$timeout = $timeout + 1
if ( $timeout = 120)
ControlCommand("Script Manager AI", ScriptStart, "Leaving")
endif

Sleep(500)

Goto(loop)

Thanks for the help. I'm sure its a simple mistake. Maze:D


ARC Pro

Upgrade to ARC Pro

Stay at the forefront of robot programming innovation with ARC Pro, ensuring your robot is always equipped with the latest advancements.

Author Avatar
PRO
Synthiam
#1  

if ( $spoken = "hello Theta" OR "hey Theta" OR "Theta" )

You're not comparing anything to anything. You're just saying OR and a value. That's like if i just asked you if RED? Hey Maze, red? Hey, blue?

blue? hot? cold?

:)

You have to actually compare the value to something...


if ( $spoken = "hello Theta" OR $spoken = "hey Theta" OR $spoken = "Theta" )
#2  

Oh, okay! I see. Thanks DJ. I just did it in a similar way to the waitforspeech command. I guess its not the same!