| Author |
Message |
|
PHX
Lieutenant
Joined: Sat Mar 03, 2001 3:00 am Posts: 592 Location: USA
|
Itd be nice...for us scripters if the / display used actual spaces instead of ³ or | or whatever the hell its supposed to be between the stats.
Somehow I doubt anyone will give a **** what I think about this. So just speaking my mind.
|
| Sun May 09, 2004 5:13 am |
|
 |
|
Kavanagh
Ambassador
Joined: Wed Feb 28, 2001 3:00 am Posts: 1410 Location: Boo! inc. Ireland
|
Why not just use eg "³Creds" as a trigger?
|
| Sun May 09, 2004 12:27 pm |
|
 |
|
ElderProphet
Commander
Joined: Tue Oct 07, 2003 2:00 am Posts: 1134 Location: Augusta, GA
|
In TWX, that little dividing line in the quickstats display is #179. So you can use that ANSI code as the first or second value of a getText command like this:
setTextLineTrigger getExp :getExp #179 & "Exp"
send "/"
pause
:getExp
getText CURRENTLINE $exp "Exp " #179
echo ANSI_14 "*Recorded Experience as " $exp "*"
_________________ Claim to Fame: only guy to ever crack the TW haggle algorithm, and fig/shield/hold price formula, twice.
|
| Sun May 09, 2004 2:51 pm |
|
 |
|
PHX
Lieutenant
Joined: Sat Mar 03, 2001 3:00 am Posts: 592 Location: USA
|
EP...that doesn't work
|
| Sun May 09, 2004 4:36 pm |
|
 |
|
PHX
Lieutenant
Joined: Sat Mar 03, 2001 3:00 am Posts: 592 Location: USA
|
Ok i fixed the code and it worked while I was in a fully loaded ship with lots of xp and align and stuff so the Exp data came on the 4th line after sending /, then I logged in as a different user in a pod with nothing on it and very little align and xp so that the Exp data would come on the 3rd line...and it didn't work in that case.
This is very similar to one that i previously made myself that had the exact same problem, main difference is i used the ³ instead of the ascii code #179.
Same results.
|
| Sun May 09, 2004 5:06 pm |
|
 |
|
PHX
Lieutenant
Joined: Sat Mar 03, 2001 3:00 am Posts: 592 Location: USA
|
the revised code:
send "/"
setTextLineTrigger getExp :getExp "Exp"
pause
:getExp
getText CURRENTLINE $exp "Exp " #179
striptext $exp ","
pause
send "'Recorded Experience as " $exp "*"
the output with exp on 3rd line...
Loading and compiling script: E:\Tradewars\Twx202\Scripts\Phx\test2.ts
Command [TL=00:00:00]:[14654] (?=Help)? :
Sect 14654¦Turns 0¦Creds 25¦Figs 20¦Shlds 600¦Hlds 1¦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 Dens¦Aln 1,042¦Exp 799¦Ship 25 EscPod
Command [TL=00:00:00]:[14654] (?=Help)? :
Script>
Variable dump for script: E:\Tradewars\Twx202\Scripts\Phx\test2.ts
"$EXP" = ""
Script>
the output with exp on 4th line...
Loading and compiling script: E:\Tradewars\Twx202\Scripts\Phx\test2.ts
Command [TL=00:00:00]:[6537] (?=Help)? :
Sect 6537¦Turns 0¦Creds 5,480,391¦Figs 267,298¦Shlds 6,075¦Hlds 255¦Ore 0
Org 0¦Equ 0¦Col 0¦Phot 0¦Armd 255¦Lmpt 255¦GTorp 10¦TWarp 2¦Clks 5¦Beacns 10
AtmDt 10¦Crbo 1,246¦EPrb 25¦MDis 40¦PsPrb No¦PlScn No¦LRS Holo¦Aln 2,454,735
Exp 267,050¦Corp 3¦Ship 21 Other
Command [TL=00:00:00]:[6537] (?=Help)? :
Script>
Variable dump for script: E:\Tradewars\Twx202\Scripts\Phx\test2.ts
"$EXP" = "267050"
Script>
|
| Sun May 09, 2004 5:15 pm |
|
 |
