View unanswered posts | View active topics It is currently Thu Jan 01, 2026 2:43 pm



Reply to topic  [ 12 posts ] 
 Second Mod for OCSBot 
Author Message
Commander
User avatar

Joined: Fri Aug 20, 2004 2:00 am
Posts: 1801
Location: Outer Rims
Unread post Second Mod for OCSBot
I'm working on a second mod for our OCSBot called OCSBot_Patrol. This script will work in conjunction with our TradeWars Academy game. The idea is to get a list of sectors from sector 1 to StarDock, write to a text file, then go into the editor and enter each sector listed in the text file. It will set the beacon, remove any figs or mines from those sectors only. It is the same concept as those fedsweeper scripts, except it only does the route to and from StarDock. It is also my attempt to write a script that will get info and write to a text file, then use that data to perform functions.

I've been bombarding Promethius with questions on this mod and have probably worn him out ;) I'm encountering an error with the script and would like to try to figure out why. The way it works is this. OCSBot.ts runs in a session and loads our OCSBot_Recon script. When I load the OCSBot_Patrol script, it is to get the sectors to StarDock, then stop the OCSBot_Recon script, enter the editor, and edit those sectors that are in the list, where I can set the beacon, set the figs and mines to 0. When I load the OCSBot_Patrol script, it works right up to the point to the editor and then I get the following error:

Trade Wars 2002 Editor (?=Help) [?] : Script run-time error in 'OCSBOT_PATROL.TS': 'SentryList.txt' is not a decimal number, line 27

Script terminated: F:\games\TradeWars\twxproxy_ocs2a\Scripts\OCSBot\mods\OCSBot_patrol.ts

I have noticed that when it writes the sectors to the text file, there is a blank line at the end of the file. Is that the issue?

Here is the script code I am stuck on:

Code:

WaitOn "Editor (?="
fileExists $fileAvail $SentryFile
if ($fileAvail = FALSE)
    halt
end
   readtoarray $SentryFile $SentryCount
   setVar $i 2
   while ($i <= $SentryFile)
        send "s" 
        WaitFor "Sector number (0="
        send $SentryCount[$i]
        getLength $len $sentryCount[$i]
        if ($len < 5)
            send "*"
        end
        add $i 1           
end
send "n"
send $beacon "*"


_________________
-Thrawn

But risk has always been an inescapable part of warfare.

--

Knight to Queen's Bishop 3


Sat Mar 21, 2009 5:06 pm
Profile
Ambassador
User avatar

Joined: Mon Feb 09, 2004 3:00 am
Posts: 3141
Location: Kansas
Unread post Re: Second Mod for OCSBot
k, think I might see where it is and changed it below.

readtoarray $SentryFile $SentryCount
setVar $i 2
##### the following line is probably as it should have been, I most likely typed in the wrong var #####
while ($i <= $SentryCount)
send "s"
WaitFor "Sector number (0="
send $SentryCount[$i]
getLength $len $sentryCount[$i]
if ($len < 5)
send "*"
end
add $i 1
end

_________________
               / Promethius / Enigma / Wolfen /

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


Sat Mar 21, 2009 9:03 pm
Profile ICQ
Gameop
User avatar

Joined: Tue Sep 25, 2007 7:27 pm
Posts: 530
Location: Long Island
Unread post Re: Second Mod for OCSBot
Thrawn,

That could very well be the problem... what you might want to do is put a pause after the readtoarray command and then do a dump of the variables, and see what is actually in the array, that should let you know for sure if it is erroring out on a blank record.

_________________
If you have a building game, they will come...

Proud Sysop of ICE9 TWGS
Home of Building and Non Regulated Games
http://www.oregonsouth.com/ice9
telnet://ice9-tw.com:2002


Sat Mar 21, 2009 9:10 pm
Profile
Commander
User avatar

Joined: Fri Aug 20, 2004 2:00 am
Posts: 1801
Location: Outer Rims
Unread post Re: Second Mod for OCSBot
Ok Promethius, I have made the change according to your direction. Fixed the previous error. The script goes into the editor, presses "s" for sector editor, inputs the number from the list, then presses "n" to enter the beacon, then presses "x" to return to the tedit. The only problem is it goes to enter a 5 character sector number (ex: 12095) and next thing is it is back at the main tedit screen. The 4 character sectors work fine, just the 5 character sectors.

Other question I'd like to ask is see in the script where I return to the game. Is there a "shorter" way to tell the script anytime it sees [Pause] then enter is pressed, rather than typing out the multiple lines I have done?

Here's what I have now (section snip):

Code:
   readtoarray $SentryFile $SentryCount
   setVar $i 2
   while ($i <= $SentryCount)
        send "s" 
        WaitFor "Sector number (0="
        send $SentryCount[$i]
        getLength $len $sentryCount[$i]
        if ($len < 5)
            send "*"
        end
        send "n"
        waitfor "Enter new Marker Beacon:"
        send $beacon "*"
        send "x"
        add $i 1           
end
send "x"
send "q"
waitfor "Selection"
send "$"
send GAME
waitfor "[Press Space or Enter to continue]"
send "*"
waitfor "[Pause]"
send "*"
waitfor "Enter your choice:"
send "t*"
waitfor "Show today's log? (Y/N) [N]"
send "n"
waitfor "[Pause]"
send "*"
waitfor "Password?"
send Password "*"
waitfor "[Pause]"
send "*"
Send "*"
halt


