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

my brain took the day off!
https://mail.black-squirrel.com/viewtopic.php?f=15&t=13136
Page 1 of 1

Author:  BlackBeard [ Fri May 27, 2005 3:13 pm ]
Post subject: 

ok i am not the best thinker when it comes to logic (wish i was cause doesnt that make a better programmer?) anyways i need to get info from the following

when you type "/" to get stats


Sect 131¦Turns 4,500¦Creds 2,064,044¦Figs 199,986¦Shlds 0¦Hlds 255¦Ore 0
Org 255¦Equ 0¦Col 0¦Phot 0¦Armd 200¦Lmpt 200¦GTorp 20¦TWarp 2¦Clks 0¦Beacns 0
AtmDt 5¦Crbo 0¦EPrb 25¦MDis 10¦PsPrb No¦PlScn No¦LRS Holo¦Aln -169,139
Exp 95,928¦Corp 1¦Ship 8 IntCru

since its three lines long how do i go about getting the info ( amount of holds and what u have on you)

TIA

Author:  Traitor [ Fri May 27, 2005 6:22 pm ]
Post subject: 

quote:Originally posted by BlackBeard

ok i am not the best thinker when it comes to logic (wish i was cause doesnt that make a better programmer?) anyways i need to get info from the following

when you type "/" to get stats


Sect 131¦Turns 4,500¦Creds 2,064,044¦Figs 199,986¦Shlds 0¦Hlds 255¦Ore 0
Org 255¦Equ 0¦Col 0¦Phot 0¦Armd 200¦Lmpt 200¦GTorp 20¦TWarp 2¦Clks 0¦Beacns 0
AtmDt 5¦Crbo 0¦EPrb 25¦MDis 10¦PsPrb No¦PlScn No¦LRS Holo¦Aln -169,139
Exp 95,928¦Corp 1¦Ship 8 IntCru

since its three lines long how do i go about getting the info ( amount of holds and what u have on you)

TIA

There are several ways of doing this. You can look at SupG's or CK's includes in their public scripts, or...

:quickstats
send "/"
settextlinetrigger getStats :getStats
settexttrigger command :gotStats "Command"
pause

:getStats
killtrigger getStats
if (CURRENTLINE <> "")
setvar $stats $stats & CURRENTLINE
# the #179 is the ASCII code for |
replacetext $stats #179 " "
striptext $stats ","
settextlinetrigger getStats :getStats
pause
else
settextlinetrigger getStats :getStats
pause
end

:gotStats
killtrigger command
killtrigger getStats

This makes one big var, called $stats.
"$STATS" = "0 Sect 4164 Turns 65519 Creds 497820 Figs 0 Shlds 0 Hlds 70 Ore 0 Org 0 Equ 0 Col 0 Phot 0 Armd 0 Lmpt 0 GTorp 0 TWarp No Clks 0 Beacns 0 AtmDt 0 Crbo 0 EPrb 0 MDis 0 PsPrb No PlScn No LRS Holo Aln -7 Exp 901 Corp 1 Ship 4 MerCru "

Then you use getWords to get the values you want.
i.e.
getword $stats $yourTurns 5

-or-

you can use getText
i.e.
getText $stats $yourTurns "Turns " " Creds"

just keep in mind that if photons are disabled, they don't show up in the list, which may throw off your counts. Same thing with corps. If you aren't in a corp, it won't show up.

i.e.
Sect 4164¦Turns 65,517¦Creds 2,750,130¦Figs 0¦Shlds 0¦Hlds 70¦Ore 0¦Org 0
Equ 0¦Col 0¦Phot 0¦Armd 0¦Lmpt 0¦GTorp 4¦TWarp No¦Clks 0¦Beacns 0¦AtmDt 4
Crbo 0¦EPrb 0¦MDis 0¦PsPrb No¦PlScn No¦LRS Holo¦Aln -1¦Exp 976¦Corp 1
Ship 4 MerCru

vs.
Sect 4164¦Turns 65,517¦Creds 2,750,130¦Figs 0¦Shlds 0¦Hlds 70¦Ore 0¦Org 0
Equ 0¦Col 0¦Armd 0¦Lmpt 0¦GTorp 4¦TWarp No¦Clks 0¦Beacns 0¦AtmDt 4
Crbo 0¦EPrb 0¦MDis 0¦PsPrb No¦PlScn No¦LRS Holo¦Aln -1¦Exp 976¦Ship 4 MerCru

Hope that helps!

Author:  ElderProphet [ Fri May 27, 2005 10:56 pm ]
Post subject: 

Ooo, the QuickStats routine again. Man, I'm sure it can be done in 10 lines of code or so :P

On a side note though, there may be better ways of getting your hold Qty and contents. Are you trying to get that info while porting? Or for some other reason?

+EP+

Author:  Traitor [ Sat May 28, 2005 9:30 pm ]
Post subject: 

What, 20 lines not good enough for ya? [:P]

Now...

If some TWXProxy programmer made some system values that would get updated when you hit /, that would shorten the code a bit, eh?

not that I've been wanting that since 1.06b or anything...

Author:  Zoso [ Sat May 28, 2005 10:05 pm ]
Post subject: 

If Blackbeard is only interested in holds and what is in them, would "/" be the most effecient manner of retreiving that data? Seems like a lot of info for two values.

Zoso

