www.ClassicTW.com
https://mail.black-squirrel.com/

setTextTrigger uses
https://mail.black-squirrel.com/viewtopic.php?f=15&t=16855
Page 1 of 1

Author:  Akor [ Sat Dec 24, 2005 4:11 pm ]
Post subject: 

Why would I ever what to use the setTextTrigger command over the the setTextLineTrigger when scripting?

Author:  Singularity [ Sat Dec 24, 2005 6:02 pm ]
Post subject: 

Not everything is a full line. Like a command prompt, it doesn't end with a carriage return and won't trigger a linetrigger. It will only trigger a normal texttrigger. Still, whenever you can use a full line trigger I've found that it's usually best to as unexpected things can happen with just setTextTrigger.

Author:  Grazhoppa [ Sat Dec 24, 2005 9:55 pm ]
Post subject: 

word of advice...

NEVER use settexttrigger for "deployed fighters report" .... a few old time scripters learned that quick, especially playing against me...

any of ya'll remember that? GrazHo "Deployed Fighters Report Sector :Q^MCBY GrazHoppa's Merchant Cruiser entered Sector" muhahahhaha, loved it.... loved it to death :D woot woot... Not many of you have been CBY'd by me, but a few of you have, either on SSM scripts, or otherwise :) love it to death :)

anyway.... good times, muhahahha

Author:  ElderProphet [ Sat Dec 24, 2005 10:14 pm ]
Post subject: 

Generally speaking, the packet of data received from the TW server will be the entire transmission, complete with the final Carriage Return where applicable. In those instances, there's probably no difference between a setTextTrigger vs. setTextLineTrigger, except when no CR is included like Singularity pointed out.

However, there are times when a transmission is broken across packets. Imagine a fig hit message where almost the whole line is in one packet, but the CR is in another packet. A setTextTrigger could activate after only receiving the first packet, assuming it contained the complete triggering text, but a setTextLineTrigger would wait until the arrival of the packet completing the line with the CR.

The only unexpected thing I can think of happening with setTextTrigger is if you trigger on text that occurs BEFORE the text you're trying to extract. If you trigger off of words 1 and 2 (Ex. 'Your fighters'), but try to grab word 5, you'll run into problems whenever word 5 doesn't arrive in the same packet. If that example packet ended after the 3rd word, then CURRENTLINE will only contain the text since the last CR.

The rule of thumb is to use setTextLineTrigger if you are going to grab data from CURRENTLINE. Otherwise, use setTextTrigger. The only necessary exception is when you want to parse the CURRENTLINE when it might not end in CR.

+EP+

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/