|
ElderProphet
Commander
Joined: Tue Oct 07, 2003 2:00 am Posts: 1134 Location: Augusta, GA
|
Right, If Exp comes up at the end of the line, you will not capture correctly. I allow for this using the following method:
send "/"
setTextLineTrigger getexp :getexp "Exp"
pause
:getExp
setvar $line CURRENTLINE & "@@"
gettext $line $exp "Exp " #179 & "Exp"
if $exp = ""
gettext $line $exp "Exp " "@@"
end
striptext $exp ","
striptext $exp " "
I use @@ to let me know that I am at the end of the CURRENTLINE. This should do the trick, even when the lines change.
+EP+
_________________ Claim to Fame: only guy to ever crack the TW haggle algorithm, and fig/shield/hold price formula, twice.
|
| Sun May 09, 2004 8:24 pm |
|
 |
|
PHX
Lieutenant
Joined: Sat Mar 03, 2001 3:00 am Posts: 592 Location: USA
|
That don't work either...
|
| Tue May 11, 2004 5:26 pm |
|
 |
|
PHX
Lieutenant
Joined: Sat Mar 03, 2001 3:00 am Posts: 592 Location: USA
|
OK this *#&%( @$^@$#(* *@#%&@ (@#%&@$ @$^@%$ has taken me many hours to figure out but I finally got it. Alexio was kind enough to provide me with a way to get experience from sending / however I was not happy with the length of the script as it was like 3 times as long as this one. This thing gave me such headaches I wan't to try and help make sure nobody else goes through the same pains. So heres the code.
send "/"
waitfor "Exp"
setvar $expline CURRENTLINE
replacetext $expline "³" " "
getword $expline $exp1 1
getword $expline $exp2 3
getword $expline $exp3 13
getword $expline $exp4 15
if ($exp1 = "Exp")
getword $expline $exp 2
goto :stripexp
elseif ($exp2 = "Exp")
getword $expline $exp 4
goto :stripexp
elseif ($exp3 = "Exp")
getword $expline $exp 14
goto :stripexp
elseif ($exp4 = "Exp")
getword $expline $exp 16
:stripexp
striptext $exp ","
The code is VERY very simple it never should have taken me so long to figure this out. I don't think it would but if Exp should happen to show up in a different position in the line than one of these then that position can be easily added.
Sorry EP but that code you posted does not work...at least not for me.
|
| Thu May 13, 2004 3:06 am |
|
 |
|
ElderProphet
Commander
Joined: Tue Oct 07, 2003 2:00 am Posts: 1134 Location: Augusta, GA
|
Ah, I should have checked back before now. That getText line with #179 in it should have read as follows:
gettext $line $exp "Exp " #179 & "Corp"
instead of:
gettext $line $exp "Exp " #179 & "Exp"
Here is that entire script again. Please try to understand it. And let me know if there is something that you don't follow in it. I am glad that you've made yours work though. Okay, here goes.
send "/"
setTextLineTrigger getexp :getexp "Exp"
pause
:getExp
setvar $line CURRENTLINE & "@@"
gettext $line $exp "Exp " #179 & "Corp"
if $exp = ""
gettext $line $exp "Exp " "@@"
end
striptext $exp ","
striptext $exp " "
Sorry for not following up sooner, but I just copied and pasted this into a .ts file, added pause at the end, and verified that it works... even when Exp is at the end of the line.
+EP+
_________________ Claim to Fame: only guy to ever crack the TW haggle algorithm, and fig/shield/hold price formula, twice.
|
| Tue May 18, 2004 10:36 pm |
|
 |
|
PHX
Lieutenant
Joined: Sat Mar 03, 2001 3:00 am Posts: 592 Location: USA
|
grr...i tried it and it didnt work for me...I even had the thought of adding & "Corp" and it still didn't work, least for me.
|
| Wed May 19, 2004 1:48 am |
|
 |