Author:  PHX [ Mon May 30, 2005 4:19 am ]
Post subject: 

Well its no 10 lines but even EP thought good for my final code on that...go here, it will be my next to last post on that page.

http://www.eisonline.com/TWForum/topic. ... C_ID=17271

I also normally keep it up on my script site but my router has a tendancy to reset and then re-organize the NAT addresses to the computers on my network while still trying to point to the previous local ip for the web site.

So that site is basically up and down alot.

http://www.cvent.no-ip.org/tw

Author:  Zarkahn [ Tue May 31, 2005 2:36 pm ]
Post subject: 

I read ur other post Phx, but I know Zoc better than twx, so is there a way to use what Zoc can grab and twx use it, sorta like the way it automatically caps warp data when u ZTM in Zoc ?
Harley u made the last post on that other thread, sayin it was easier in Zoc.
well I guess I should be sayin Rexx instead of Zoc, but I'm stuck with the Zoc startin most lines...lol

Author:  Zarkahn [ Tue May 31, 2005 2:41 pm ]
Post subject: 

and BlackBeard u never said other than holds and what u had in them, what info u wanted.
dependin on where u are the "I" will pull that info too, not sure if it would be easier to get or not. Need a few more details on what ur wantin exactly.

Author:  Harley Nuss [ Tue May 31, 2005 6:07 pm ]
Post subject: 

quote:Originally posted by Zarkahn

I read ur other post Phx, but I know Zoc better than twx, so is there a way to use what Zoc can grab and twx use it, sorta like the way it automatically caps warp data when u ZTM in Zoc ?
Harley u made the last post on that other thread, sayin it was easier in Zoc.
well I guess I should be sayin Rexx instead of Zoc, but I'm stuck with the Zoc startin most lines...lol


My ZOC REXX code won't help at all here, really. For those that are interested, though, this is my / stats routine. I don't think anyone who plays anymore scripts in REXX, besides me. If someone happens to, though, you will need globals = "stats." in your main script to use this function as is.

Code:
/** _slashstats v2.0.1 **/
/** Usage: _slashstats() **/
/** Returns: nothing **/
/** Notes: sets the stats. array **/
/** stats.sect, stats.turns, stats.credits **/
/** stats.figs, stats.shields, stats.holds, stats.ore **/
/** stats.org, stats.equip, stats.colos, stats.photons **/
/** stats.armids, stats.limpets, stats.gtorps, stats.twarp **/
/** stats.cloaks, stats.beacons, stats.dets, stats.corbo **/
/** stats.probes, stats.disrupt, stats.psyprobe, stats.pscan **/
/** stats.lrs, stats.align, stats.exp, stats.corp, stats.ship **/

_slashstats: procedure expose (globals)
   stats. = 0
   call zocsend "/"
   call zocwait "Sect"
   call zocreceivebuf(600)
   call zocwait "Ship "
   statsbuf = zocreceivebuf(0)
   call zocwait " "
   stats.ship = zoclastline()
   statsbuf = zocstring(REMOVECHARS, statsbuf, ","||d2c(10)||d2c(13))
   statsbuf = zocstring(REPLACE, statsbuf, d2c(179), " ")
   stats.sect = word(statsbuf, 1)
   stats.turns = word(statsbuf, 3)
   stats.credits = word(statsbuf, 5)
   stats.figs = word(statsbuf, 7)
   stats.shields = word(statsbuf, 9)
   stats.holds = word(statsbuf, 11)
   stats.ore = word(statsbuf, 13)
   stats.org = word(statsbuf, 15)
   stats.equip = word(statsbuf, 17)
   stats.colos = word(statsbuf, 19)
   stats.photons = word(statsbuf, 21)
   stats.armids = word(statsbuf, 23)
   stats.limpets = word(statsbuf, 25)
   stats.gtorps = word(statsbuf, 27)
   stats.twarp = word(statsbuf, 29)
   stats.cloaks = word(statsbuf, 31)
   stats.beacons = word(statsbuf, 33)
   stats.dets = word(statsbuf, 35)
   stats.corbo = word(statsbuf, 37)
   stats.probes = word(statsbuf, 39)
   stats.disrupt = word(statsbuf, 41)
   stats.psyprobe = word(statsbuf, 43)
   stats.pscan = word(statsbuf, 45)
   stats.lrs = word(statsbuf, 47)
   stats.align = word(statsbuf, 49)
   stats.exp = word(statsbuf, 51)
   if wordpos("Corp", statsbuf) <> 0 then do
      stats.corp = word(statsbuf, 53)
   end
   return

Author:  Harley Nuss [ Tue May 31, 2005 6:08 pm ]
Post subject: 

I would also like to comment, that aside from setting variable for every value in the quickstats, the code is only 9-10 lines long.

Author:  ElderProphet [ Tue May 31, 2005 9:29 pm ]
Post subject: 

Yup, I'm impressed. It looks like it will mess up if photons are off though. I'm still working on the 10 line TWX equivalent ;)

+EP+

Author:  Zarkahn [ Tue May 31, 2005 9:53 pm ]
Post subject: 

lol, thanks Harley, and yes some of us peeps still program in zoc/Rexx, I learned it be4 TWX, and knew basic from a long time ago and it just looked more familier.

Author:  Harley Nuss [ Tue May 31, 2005 11:40 pm ]
Post subject: 

People play games without photons? :P

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