View unanswered posts | View active topics It is currently Sat Feb 23, 2019 8:39 pm



Reply to topic  [ 87 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next
 TWX Proxy Feature Request 
Author Message
Commander
User avatar

Joined: Tue Oct 07, 2003 2:00 am
Posts: 1116
Location: Augusta, GA
Unread post Re: TWX Proxy Feature Request
Vid, I agree that additional functionality with TWX's windows would be great.

Regarding Round, I plan on complementing it with Truncate. Round rounds to the nearest integer. Truncate always rounds down.

Archy, you have some ability to detect when another script launches by using setEventTrigger. Let me know if you need some examples.

Regarding user-defined functions... Essentially, TWX is a one-command-per-line scripting language. This does get tedious at times, and the GOTO nature of the scripts leads to "spaghetti" code, but these elements make it real simple to understand what a script does. A non-scripter can usually look at a TWX script and follow along. User-defined functions would break this. Remco preached this to me a few times, and I've come to see his point, and so I keep TWX true to his design.

But I have considered extending GOSUB to include it's own stack (private variables), which would keep it pretty simple, but make it considerably more powerful (e.g. recursion).

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


Fri Aug 12, 2011 8:12 pm
Profile WWW
Commander
User avatar

Joined: Mon Oct 29, 2001 3:00 am
Posts: 1096
Location: Tucson, AZ
Unread post Re: TWX Proxy Feature Request
ElderProphet wrote:
...the GOTO nature of the scripts leads to "spaghetti" code, but these elements make it real simple to understand what a script does.


Unless BASIC is a bad memory from your early days as a programmer. Then it makes your brain explode. :lol:

_________________
Suddenly you're Busted!


Fri Aug 12, 2011 9:40 pm
Profile WWW
Immortal Op
User avatar

Joined: Fri Jun 25, 2010 6:33 am
Posts: 257
Location: Sydney Australia
Unread post Re: TWX Proxy Feature Request
I understand that the SetEventTrigger needs the name of the script thats loading.. what i need is to be able to tell if ANY script has loaded.. if thats incorrect then yes please give me an example as that ability would help a lot.. thanks

_________________
Teamspeak3: 60.242.57.40:9987
Z-Bot does my dirty work!


Sat Aug 13, 2011 11:28 am
Profile ICQ
Veteran Op
User avatar

Joined: Thu Jun 02, 2005 2:00 am
Posts: 5558
Location: USA
Unread post Re: TWX Proxy Feature Request
There are a few ways to do this. First, I would ask... have you tried wildcards or just "" as the parm?

Next, if that doesn't work, use listActiveScripts to get a current list of scripts and compare with previous script list. If there's a new script in the list, then you know something has loaded. If you did that in the main loop of your code, you could detect both loading and unloading scripts w/o needing the name of the script.

_________________
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 Aug 13, 2011 12:15 pm
Profile ICQ WWW
Ambassador
User avatar

Joined: Mon Feb 09, 2004 3:00 am
Posts: 3141
Location: Kansas
Unread post Re: TWX Proxy Feature Request
Archy wrote:
I understand that the SetEventTrigger needs the name of the script thats loading.. what i need is to be able to tell if ANY script has loaded.. if thats incorrect then yes please give me an example as that ability would help a lot.. thanks


listActiveScripts $scripts
setVar $a 1
while ($a <= $scripts)
lowercase $scripts[$a]
echo "*" $scripts[$a] "*"
add $a 1
end

laff - Sing you type too fast. ;)

_________________
               / Promethius / Enigma / Wolfen /

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


Sat Aug 13, 2011 12:17 pm
Profile ICQ
Veteran Op
User avatar

Joined: Thu Jun 02, 2005 2:00 am
Posts: 5558
Location: USA
Unread post Re: TWX Proxy Feature Request
EP, what would be nice is if gosub could handle parameters. Like...

gosub :processname $name1 $name2

After the gosub, $name1 and $name2 would then be part
of an array... $passed[1] and $passed[2] or something like
that. That way we would not need to preload a list of gosub
internal variables... allowing us to treat each sub as it's own
unit. As it is now, we can't really treat a gosub as a black
box.

Another useful feature would be to specify gosub instead
of goto within a trigger. That way we could trigger on text,
check that text, and simply return back if it failed to meet
the check. As it is now, we need a convoluted set of labels
to pass back from a trigger.

Finally, a regexp trigger would be awesome. We could use
regexp to better check for spoofing before the trigger is
actually fired, removing the need for all of the crazy spoof
checks we have to do every single trigger.

Prome - LOL

_________________
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 Aug 13, 2011 12:22 pm
Profile ICQ WWW
Immortal Op
User avatar

