View unanswered posts | View active topics It is currently Mon Apr 20, 2026 5:39 am



Reply to topic  [ 13 posts ] 
 2_Worldtrade.ts 
Author Message
Lieutenant J.G.

Joined: Mon Feb 26, 2001 3:00 am
Posts: 441
Location: In your girlfriend's bed
Unread post 2_Worldtrade.ts
I need to add some coding to the 2_Worldtrade.ts script that came with TWX proxy that would terminate the script if I get too low on turns, say 50 turns. I was using it today and I looked away for a minute and when I looked back my turns was down to zero. Thankfully no one else was on and I patiently waited for my turns to come back at the top of the hour and limped home.

I also need to use this same coding for a custom colonizing script that I'm writing. I want that script to terminate as well if the turns get too low.

I'm told Mombot will monitor that, but I think Mombot only monitors its own scripts and not the outside scripts. I could be wrong. I did have Mombot running when I ran this worldtrade script and it was set for 50 turns, but I guess that didn't work.

Any help is appreciated and thank you.


Mon Jul 05, 2010 6:21 pm
Profile
Ambassador
User avatar

Joined: Wed Nov 12, 2008 8:57 am
Posts: 3554
Location: Long Beach, CA
Unread post Re: 2_Worldtrade.ts
so something like if turns > 51 continue, else halt?

so you would have to get the number of turns, throw them in a variable. Where would you want to do the check? Before porting? Before moving? After porting? All of those?

Lets work out the algorithm then put it together.

<digging out the script.html>

setVar $t = 0 //set turns variable to 0
//get current turns however (maybe using / to grab the current number of turns), then
$t = $ct //turns = current turns
IF ($t =< 50) // if the turns are greater than fifty one
HALT
ELSE
//continue trading
END

H

_________________
Helix
Do I really look like a guy with a plan? You know what I am? I'm a dog chasing cars.
Lest we forget
I had to ask myself WWSGD?


Last edited by Helix on Mon Jul 05, 2010 8:09 pm, edited 1 time in total.



Mon Jul 05, 2010 7:44 pm
Profile WWW
Lieutenant J.G.

Joined: Mon Feb 26, 2001 3:00 am
Posts: 441
Location: In your girlfriend's bed
Unread post Re: 2_Worldtrade.ts
I would have to say after porting and before moving to the next port.

That line would be similar to what I have in mind.


Mon Jul 05, 2010 7:51 pm
Profile
Commander

Joined: Sun Feb 25, 2001 3:00 am
Posts: 1838
Location: Guam USA
Unread post Re: 2_Worldtrade.ts
Since you mentioned you are using mom bot , you can loadvar unlim
determine if its true or false ...

If false & not "0"
Get user input st (stop at turns)
use the include playerinfo
and pull your turns with a gosub to it
set var ct (current turns)

Else
setvar ct 99999
End

then in begining of work loop

gosub playerinfo
set ct playerinfo~turns
IF ($ct <= $st)
echo "*reached turn limit of "& $ct
halt
end

/ rest of script here

_________________
TWGS V2 Vids World on Guam Port 2002
Telnet://vkworld.ddns.net:2002
Discord @ DiverDave#8374
Vid's World Discord

Founding Member -=[Team Kraaken]=- Ka Pla

Image
Winners of Gridwars 2010
MBN Fall Tournament 2011 winners Team Kraaken
Undisputed Champions of 2019 HHT Just for showing up!

The Oldist , Longist Running , Orginal Registered Owner of a TWGS server :
Vids World On Guam


Mon Jul 05, 2010 9:31 pm
Profile WWW
Gameop
User avatar

Joined: Tue Nov 19, 2002 3:00 am
Posts: 1050
Location: USA
Unread post Re: 2_Worldtrade.ts
if you dont want to depend on mombot (while easier) you could use dynarri's quickstats found at http://www.navhaz.com (opensource).

Then you just check against that the quickstats routine.

#Set your minimum turn variable with a number
SetVar $MinimumTurns 50

#beginning code prior your check

#goto subroutine quickstats
gosub :quickstats

#If minimumturns less than or equal to your quickstats routine which uses / to get your turn data
#Then echo your custom text and halt.
if ($MinimumTurns <= $Quickstats[TURNS])
Echo ANSI_12 "**Halting due to minimum turn threshold"
halt
end

#---Subs
:quickstats
#The quickstats routine (I use Dynarri's) goes here

#Return to the main code
return

_________________
Dark Dominion TWGS
Telnet://twgs.darkworlds.org:23
ICQ#31380757, -=English 101 pwns me=-
"This one claims to have been playing since 1993 and didn't know upgrading a port would raise his alignment."


Mon Jul 05, 2010 9:45 pm
Profile ICQ
Ambassador
User avatar

Joined: Wed Nov 12, 2008 8:57 am
Posts: 3554
Location: Long Beach, CA
Unread post Re: 2_Worldtrade.ts
Since Sing does't have it as a stand alone .ts file, I pulled it out of one of the dny scripts