_________________
-Thrawn

But risk has always been an inescapable part of warfare.

--

Knight to Queen's Bishop 3


Sat Mar 21, 2009 9:50 pm
Profile
Ambassador
User avatar

Joined: Mon Feb 09, 2004 3:00 am
Posts: 3141
Location: Kansas
Unread post Re: Second Mod for OCSBot
Change: getLength $len $sentryCount[$i]
to: getLength $sentryCount[$i] $len

That will fix the length error. I have a tendency for some reason to transpose that command.

_________________
               / Promethius / Enigma / Wolfen /

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


Sat Mar 21, 2009 10:07 pm
Profile ICQ
Commander
User avatar

Joined: Fri Aug 20, 2004 2:00 am
Posts: 1801
Location: Outer Rims
Unread post Re: Second Mod for OCSBot
Promethius wrote:
Change: getLength $len $sentryCount[$i]
to: getLength $sentryCount[$i] $len

That will fix the length error. I have a tendency for some reason to transpose that command.


That was it. Thank you once again for all your help.

_________________
-Thrawn

But risk has always been an inescapable part of warfare.

--

Knight to Queen's Bishop 3


Sat Mar 21, 2009 10:36 pm
Profile
Commander
User avatar

Joined: Fri Aug 20, 2004 2:00 am
Posts: 1801
Location: Outer Rims
Unread post Re: Second Mod for OCSBot
In my mod I am writing, it gets the course from Sector 1 to StarDock. I noticed in one test game I run, the OCSBot Recon follows the same path from Sector 1 to StarDock and back. For example, it has the course: 5, 5997, 2338, 12065, 3253 (StarDock). It enters each of these sectors to and from.

In a second test game I noticed my OCSBot Recon takes path to StarDock, but on the return it changes course midway to Sector 1. So the course is: 2, 8, 3745, 17230, 2538, 7288, 158, 12654 (StarDock). On the return to Sector 1, it hits 158, 7288, 2538, and instead of going to 17230, it takes an alternate route and ends up at Sector 1 (backdoor perhaps?)

I am wondering if someone may be able to tell me why that could be?

_________________
-Thrawn

But risk has always been an inescapable part of warfare.

--

Knight to Queen's Bishop 3


Sun Mar 22, 2009 1:24 am
Profile
Gameop
User avatar

Joined: Mon Jan 26, 2009 12:27 am
Posts: 123
Unread post Re: Second Mod for OCSBot
Maybe your script take a shorter way...
If you want to have the same path, put the values sector into an array and reverse it...

_________________
Dodger known as Yop Solo, Sysop
twgsdodgerbbs.ath.cx
http://cyberquebec.ca/_layout/?uri=http://cyberquebec.ca/twgsdodgerbbs/


Sun Mar 22, 2009 9:25 am
Profile
Veteran Op
User avatar

Joined: Thu Jun 02, 2005 2:00 am
Posts: 5558
Location: USA
Unread post Re: Second Mod for OCSBot
Quote:
I am wondering if someone may be able to tell me why that could be?


You using a CF plot? If so, then it's because there's a backdoor that creates a quicker route in that direction. The path to dock and the path from dock are not always the same.

_________________
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


Sun Mar 22, 2009 10:11 am
Profile ICQ WWW
Commander
User avatar

Joined: Fri Aug 20, 2004 2:00 am
Posts: 1801
Location: Outer Rims
Unread post Re: Second Mod for OCSBot
Singularity wrote:
Quote:
I am wondering if someone may be able to tell me why that could be?


You using a CF plot? If so, then it's because there's a backdoor that creates a quicker route in that direction. The path to dock and the path from dock are not always the same.


The exact plot I am using is:

send "^f1*" $sd "*q"
waitfor "TO > " & $SD

It produced the same as if I used the "cf" method. I just thought it weird in one game it used the same sectors to and from, and another it used the backdoor to return to sector 1. I'm fine with it in any event. It provides a clear path from sector 1 to StarDock only, does not do adjacent sectors like other sweeper scripts do.

_________________
-Thrawn

But risk has always been an inescapable part of warfare.

--

Knight to Queen's Bishop 3


Sun Mar 22, 2009 10:57 am
Profile
Veteran Op
User avatar

Joined: Thu Jun 02, 2005 2:00 am
Posts: 5558
Location: USA
Unread post Re: Second Mod for OCSBot
Nod. That method is the same as a CF plot. It uses your in-game avoids to build a course. It is vulnerable to back doors.

_________________
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


Sun Mar 22, 2009 5:35 pm
Profile ICQ WWW
Commander
User avatar

Joined: Fri Aug 20, 2004 2:00 am
Posts: 1801
Location: Outer Rims
Unread post Re: Second Mod for OCSBot
Understood. I just happened to notice it during a final test run before I put it together and upload/update OCSBot. I was excited to have this mod work, but it was strange seeing this event happen. I started disecting my code thinking I made a mistake. Hence i had to ask before I deleted it and restarted from scratch.

Thanks Sing for the info.

_________________
-Thrawn

But risk has always been an inescapable part of warfare.

--

Knight to Queen's Bishop 3


Sun Mar 22, 2009 6:34 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 12 posts ] 

Who is online

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