|
Page 1 of 1
|
[ 13 posts ] |
|
my brain took the day off!
| Author |
Message |
|
BlackBeard
Warrant Officer
Joined: Thu Jan 13, 2005 3:00 am Posts: 82 Location: USA
|
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
|
| Fri May 27, 2005 3:13 pm |
|
 |
|
Traitor
Lieutenant Commander
Joined: Thu Mar 21, 2002 3:00 am Posts: 890 Location: USA
|
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!
_________________ http://tw-cabal.navhaz.com - THE TW info site
Man, I gotta quit showing up here...next thing you know i'll get dragged back in.
|
| Fri May 27, 2005 6:22 pm |
|
 |
|
ElderProphet
Commander
Joined: Tue Oct 07, 2003 2:00 am Posts: 1134 Location: Augusta, GA
|
Ooo, the QuickStats routine again. Man, I'm sure it can be done in 10 lines of code or so
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+
_________________ Claim to Fame: only guy to ever crack the TW haggle algorithm, and fig/shield/hold price formula, twice.
|
| Fri May 27, 2005 10:56 pm |
|
 |
|
Traitor
Lieutenant Commander
Joined: Thu Mar 21, 2002 3:00 am Posts: 890 Location: USA
|
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...
_________________ http://tw-cabal.navhaz.com - THE TW info site
Man, I gotta quit showing up here...next thing you know i'll get dragged back in.
|
| Sat May 28, 2005 9:30 pm |
|
 |
|
Zoso
Ensign
Joined: Fri Sep 19, 2003 2:00 am Posts: 247 Location: Canada
|
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
_________________ No Quarter - Is what we offer our enemies
|
| Sat May 28, 2005 10:05 pm |
|
 |
|
PHX
Lieutenant
Joined: Sat Mar 03, 2001 3:00 am Posts: 592 Location: USA
|
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
|
| Mon May 30, 2005 4:19 am |
|
 |
|
Zarkahn
Lieutenant
Joined: Sat Nov 06, 2004 3:00 am Posts: 600 Location: USA
|
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
_________________ Its not the Kill, Its the Thrill of the Chase
S: Min: 297 Max: 437 Average: 410 -- Just here to attack aliens
S: High/Low Removed Average: 421
|
| Tue May 31, 2005 2:36 pm |
|
 |
|
Zarkahn
Lieutenant
Joined: Sat Nov 06, 2004 3:00 am Posts: 600 Location: USA
|
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.
_________________ Its not the Kill, Its the Thrill of the Chase
S: Min: 297 Max: 437 Average: 410 -- Just here to attack aliens
S: High/Low Removed Average: 421
|
| Tue May 31, 2005 2:41 pm |
|
 |
|
Harley Nuss
Commander
Joined: Thu Feb 20, 2003 3:00 am Posts: 1529 Location: USA
|
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
|
| Tue May 31, 2005 6:07 pm |
|
 |
|
Harley Nuss
Commander
Joined: Thu Feb 20, 2003 3:00 am Posts: 1529 Location: USA
|
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.
|
| Tue May 31, 2005 6:08 pm |
|
 |
|
ElderProphet
Commander
Joined: Tue Oct 07, 2003 2:00 am Posts: 1134 Location: Augusta, GA
|
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+
_________________ Claim to Fame: only guy to ever crack the TW haggle algorithm, and fig/shield/hold price formula, twice.
|
| Tue May 31, 2005 9:29 pm |
|
 |
|
Zarkahn
Lieutenant
Joined: Sat Nov 06, 2004 3:00 am Posts: 600 Location: USA
|
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.
_________________ Its not the Kill, Its the Thrill of the Chase
S: Min: 297 Max: 437 Average: 410 -- Just here to attack aliens
S: High/Low Removed Average: 421
|
| Tue May 31, 2005 9:53 pm |
|
 |
|
Harley Nuss
Commander
Joined: Thu Feb 20, 2003 3:00 am Posts: 1529 Location: USA
|
People play games without photons? 
|
| Tue May 31, 2005 11:40 pm |
|
 |
|
|
Page 1 of 1
|
[ 13 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 20 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
|
|