# -------------------------------------------------------------------
# Quickstats routine by Dnyarri. A simple way to parse the slash stats
# into something useful.
# -------------------------------------------------------------------

:do_quickstats
killtrigger statlinetrig
setVar $stats ""
setTextLineTrigger statlinetrig :statsline #179
send "/"
pause

:statsline
killtrigger statlinetrig
setVar $line CURRENTLINE
replacetext $line #179 " "
striptext $line ","
setVar $stats $stats & $line
getWordPos $line $pos "Ship"
if ($pos > 0)
goto :gotStats
else
setTextLineTrigger statlinetrig :statsline
end
pause

:gotStats
setVar $quickstats[SECT] 0
setVar $quickstats[TURNS] 0
setVar $quickstats[CREDS] 0
setVar $quickstats[FIGS] 0
setVar $quickstats[SHLDS] 0
setVar $quickstats[HLDS] 0
setVar $quickstats[ORE] 0
setVar $quickstats[ORG] 0
setVar $quickstats[EQU] 0
setVar $quickstats[COL] 0
setVar $quickstats[PHOT] 0
setVar $quickstats[ARMD] 0
setVar $quickstats[LMPT] 0
setVar $quickstats[GTORP] 0
setVar $quickstats[TWARP] 0
setVar $quickstats[CLKS] 0
setVar $quickstats[BEACNS] 0
setVar $quickstats[ATMDT] 0
setVar $quickstats[CRBO] 0
setVar $quickstats[EPRB] 0
setVar $quickstats[MDIS] 0
setVar $quickstats[PSPRB] "NO"
setVar $quickstats[PLSCN] "NO"
setVar $quickstats[LRS] "NONE"
setVar $quickstats[ALN] 0
setVar $quickstats[EXP] 0
setVar $quickstats[CORP] 0
setVar $quickstats[SHIP] 0
setVar $quickstats[TYPE] 0
setVar $stats $stats & " @@@"
upperCase $stats
setVar $current_word 0
setVar $wordy ""
while ($wordy <> "@@@")
if ($wordy = "SECT")
getWord $stats $quickstats[SECT] ($current_word + 1)
elseif ($wordy = "TURNS")
getWord $stats $quickstats[TURNS] ($current_word + 1)
elseif ($wordy = "CREDS")
getWord $stats $quickstats[CREDS] ($current_word + 1)
elseif ($wordy = "FIGS")
getWord $stats $quickstats[FIGS] ($current_word + 1)
elseif ($wordy = "SHLDS")
getWord $stats $quickstats[SHLDS] ($current_word + 1)
elseif ($wordy = "HLDS")
getWord $stats $quickstats[HLDS] ($current_word + 1)
elseif ($wordy = "ORE")
getWord $stats $quickstats[ORE] ($current_word + 1)
elseif ($wordy = "ORG")
getWord $stats $quickstats[ORG] ($current_word + 1)
elseif ($wordy = "EQU")
getWord $stats $quickstats[EQU] ($current_word + 1)
elseif ($wordy = "COL")
getWord $stats $quickstats[COL] ($current_word + 1)
elseif ($wordy = "PHOT")
getWord $stats $quickstats[PHOT] ($current_word + 1)
elseif ($wordy = "ARMD")
getWord $stats $quickstats[ARMD] ($current_word + 1)
elseif ($wordy = "LMPT")
getWord $stats $quickstats[LMPT] ($current_word + 1)
elseif ($wordy = "GTORP")
getWord $stats $quickstats[GTORP] ($current_word + 1)
elseif ($wordy = "TWARP")
getWord $stats $quickstats[TWARP] ($current_word + 1)
elseif ($wordy = "CLKS")
getWord $stats $quickstats[CLKS] ($current_word + 1)
elseif ($wordy = "BEACNS")
getWord $stats $quickstats[BEACNS] ($current_word + 1)
elseif ($wordy = "ATMDT")
getWord $stats $quickstats[ATMDT] ($current_word + 1)
elseif ($wordy = "CRBO")
getWord $stats $quickstats[CRBO] ($current_word + 1)
elseif ($wordy = "EPRB")
getWord $stats $quickstats[EPRB] ($current_word + 1)
elseif ($wordy = "MDIS")
getWord $stats $quickstats[MDIS] ($current_word + 1)
elseif ($wordy = "PSPRB")
getWord $stats $quickstats[PSPRB] ($current_word + 1)
elseif ($wordy = "PLSCN")
getWord $stats $quickstats[PLSCN] ($current_word + 1)
elseif ($wordy = "LRS")
getWord $stats $quickstats[LRS] ($current_word + 1)
elseif ($wordy = "ALN")
getWord $stats $quickstats[ALN] ($current_word + 1)
elseif ($wordy = "EXP")
getWord $stats $quickstats[EXP] ($current_word + 1)
elseif ($wordy = "CORP")
getWord $stats $quickstats[CORP] ($current_word + 1)
elseif ($wordy = "SHIP")
getWord $stats $quickstats[SHIP] ($current_word + 1)
getWord $stats $quickstats[TYPE] ($current_word + 2)
end
add $current_word 1
getWord $stats $wordy $current_word
end
return