Joined: Fri Jun 25, 2010 6:33 am
Posts: 257
Location: Sydney Australia
Unread post Re: TWX Proxy Feature Request
Promethius wrote:
Archy wrote:
I understand that the SetEventTrigger needs the name of the script thats loading.. what i need is to be able to tell if ANY script has loaded.. if thats incorrect then yes please give me an example as that ability would help a lot.. thanks


listActiveScripts $scripts
setVar $a 1
while ($a <= $scripts)
lowercase $scripts[$a]
echo "*" $scripts[$a] "*"
add $a 1
end

laff - Sing you type too fast. ;)


yes i am aware of that technique.. but to use it i would need to run the procedure that checks far too often, and that would slow things down..
i dont think passing "" as the parameter works but i will test it again to be sure..

_________________
Teamspeak3: 60.242.57.40:9987
Z-Bot does my dirty work!


Sat Aug 13, 2011 12:57 pm
Profile ICQ
Ambassador
User avatar

Joined: Mon Feb 09, 2004 3:00 am
Posts: 3141
Location: Kansas
Unread post Re: TWX Proxy Feature Request
Archy wrote:
Promethius wrote:
Archy wrote:
I understand that the SetEventTrigger needs the name of the script thats loading.. what i need is to be able to tell if ANY script has loaded.. if thats incorrect then yes please give me an example as that ability would help a lot.. thanks


listActiveScripts $scripts
setVar $a 1
while ($a <= $scripts)
lowercase $scripts[$a]
echo "*" $scripts[$a] "*"
add $a 1
end

laff - Sing you type too fast. ;)


yes i am aware of that technique.. but to use it i would need to run the procedure that checks far too often, and that would slow things down..
i dont think passing "" as the parameter works but i will test it again to be sure..


k, could you do something like:

listActiveScripts $scripts
if ($scripts > $prevScriptCnt)
# do something
elseif ($scripts < $prevScriptCnt)
setVar $prevScriptCnt $scripts
end

just to detect a change? I'm not sure what you are doing so just tossing something out... A trigger on the load would be cleaner and realtime. It is possible to that a script would be unloaded and another loaded before the check so this type of detection wouldn't work.

EP, Sorry for the "derail".

_________________
               / Promethius / Enigma / Wolfen /

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


Sat Aug 13, 2011 1:07 pm
Profile ICQ
Immortal Op
User avatar

Joined: Fri Jun 25, 2010 6:33 am
Posts: 257
Location: Sydney Australia
Unread post Re: TWX Proxy Feature Request
i really need it to be realtime.. What i want to do is disable the bot when an external script is run... so that the bot doesnt interfere with the external script.. the bot puts itself in a different mode when a bot script or command is run.. i want to do the same regardless of how a script is run..

perhaps the answer is to allow the seteventtrigger to run with "" as the scriptname.. detecting any scriptload..

_________________
Teamspeak3: 60.242.57.40:9987
Z-Bot does my dirty work!


Sat Aug 13, 2011 1:25 pm
Profile ICQ
Commander
User avatar

Joined: Tue Oct 07, 2003 2:00 am
Posts: 1116
Location: Augusta, GA
Unread post Re: TWX Proxy Feature Request
Sing, your gosub example is similar to what I have in mind. Maybe a STACK constant (STACK.COUNT, STACK[1], etc.) that reverts to it's previous state when that Gosub's Return is reached.

Your idea of a gosub-style text trigger would have to behave like a waitOn, where only one can be active at a time, and once it's set script execution pauses. I'm willing to explore the idea more.

I realize the usefulness of regexp, but the entire TWX scripting language isn't that much more complex than regular expressions. The vision is that TWX scripts should be fast and powerful, easy to write and understand. I'm willing to improve TWX's text parsing capabilities, but regexp is non-trivial and could quickly make a script too complex to follow.

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


Sat Aug 13, 2011 1:37 pm
Profile WWW
Veteran Op
User avatar

Joined: Thu Jun 02, 2005 2:00 am
Posts: 5558
Location: USA
Unread post Re: TWX Proxy Feature Request
Archy wrote:
i really need it to be realtime.. What i want to do is disable the bot when an external script is run... so that the bot doesnt interfere with the external script.. the bot puts itself in a different mode when a bot script or command is run.. i want to do the same regardless of how a script is run..


I have my own bot, and I've found that as long as I'm careful with what text I process, it's not a problem. If I disable the bot during external script runs, then there's nothing people can do if the external script hangs. Basically, cbot (my bot) is entirely mode-less, which is the reason I wrote it.

If the scripts are being ran thru the bot, however, you can always set internal modes to track things if you need to... that's what mombot and stbot do. If that's the case, couldn't you just tie the script check routine to the part that processes commands?

