| www.ClassicTW.com https://mail.black-squirrel.com/ |
|
| Question on Triggers https://mail.black-squirrel.com/viewtopic.php?f=15&t=13175 |
Page 1 of 1 |
| Author: | Zarkahn [ Sat Aug 27, 2005 4:14 pm ] |
| Post subject: | |
okay, reading and looking at other sripts, havin some problems with mine. What is the main difference between setTextLineTrigger and setTextTrigger Is it the one needs a full line and the other just needs part of the line??? |
|
| Author: | Promethius [ Sat Aug 27, 2005 5:18 pm ] |
| Post subject: | |
quote:Originally posted by Zarkahn okay, reading and looking at other sripts, havin some problems with mine. What is the main difference between setTextLineTrigger and setTextTrigger Is it the one needs a full line and the other just needs part of the line??? Basically. My understanding of the setTextLineTrigger is when you are triggering of of text that would come before what you are wanting to capture, i.e., if I wanted to get the sector when a fighter is hit: setTextLineTrigger figHit :hit "Deployed Fighters" pause Deployed Fighters Report Sector 12273: Romulan Nikilet's Romulan Warbird entered sector." setTextLineTrigger would read the entire line and I could grab the sector number. If setTextTrigger was used, there could be the possibility I would not get the sector since it triggered before the entire line was read. Now, this is my understanding of the difference and I could be wrong or someone else may have a better way to describe it. |
|
| Author: | ElderProphet [ Sat Aug 27, 2005 6:51 pm ] |
| Post subject: | |
A packet of data from the TW server may or may not come in as a complete line, with a Carriage Return (CR) at the end. A TextLineTrigger with a match to the incoming data will only fire after the CR, whereas a TextTrigger will fire without waiting for a CR. So if you plan to use getWord, for example, to pull a word out of that line of text, a TextTrigger doesn't guarantee any data following the triggering text will be present. Say a packet comes in containing "Your fighters in sect", and you had a TextTrigger looking for "Your fighters in", it will fire. But when you go to do a getWord and pull the Sector number which is word 5, the value will be "0", since there isn't a word 5. If you instead had set a TextLineTrigger, it would have waited for the CR, indicating a completed line, before looking for word 5. +EP+ |
|
| Author: | Zarkahn [ Wed Aug 31, 2005 3:03 pm ] |
| Post subject: | |
ok, here goes a problem settextlinetrigger tow :tow "Corp" settextlinetrigger noship :noship "You do not own" here it should goto :tow 8 xxxx Odoiw Chipothot Corp 0 0 0 Subterfuge Mantis hopefully cause of the word "Corp" how do I get the 8 set to a $var ? I tried this :tow setVar $line CURRENTLINE getWord $line $shipnum 1 But it keeps trying to tow ship 0 0 is an invalid ship number. Is there a better way to get the ship number? |
|
| Author: | Traitor [ Wed Aug 31, 2005 4:30 pm ] |
| Post subject: | |
Do you have a pause after the settextlinetriggers? settextlinetrigger tow :tow "Corp" settextlinetrigger noship :noship "You do not own" pause :tow killtrigger noship killtrigger tow getword CURRENTLINE $shipnum 1 That should work. You can always stick in the following right after the trigger: echo "*" CURRENTLINE "*" That will show you what's in CURRENTLINE. |
|
| Author: | Zarkahn [ Wed Aug 31, 2005 4:37 pm ] |
| Post subject: | |
:go killalltriggers send "w*" settextlinetrigger tow :tow "Corp" settextlinetrigger noship :noship "You do not own" pause yes I have the pause...heh heh one of the first problems I encountered on my first script, so I learned that fast... will do the echo thing to look, just can't figger out where it's pulling the 0 from unless its the spaces at the begining of the line. |
|
| Author: | Traitor [ Wed Aug 31, 2005 5:35 pm ] |
| Post subject: | |
Another thing you can do is to put echo's after each label :go echo "*At :go*" :tow echo "*At :tow*" I usually do this with every script I write. It really helps with the troubleshooting. When the script is done, I just do a global replace echo "*At : with # echo "*At : takes just a second to turn them off or on. |
|
| Author: | RexxCrow [ Wed Aug 31, 2005 6:00 pm ] |
| Post subject: | |
Oh just replace the pause with the below line and you should be good to go... WaitFor "---- " You have to make a special exception, whenever those dashed lines are used, for whatever the reason. |
|
| Author: | Zarkahn [ Wed Aug 31, 2005 8:23 pm ] |
| Post subject: | |
thanks Guys Rexx, I left my triggers in there, and therefore I have to have the pause. But by adding the waitfor b4 the triggers it worked. Thanks to all that take the time to answer and help us noob scripters. |
|
| Author: | RexxCrow [ Wed Aug 31, 2005 9:33 pm ] |
| Post subject: | |
When using triggers to activate them you can use either: Pause, WaitFor, or WaitOn. Triggers are not limited to only the use of Pause, that is just one of the three options available. Remove the Pause and you will see that it sill works... trust me, muhahahhaaha, muahahahaaa, muahahahaaa [}:)] |
|
| Page 1 of 1 | All times are UTC - 5 hours |
| Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |
|