View unanswered posts | View active topics It is currently Fri Apr 24, 2026 3:10 pm



Reply to topic  [ 4 posts ] 
 setTextTrigger uses 
Author Message
Ensign

Joined: Sat May 21, 2005 2:00 am
Posts: 260
Location: USA
Unread post 
Why would I ever what to use the setTextTrigger command over the the setTextLineTrigger when scripting?


Sat Dec 24, 2005 4:11 pm
Profile ICQ
Veteran Op
User avatar

Joined: Thu Jun 02, 2005 2:00 am
Posts: 5558
Location: USA
Unread post 
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.

_________________
May the unholy fires of corbomite ignite deep within the depths of your soul...

1. TWGS server @ twgs.navhaz.com
2. The NavHaz Junction - Tradewars 2002 Scripts, Resources and Downloads
3. Open IRC chat @ irc.freenode.net:6667 #twchan
4. Parrothead wrote: Jesus wouldn't Subspace Crawl.

*** SG memorial donations via paypal to: dpocky68@booinc.com
Image


Sat Dec 24, 2005 6:02 pm
Profile ICQ WWW
Lieutenant

Joined: Fri Mar 02, 2001 3:00 am
Posts: 577
Location: USA
Unread post 
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

_________________
http://the-glacier.com

The source for all your computer needs!

--==[The Outfit]==--


Sat Dec 24, 2005 9:55 pm
Profile ICQ YIM WWW
Commander
User avatar

Joined: Tue Oct 07, 2003 2:00 am
Posts: 1134
Location: Augusta, GA
Unread post 
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+

_________________
Claim to Fame: only guy to ever crack the TW haggle algorithm, and fig/shield/hold price formula, twice.


Sat Dec 24, 2005 10:14 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 27 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by wSTSoftware.