ElderProphet wrote:
Sing, your gosub example is similar to what I have in mind. Maybe a STACK constant (STACK.COUNT, STACK[1], etc.) that reverts to it's previous state when that Gosub's Return is reached.


Whatever the name you use, that's basically the idea. Just send anything from the command line of the gosub to the internal var, and clear it on return. That wouldn't be difficult to implement. You don't need an entirely separate name space, infact that would probably break a lot of scripts.


ElderProphet wrote:
Your idea of a gosub-style text trigger would have to behave like a waitOn, where only one can be active at a time, and once it's set script execution pauses. I'm willing to explore the idea more.


Really? That kindof kills the usefulness of it. What I really need is a way to track random entry points and return back to those points. The script could be in the middle of anything, process the trigger, then return back. As it is now, I have to come up with very convoluted handlers just to figure out where to return.

ElderProphet wrote:
I realize the usefulness of regexp, but the entire TWX scripting language isn't that much more complex than regular expressions. The vision is that TWX scripts should be fast and powerful, easy to write and understand. I'm willing to improve TWX's text parsing capabilities, but regexp is non-trivial and could quickly make a script too complex to follow.


Not every script needs to be user readable. My multi-thousand line blocks of code are never going to be public, so it's hardly relevant. If it's readable to me, I'm happy.

The problem is that triggers get called on trivial text. If I have a fighter hit trigger, someone can spam over fed or private hail or whatever and trigger that. I have to copy-paste 30 lines of code for every trigger that is called from a wait state to make sure it's not being spoofed, and then I have to figure out how to return back to an optimal return point if it is a spoof. That is not an easy task, and it adds a lot more complexity doing that than just having a regexp. The solution is not to trigger on spoofs, but that's not going to be possible for every possible trigger. Basic perl regexp would solve that problem as we can do ansi, first and last word matching, all as part of the trigger itself.

I understand the desire to keep stuff simple and readable, but sometimes one single semi-complex but teachable line of code is worth 500+ lines of simple but twisted spaghetti code. In those situations, the regexp is easier to read and understand.

_________________
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 Aug 13, 2011 2:15 pm
Profile ICQ WWW
Immortal Op
User avatar

Joined: Fri Jun 25, 2010 6:33 am
Posts: 257
Location: Sydney Australia
Unread post Re: TWX Proxy Feature Request
Singularity wrote:
If the scripts are being ran thru the bot, however, you can always set internal modes to track things if you need to... that's what mombot and stbot do. If that's the case, couldn't you just tie the script check routine to the part that processes commands?


I am basically doing that for bottable scripts made available to the bot via the options file.. but the problem is when a script is run from outside the bot.. by using $ss or via the twx load script dialog box.

_________________
Teamspeak3: 60.242.57.40:9987
Z-Bot does my dirty work!


Sat Aug 13, 2011 5:40 pm
Profile ICQ
Veteran Op
User avatar

Joined: Thu Jun 02, 2005 2:00 am
Posts: 5558
Location: USA
Unread post Re: TWX Proxy Feature Request
Archy wrote:
I am basically doing that for bottable scripts made available to the bot via the options file.. but the problem is when a script is run from outside the bot.. by using $ss or via the twx load script dialog box.


And you want to freeze up the bot when someone loads an external script?

_________________
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 Aug 13, 2011 5:45 pm
Profile ICQ WWW
Immortal Op
User avatar

Joined: Fri Jun 25, 2010 6:33 am
Posts: 257
Location: Sydney Australia
Unread post Re: TWX Proxy Feature Request
I want to disable some of its automated functions which may interfere with the external script.. perhaps we should continue our conversation elsewhere, since this is not our thread.. i have a teamspeak3 server where we can talk voice at 220.244.125.70:9987.

sorry ep..

_________________
Teamspeak3: 60.242.57.40:9987
Z-Bot does my dirty work!


Sat Aug 13, 2011 10:07 pm
Profile ICQ
Veteran Op
User avatar

Joined: Thu Jun 02, 2005 2:00 am
Posts: 5558
Location: USA
Unread post Re: TWX Proxy Feature Request
Voice gives me a headache. The only way I can think to do this for external scripts would be to put the script list detection routine within the bot's text trigger block (trigger is fired, check to see if a script was added, if so, reset the trigger and go back to wait state). It would be inelegant, but it would at least allow you to detect new scripts before firing off one of the problem triggers.

_________________
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 Aug 13, 2011 10:47 pm
Profile ICQ WWW
Display posts from previous:  Sort by  
Reply to topic   [ 87 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next

Who is online

Users browsing this forum: No registered users and 5 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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware.