View unanswered posts | View active topics It is currently Sat Apr 25, 2026 7:01 am



Reply to topic  [ 10 posts ] 
 Question on Triggers 
Author Message
Lieutenant

Joined: Sat Nov 06, 2004 3:00 am
Posts: 600
Location: USA
Unread post 
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???

_________________
Its not the Kill, Its the Thrill of the Chase
S: Min: 297 Max: 437 Average: 410 -- Just here to attack aliens
S: High/Low Removed   Average: 421
          


Sat Aug 27, 2005 4:14 pm
Profile ICQ WWW
Ambassador
User avatar

Joined: Mon Feb 09, 2004 3:00 am
Posts: 3141
Location: Kansas
Unread post 
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.

_________________
               / Promethius / Enigma / Wolfen /

"A man who has no skills can be taught, a man who has no honor has nothing."


Sat Aug 27, 2005 5:18 pm
Profile ICQ
Commander
User avatar

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

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


Sat Aug 27, 2005 6:51 pm
Profile WWW
Lieutenant

Joined: Sat Nov 06, 2004 3:00 am
Posts: 600
Location: USA
Unread post 
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?

_________________
Its not the Kill, Its the Thrill of the Chase
S: Min: 297 Max: 437 Average: 410 -- Just here to attack aliens
S: High/Low Removed   Average: 421
          


Wed Aug 31, 2005 3:03 pm
Profile ICQ WWW
Lieutenant Commander
User avatar

Joined: Thu Mar 21, 2002 3:00 am
Posts: 890
Location: USA
Unread post 
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.

_________________
http://tw-cabal.navhaz.com - THE TW info site

Man, I gotta quit showing up here...next thing you know i'll get dragged back in.


Wed Aug 31, 2005 4:30 pm
Profile WWW
Lieutenant

Joined: Sat Nov 06, 2004 3:00 am
Posts: 600
Location: USA
Unread post 
: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.

_________________
Its not the Kill, Its the Thrill of the Chase
S: Min: 297 Max: 437 Average: 410 -- Just here to attack aliens
S: High/Low Removed   Average: 421
          


Wed Aug 31, 2005 4:37 pm
Profile ICQ WWW
Lieutenant Commander
User avatar

Joined: Thu Mar 21, 2002 3:00 am
Posts: 890
Location: USA
Unread post 
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.

_________________
http://tw-cabal.navhaz.com - THE TW info site

Man, I gotta quit showing up here...next thing you know i'll get dragged back in.


Wed Aug 31, 2005 5:35 pm
Profile WWW
Captain
User avatar

Joined: Sat Jun 18, 2005 2:00 am
Posts: 2214
Location: USA
Unread post 
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.

_________________
Your reliance upon subjective IRM's, subjugates you through utter omission, obfuscation, and distortion of fact!
Don't mess with me, I will 26 U.S.C. § 7212(a) your IRS!


Wed Aug 31, 2005 6:00 pm
Profile ICQ WWW
Lieutenant

Joined: Sat Nov 06, 2004 3:00 am
Posts: 600
Location: USA
Unread post 
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.

_________________
Its not the Kill, Its the Thrill of the Chase
S: Min: 297 Max: 437 Average: 410 -- Just here to attack aliens
S: High/Low Removed   Average: 421
          


Wed Aug 31, 2005 8:23 pm
Profile ICQ WWW
Captain
User avatar

Joined: Sat Jun 18, 2005 2:00 am
Posts: 2214
Location: USA
Unread post 
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 [}:)]

_________________
Your reliance upon subjective IRM's, subjugates you through utter omission, obfuscation, and distortion of fact!
Don't mess with me, I will 26 U.S.C. § 7212(a) your IRS!


Wed Aug 31, 2005 9:33 pm
Profile ICQ WWW
Display posts from previous:  Sort by  
Reply to topic   [ 10 posts ] 

Who is online

Users browsing this forum: No registered users and 44 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.