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

scripting for speed waitfor or trigger?
https://mail.black-squirrel.com/viewtopic.php?f=15&t=13138
Page 1 of 1

Author:  Gemini [ Wed Jun 01, 2005 9:31 am ]
Post subject: 

In a script where speed is critical, for example in an attack script which is faster? Waitfor or a text trigger?

Author:  Traitor [ Wed Jun 01, 2005 1:18 pm ]
Post subject: 

experience tells me they are about the same. I haven't run a speed comparison tho.
i.e.
waitfor "warps into"
settexttrigger killGemini :killGemini "warps into"

are the same for all practical purposes. I think if there was a difference, it would be in the less than 1ms range. Triggers, however, are way more fun to label! [:D]

Author:  Gemini [ Wed Jun 01, 2005 1:27 pm ]
Post subject: 

Thanks for the info Traitor.

Author:  Zoso [ Wed Jun 01, 2005 2:32 pm ]
Post subject: 

Of The 2 examples, which ever comes out to less lines of code is the one I would choose. I'm sure one will be a few lines less than the other. Of course we are still talking fractions of a second.

Zoso

Author:  Gemini [ Wed Jun 01, 2005 2:41 pm ]
Post subject: 

I went with the waitfors just because it helps me keep better track of what my script is doing, and where it's supposed to be going.

Author:  RammaR [ Wed Jun 01, 2005 8:20 pm ]
Post subject: 

EP might be able to shed some light on this one, but I tend to use waitFor's like a setTextLineTrigger where I could parse text from the entire line vs a setTextTrigger which activates immediately on 'seeing' the text. The other side of that is that a waitFor doesn't jump to another area of code - it just proceeds to the next line where a trigger might have to jump several thousand lines to proceed. Its an interesting question, maybe we can figure out a way to test it out.

Author:  Kavanagh [ Wed Jun 01, 2005 9:38 pm ]
Post subject: 

If script execution speed has once again become an issue, to the point that milliseconds are relevant (what with some players having 50 ms pings), perhaps people should abandon twx/zoc/anything that is not compiled, and go look at Procomm/Qmodem/Telix again.

Author:  Vid Kid [ Thu Jun 02, 2005 12:07 am ]
Post subject: 

quote:
If script execution speed has once again become an issue, to the point that milliseconds are relevant (what with some players having 50 ms pings), perhaps people should abandon twx/zoc/anything that is not compiled, and go look at Procomm/Qmodem/Telix again.


I believe this is the right answer ..

the speed of a string of commands is no longer an issue when its
compiled , so with twx the issue would be if its not compiled .. it will take a few milies to compile ..

This being said .. execution times of command ?? really ..hehehe [;)]

Author:  Zarkahn [ Fri Jun 03, 2005 3:42 pm ]
Post subject: 

hmm, i got a script called Gemini from a pirates game, but it was for Zoc...heh heh
Custom wrote for him...heh heh... the surprise was it worked

Author:  Gemini [ Fri Jun 03, 2005 7:06 pm ]
Post subject: 

You coming to pirates tonight Zark? I've got a new script I wanna try out. =)

Author:  Kaboom [ Fri Jun 17, 2005 12:01 am ]
Post subject: 

I'm not sure about the time differences but I seem to think that text triggers can produce more unwanted results in the development process - especially when you forget that the same text is displayed at times you don't want it to trigger and failed to realize that when you were writing it. But then again, that is probably just a newbie mistake.

KB

Author:  ElderProphet [ Fri Jun 17, 2005 5:35 pm ]
Post subject: 

There is no discernable speed difference in the triggering of either type. It would definately be <1 ms, unless you had hundreds of triggers waiting to fire. I would choose to use a waitFor if the next action were definate, instead of conditional. Like if I'm in a solo game, and I'm going to fire at anyone entering my sector, then I would have attack macros immediately following a waitFor. But if I need to see who warped in before I attack, then I'd use a text trigger, since you can control the processing and retriggering more efficiently from a :header.

waitFor "warps into"
send "ay9999*"
goto :checkSector

vs.
setTextTrigger maybePsion :whoDat "warps into"
pause
:whoDat
getWord CURRENTLINE $target 1
if ($target = "PSION")
send "ay9999*"
goto :checkSector
end
# Wasn't Psion, so retrigger and wait.
setTextTrigger maybePsion :whoDat "warps into"
pause
+EP+

Author:  Psion [ Fri Jun 17, 2005 7:57 pm ]
Post subject: 

Ouch, hehe.

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