View unanswered posts | View active topics It is currently Thu Apr 18, 2024 10:41 pm



Reply to topic  [ 4 posts ] 
 Getting an Error Code from TWX Proxy then it shuts down 
Author Message
Ensign

Joined: Wed Nov 06, 2002 3:00 am
Posts: 268
Unread post Getting an Error Code from TWX Proxy then it shuts down
In this post - viewtopic.php?f=15&t=34474 - I was trying to get some help on passing character codes back and forth between scripts, for the purposes of control, etc. Mostly just curiosity thought. I remembered someone had told me before how to control scripts with others, on a hunch I went back over to the http://www.twxproxy.com forums and I found it in this 10 year old post - http://www.twxproxy.com/support.php?show=508.

In the post SupG was telling me (Thor) how he used the processIN command to let his bot know that a script it called was still running, so the bot wouldn't step off to the next routine or whatever. In his example, he used some text as the message. Still being curious about character codes being used for this, I tried them instead. SupG said he used this technique repeatedly in a script to report back to his bot that the other script was still running, he said it worked fine and I don't remember him posting anything about it messing up in later posts. He was using it in TWX Proxy 2.0 if I remember correctly.

It seemed to work fine, the scripts echoed the text they were supposed to, and then both scripts halted like they were supposed to. Then a couple of seconds later, TWX Proxy threw this error code and crashed.

    Exception EListError in module TWXProxy.exe at 0001A746
    List index out of bounds (-1).


Here is the code for the 2 test scripts, very simple, each just supposed to send a message to the other via processIN, and each just supposed to echo some text.

Script 1
Code:
# This is the Master Script for coordinating 2 scripts

setTextTrigger t1a :part1 #12
load _TEST02.TS
processIN 1 #11
PAUSE

:part1
killTrigger t1a
echo "This works for passing control or information" "*"
HALT


And Script 2
Code:
# This is the Subordinate script for coordinating 2 scripts

setTextTrigger t2a :part1 #11
PAUSE

:part1
killTrigger t2a
echo "Script 2 function complete" "*"
processIN 1  #12
HALT


Anyone have any idea why it is throwing this error code? Thanks


Tue Nov 18, 2014 9:18 pm
Profile
Commander
User avatar

Joined: Fri Jun 09, 2006 2:00 am
Posts: 1396
Location: Canada
Unread post Re: Getting an Error Code from TWX Proxy then it shuts down
I played with processin a long time ago, I can't remember the details except to say that there was probably a good reason I stopped playing with it.

I was going to suggest that you use the EventTrigger to determine if a script was still running:
Code:
setEventTrigger stopped :stopped "SCRIPT STOPPED" "somescript.ts"


alternatively, you can have your mainbot use the twx listActiveScripts to determine if a script is still running.

_________________
----------------------------
-= QUANTUM Computing 101: 15 = 3 x 5 ... 48% of the time.
-= There are 10 types of people in the world: Those that understand Binary and those who do not
-= If Oil is made from Dinosaurs, and Plastic is made from Oil... are plastic Dinosaurs made from real Dinosaurs?
-= I like to keep my friends and my enemies rich, and wait to see which is which - Tony Stark (R.I.P.)


Tue Nov 18, 2014 10:55 pm
Profile ICQ YIM
Ensign

Joined: Wed Nov 06, 2002 3:00 am
Posts: 268
Unread post Re: Getting an Error Code from TWX Proxy then it shuts down
OK, went back and did some further testing. I figured, OK maybe TWX doesn't like the control characters with processIN. So, I changed it to a text string. Same error, and crashed.

So I decided to test speed. I put a 1000 tic delay trigger in script 2 before it executed it's processIN. Bingo, no error message and no crash. Changed the text string back to control characters for the processIN, no error message no crash.

Now to put a while loop in, iterate the scripts a few times, see if it crashes after that.

It's sweet TWX is so fast, but can be a right pain at times keeping it from catching it's own tail during the chase :lol:


Tue Nov 18, 2014 11:02 pm
Profile
Ensign

Joined: Wed Nov 06, 2002 3:00 am
Posts: 268
Unread post Re: Getting an Error Code from TWX Proxy then it shuts down
LoneStar wrote:
I played with processin a long time ago, I can't remember the details except to say that there was probably a good reason I stopped playing with it.

I was going to suggest that you use the EventTrigger to determine if a script was still running:
Code:
setEventTrigger stopped :stopped "SCRIPT STOPPED" "somescript.ts"


alternatively, you can have your mainbot use the twx listActiveScripts to determine if a script is still running.


Good idea LoneStar. I use the EventTrigger a bit, and if I'm just wanting to wait for one script to finish before proceeding then that's what I will probably use. Actually I'll probably try to set everything up using includes.

I put in a while loop and it didn't like that, I sometimes still struggle getting while loops to work right, I think I don't get the logic flow or whatever you call it right in while loops. Ran away on me.

Changed it to an IF statement and added in an else for halting the script, and it worked fine. Iterated 10 times, echoing my text from both scripts, and then the process halted normally.

+++

I was just wanting to test this to see if it worked, and it seems to work OK with some precautions. Back when I was actually playing and scripting, I used to write these huge scripts because I wasn't good with the include function or EventTrigger at that time. I'm sure a few questions in the old twxproxy.com forums and I would have been on top of things, everyone was great with helping you learn to script. Now I can use includes a bit better, but I can see where this would have been a huge help to me 10 years ago.

Back then I had this huge script for managing my assets in the base. It pretty much handled everything you would need to do in your sectors, for the whole bubble. But it had a lot of parts to do all of that, and it was big. And single use.

And I remember thinking, if I could just break that down into modules, I could probably save myself a ton of coding in later scripts. I got out of the game before I progressed on with either using EventTrigger or includes. So I kind of did this to see if I could have used a technique like that to do modular scripts without using include, and I can see where this might have worked.

Plus I was kinda bored today and before I knew it I was in my local game and firing up Notepad++ :lol:

Edit : Nothing in what I said above was meant to imply I don't think the scripters here aren't good about helping you with problems so you can learn to script better, I wouldn't want anyone to misunderstand what I was saying. Your post being a good example LoneStar :D


Wed Nov 19, 2014 12:03 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

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