# -------------------------------------------------------------------

_________________
Helix
Do I really look like a guy with a plan? You know what I am? I'm a dog chasing cars.
Lest we forget
I had to ask myself WWSGD?


Mon Jul 05, 2010 10:48 pm
Profile WWW
Gameop
User avatar

Joined: Tue Nov 19, 2002 3:00 am
Posts: 1050
Location: USA
Unread post Re: 2_Worldtrade.ts
Helix wrote:
Since Sing does't have it as a stand alone .ts file, I pulled it out of one of the dny scripts


My bad I thought it was in a standalone version. Either way quickstats is my preferred method to pull player stats as it doesn't depend on any single script loading right. Off topic personally I like to leave the authors headers in, reminds me who to thank for the routine :-)

/Double offtopic sorta: is the mombot unlimited check variable named $Unlim and is it a SaveVar?

P.s. I recommend both using TWXIDE.exe as the text editor (I recommend it highly) or using http://www.navhaz.com/files/script.html
as reference for your colonizing script. Makes life much easier to have a quick reference that you don't have to load from within a script directory.

_________________
Dark Dominion TWGS
Telnet://twgs.darkworlds.org:23
ICQ#31380757, -=English 101 pwns me=-
"This one claims to have been playing since 1993 and didn't know upgrading a port would raise his alignment."


Mon Jul 05, 2010 11:12 pm
Profile ICQ
Commander

Joined: Sun Feb 25, 2001 3:00 am
Posts: 1838
Location: Guam USA
Unread post Re: 2_Worldtrade.ts
My mention of the mom bot was as to the .cfg variable it saved for the Unlim status.

and to use it , you
LoadVar $Unlim (as mentioned by someone above)

and as for the quick stats , that would add alot of extra code to your script verses

Gosub : PlayerInfo~InfoQuick
SetVar $ActualTurns $PlayerInfo~Turns


just my prefs.

_________________
TWGS V2 Vids World on Guam Port 2002
Telnet://vkworld.ddns.net:2002
Discord @ DiverDave#8374
Vid's World Discord

Founding Member -=[Team Kraaken]=- Ka Pla

Image
Winners of Gridwars 2010
MBN Fall Tournament 2011 winners Team Kraaken
Undisputed Champions of 2019 HHT Just for showing up!

The Oldist , Longist Running , Orginal Registered Owner of a TWGS server :
Vids World On Guam


Mon Jul 05, 2010 11:47 pm
Profile WWW
Lieutenant Commander
User avatar

Joined: Sat Feb 27, 2010 7:59 pm
Posts: 782
Unread post Re: 2_Worldtrade.ts
while i see why you would do this, i dont run 2_worldtrade if im AFK. it can get you podded...

_________________
I was immortal, for a little while...
http://www.youtube.com/watch?v=5ZY2mRG5mzg


Tue Jul 06, 2010 12:07 am
Profile
Lieutenant J.G.

Joined: Mon Feb 26, 2001 3:00 am
Posts: 441
Location: In your girlfriend's bed
Unread post Re: 2_Worldtrade.ts
That it does, Booger. It's so fast that I looked away for a moment when I was down to about 200 turns and a moment was all it took for me to get right down to zero. Crap happens :)

Anyways, I appreciate the effort from all of you for providing the code snippets. Thanks :)


Tue Jul 06, 2010 12:20 am
Profile
Lieutenant Commander
User avatar

Joined: Sat Feb 27, 2010 7:59 pm
Posts: 782
Unread post Re: 2_Worldtrade.ts
that fast? wow your system must be smoking... i try to stay out of turn games too... so tha tisnt an issue as much...

_________________
I was immortal, for a little while...
http://www.youtube.com/watch?v=5ZY2mRG5mzg


Tue Jul 06, 2010 12:26 am
Profile
Lieutenant J.G.

Joined: Mon Feb 26, 2001 3:00 am
Posts: 441
Location: In your girlfriend's bed
Unread post Re: 2_Worldtrade.ts
I remember the old days when it would take me a while to run 700-1000 turns on dial up and with slow scripts (TWAR for Windows anyone?)

Now these days, I can blow through 1000-1500 turns in no time at all.

I can see why high turn games are so prevalent these days.

But once again, thanks for the snippets, guys. I'm heading to bed and will look at them tomorrow :)


Tue Jul 06, 2010 12:38 am
Profile
Commander
User avatar

Joined: Wed May 03, 2006 2:00 am
Posts: 1722
Location: USA
Unread post Re: 2_Worldtrade.ts
Mombot :quikstats goes into endless loop under certain conditions

turns = 0...turns game...at least it does in the beta twgs

_________________
Coconut Telegraph (ICQ)#586137616
Team Speak3@ 220.244.125.70:9987
Founding Member -=[Team Kraaken]=- Winner of Gridwars 2010 - Ka Pla
Image
Jesus wounldn't Subspace Crawl


Sun Oct 17, 2010 4:42 pm
Profile ICQ YIM
Display posts from previous:  Sort by  
Reply to topic   [ 13 posts ] 

Who is online

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