A waitFor trigger is disabled if any other trigger fires. I believe all of the other triggers, including waitOn, persist until they either fire or are killed.
So if you do this:
setTextTrigger fuelHolds :getHolds "How many holds of Fuel Ore"
waitFor "We'll buy them for"
The setTextTrigger will fire first, which kills any waitFor triggers if I recall correctly. But you could do this:
setTextTrigger fuelHolds :getHolds "How many holds of Fuel Ore"
setTextLineTrigger firstOffer :getOffer "We'll buy them for "
pause
When the first trigger fires, the other trigger persists. Now many people killAllTriggers and reset triggers every time a trigger fires, which is poor trigger management. What I like to do is set all of the triggers for a particular sequence, and let the triggers flow from one to the other. Observe:
Code:
send "pt*"
waitOn "<Port>"
setTextLineTrigger productType :getProduct "How many holds of "
setTextLineTrigger agreedQty :getQty "Agreed, "
setTextLineTrigger initOffer :getOffer "We'll buy them for "
pause
:getProduct
getWord CURRENTLINE $product 5
if ($product = "Fuel")
getWord CURRENTLINE $buyOrSell 11
else
getWord CURRENTLINE $buyOrSell 10
end
pause
:getQty
getWord CURRENTLINE $qty 2
pause
:getOffer
getWord CURRENTLINE $offer 5
stripText $offer ","
gosub :sendOffer
Start with a waitOn that triggers on text that will always be seen just before the text we're triggering off of, like "<Port>", then all of the triggers will fire as their text is processed in. The triggers firing make our script flow from :getProduct, to :getQty, and finally to :getOffer. Notice there are no killTrigger or killAllTriggers, yet when we hit the gosub on that last line, all of the triggers have fired and are no longer active.
Let your triggers do the work.
+EP+