AH! Well, this makes thing clearer!
OK, the problem is that the handler "finished" does not know the values of the variables you are using in it andirfan wrote:hi klaus
this is the script. First read from socket and then store in three different variable. the Third variable pResult2 is used in the last condition...
thus treats it like the string "pResult" which of yourse does not evaluate to "even"!
To make it work, you need to declare them as LOCALS like this, so ALL handlers in this script can access them.
And please read my comments in the script!
Code: Select all
local pResult,pResult1,pResult3
## In case you might need all of them later!
on mouseup
read from socket tSocket until return
put it into tResult
put item 1 of tResult into pResult
put item 2 of tResult into pResult1
put item 3 of tResult into pResult2 ////// its value will be even
if "truckContractor1need nine truck"= pResult then
send "complete" to me in pResult1 seconds
lock moves
move grc "Obj8533" to the loc of grc (item 1 of line 1 of field "ObjectsLoc") without waiting
move grc "Obj8531" to the loc of grc (item 1 of line 1 of field "ObjectsLoc") without waiting
## in 0 secs is not necessary, see one of my earlier postings and "move" in the dictionary!
## And note the QUOTES around names and the parenthesis, which I also recommended in my earlier postings!
## This MAY look as it is not necessary but will fail when you least exspect it! :twisted:
unlock moves
end if
end mouseup
## Now this hadleer can access the values of pResult!
on complete
if pResult2="even" then
## Only one check necessary here!
stop moving grc "Obj8531"
stop moving grc "Obj8533"
end if
end complete
Klaus