|
PHX
Lieutenant
Joined: Sat Mar 03, 2001 3:00 am Posts: 592 Location: USA
|
Ok all TWX scripters, this is so simple its stoopid and I don't know why it took me so long to figure it out. Here is how to extract every bit of info from sending /. So if ya wanna use this in a script, just take out the var's that you don't need.
Code: send "/" :info killalltriggers settexttrigger 1 :line1 "Sect" settexttrigger 2 :line2 "Phot" settexttrigger 3 :line3 "MDis" settexttrigger 4 :line4 "Ship" settexttrigger 5 :done "(?=Help)" pause :line1 setvar $line1 CURRENTLINE goto :info :line2 setvar $line2 CURRENTLINE goto :info :line3 setvar $line3 CURRENTLINE goto :info :line4 setvar $line4 CURRENTLINE :done if ($line4 = $line3) setvar $line4 "" end setvar $info $line1 & $line2 & $line3 & $line4 replacetext $info "³" " " striptext $info "," getword $info $sect 2 getword $info $trns 4 getword $info $crds 6 getword $info $figs 8 getword $info $shlds 10 getword $info $hlds 12 getword $info $ore 14 getword $info $org 16 getword $info $equ 18 getword $info $cols 20 getword $info $phot 22 getword $info $armd 24 getword $info $lmpt 26 getword $info $torps 28 getword $info $twrp 30 getword $info $clks 32 getword $info $bcns 34 getword $info $atms 36 getword $info $crbs 38 getword $info $prbs 40 getword $info $dsrpt 42 getword $info $psprb 44 getword $info $pscn 46 getword $info $scnr 48 getword $info $algn 50 getword $info $exp 52 getword $info $corp 53 if ($corp = "Corp") getword $info $corp 54 getword $info $ship 56 else setvar $corp 0 getword $info $ship 54 end
|
| Mon Jun 14, 2004 9:45 pm |
|
 |
|
Doctor Who
Lieutenant J.G.
Joined: Wed Feb 06, 2002 3:00 am Posts: 322 Location: United Kingdom
|
I were wrong
aint often
but I were
so I removed my post
_________________ <<Doctor Who>>
|
| Tue Jun 15, 2004 11:09 am |
|
 |
|
Cherokee-TLTT
Ensign
Joined: Sat Jan 19, 2002 3:00 am Posts: 214 Location: USA
|
Uhhh, what are you smoking Doc? the / returns 3-4 lines....
anyway, here's my version of the same script... it does almost exactly the same thing as phx's but is a little cleaner on assembling the 3-4 lines into a single line.
setVar $completeline ""
send "/"
:info
setTextLineTrigger line :line #179
setTextTrigger doneCommand :done "Command [TL="
setTextTrigger doneCitadel :done "Citadel command (?=help)"
pause
:line
killalltriggers
setVar $line CURRENTLINE
replaceText $line #179 " "
stripText $line ","
setVar $completeline $completeline & $line
goto :info
:done
killalltriggers
echo "*" & $completeline & "*"
getWord $completeline $Sect 2
getWord $completeline $Turns 4
getWord $completeline $Creds 6
getWord $completeline $Figs 8
getWord $completeline $Shlds 10
getWord $completeline $Hlds 12
getWord $completeline $Ore 14
getWord $completeline $Org 16
getWord $completeline $Equ 18
getWord $completeline $Col 20
getWord $completeline $Phot 22
getWord $completeline $Armd 24
getWord $completeline $Lmpt 26
getWord $completeline $GTorp 28
getWord $completeline $TWarp 30
getWord $completeline $Clks 32
getWord $completeline $Beacns 34
getWord $completeline $AtmDt 36
getWord $completeline $Crbo 38
getWord $completeline $EPrb 40
getWord $completeline $MDis 42
getWord $completeline $PsPrb 44
getWord $completeline $PlScn 46
getWord $completeline $LRS 48
getWord $completeline $Aln 50
getWord $completeline $Exp 52
getWord $completeline $onCorp 53
if ($onCorp = "Corp")
getWord $completeline $Corp 54
getWord $completeline $Ship 56
else
setVar $Corp 0
getWord $completeline $Ship 54
end
_________________ Cherokee
The Lost Traders Tavern
http://tavern.homeip.net
Deployed Fighters Report Sector 911: Cherokee's Imperial Starship entered sector.
|
| Tue Jun 15, 2004 1:35 pm |
|
 |
|
PHX
Lieutenant
Joined: Sat Mar 03, 2001 3:00 am Posts: 592 Location: USA
|
If you use "(?=help)" for a done trigger, you would not need to set more than 1 of those, as "(?=help)" appears on more prompts, so you can use it in alot more places, not just at Command or Citadel, such as sitting on StarDock.
I see parts where each of our versions is more efficient than the others. SO I will combine them to create a PURE, UNTAINTED, ALL POWERFULL version.
|
| Tue Jun 15, 2004 8:46 pm |
|
 |
|