TWX Proxy not processing line correctly
I am using Windows 7, running TWGS 2.02b game server, and running the TWX Proxy 2.05.73 version of TWX that I downloaded from Archy's Portal. I started working on a script last night, a simple script for no alignment port upgrades. My first problem was with my first check to make sure you're at the command prompt in the game.
I used CURRENTANSILINE, and it appears there must be some hidden ansi characters in there from the game server, cause according to TWX the word Command is NOT the first word in the ANSI line. So, I changed it to CURRENTLINE, it processed the line and worked fine.
My next problem I ran into, which is still driving me crazy is that TWX is not processing the
Quote:
How many units do you want to invest? (3426 max, 0 to quit)
line correctly.
I have tried waitON's, setTextTriggers, etc. It will not process that line right. In the first script, it was getting the line as CURRENTLINE and it was getting the number of units available to upgrade the way it was supposed t. But it would NOT execute correctly. It always somehow sent some character that didn't upgrade the fuel ore on the port but got you kicked off the upgrade prompt - then pretty as you please as soon as it would hit the Command prompt in the game, it would throw the variable it was supposed to throw for the no exp ore upgrade and then try to move you to that sector.
I tried everything, as I said I tried waitON's, I tried setTextTriggers, I made sure there were pauses after every block of code you could put a pause without breaking the script, I put so many killAllTriggers in that sucker I think at one time I had that command on every other line. I turned that script into the worst spaghetti code you ever saw, and I think that's quite an accomplishment for a TWX script if I do say so myself.
I switched around to every version of TWX Proxy 2.05 I have on hand, an exe of it from 2011 another from 2012, another from 2013 I think, and of course 2.05.73 - didn't work any better with any of them.
So then I got disgusted, deleted the script and started over from scratch. Now with this new attempt I am partway into, it isn't processing the
Quote:
How many units do you want to invest? (3426 max, 0 to quit)
line correctly at all, not even close. I am using a CURRENTLINE instead of a CURRENTANSILINE as you can see in the code below. As you can also see in the code below, I am checking to make sure that the script is processing the correct line. As you can see, I am using CURRENTLINE not CURRENTANSILINE, and the checkword, units, should be the 3rd word on a CURRENTLINE.
Code:
:oreMath
killAllTriggers
setvar $oreMathChkLine CURRENTLINE
getWordPos $oreMathChkLine $oreMathChk "units"
if ($oreMathChk <> 3)
echo "*" "Script Error!!!"
PAUSE
END
Now a copy of the dumped triggers and variables:
Quote:
Command [TL=00:00:00]:[7108] (?=Help)? :
Author's Suggestion : Go to Port upgrade, get Max upgrade levels
don't do any upgrades, quit Port upgrade screen
Make sure you have enough cash on hand, run from command prompt
<Re-Display>
Sector : 7108 in uncharted space.
Ports : Addison Primus, Class 8 (BBB)
Fighters: 1 (belong to your Corp) [Defensive]
Warps to Sector(s) : 5539 - 6660 - 19633
Command [TL=00:00:00]:[7108] (?=Help)? :
Enter how many units of each product you want to upgrade.
Enter 0 (Zero) if you do not want to upgrade that category.
Enter (Y)es if you have enough money, (Q)uit if not.
How many fuel ore units to upgrade?
Command [TL=00:00:00]:[7108] (?=Help)? :
How many organics units to upgrade?
Command [TL=00:00:00]:[7108] (?=Help)? :
How many equipment units to upgrade?
Command [TL=00:00:00]:[7108] (?=Help)? :
Do you have enough credits? Y (yes) or N (no) ?
Command [TL=00:00:00]:[7108] (?=Help)? : O
<Construct Starbase>
(Upgrade StarPort)
ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
º Upgrade Starport Production º
ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹
º 1 Fuel Ore, costs $250/unit º
º 2 Organics, costs $500/unit º
º 3 Equipment, costs $900/unit º
ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹
º Choose 1, 2, 3 or Q to quit º
ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
Choice ? 1
That will cost 250 per unit to upgrade the Fuel Ore
How many units do you want to invest? (3426 max, 0 to quit)
Script Error!!!
Script>
Trigger dump for script: C:\My Programs\TWXProxy 2_05\scripts\myInclude\test06.t
s
Text Triggers:
Text-Line Triggers:
Text-Out Triggers:
Delay Triggers:
Event Triggers:
Script>
Enter a full or partial variable name to search for (or blank to list them all)
Dumping all script variables
>
Variable dump for script: C:\My Programs\TWXProxy 2_05\scripts\myInclude\test06.
ts
"$A" = "0"
"$CMD" = "1"
"$CMDLINE" = "Command [TL=00:00:00]:[7108] (?=Help)? : "
"$CONDITION" = "7"
"$COUNT" = "0"
"$CREDCHK" = "y"
"$CYCLES" = "0"
"$EQUAMT" = "50"
"$EQUUP" = "0"
"$EQUUPMAX" = "3"
"$OREAMT" = "50"
"$OREMATHCHK" = "10"
"$OREMATHCHKLINE" = "How many units do you want to invest? (3426 max, 0 to quit)
"
"$OREMAX" = "0"
"$OREUP" = "9"
"$OREUPCHKLINE" = "Choice ? "
"$OREUPCHKPOS" = "1"
"$OREUPMAX" = "9"
"$ORGAMT" = "50"
"$ORGUP" = "0"
"$ORGUPMAX" = "4"
"$POS" = "7"
"$W" = "0"
"$X" = "0"
"$Y" = "0"
"$Z" = "0"
Variable Dump Complete.
>
Stopping all non-system scripts
How many units do you want to invest? (3426 max, 0 to quit)
Script terminated: C:\My Programs\TWXProxy 2_05\scripts\myInclude\test06.ts
As you can see from the screen cap of what is happening and the trigger & variable dumps, it is working on the right line for CURRENTLINE. But as you can see from the code snippet I posted, it is looking for units as the 3rd word in the line (line is $OREMATHCHKLINE). It is showing that it IS the 3rd word in that line when you look at the screen cap. But, if you look at the check variable ($OREMATHCHK) for getWordPos, TWX is saying it is the 10th word - "$OREMATHCHK" = "10"
So, what is happening here? Do I have the right version of TWX Proxy 2.05.73? Is my copy of 2.05.73 corrupted? I am totally stumped and would appreciate any help you can give me.
Thanks, Thor
EDIT :
I probably should have posted all the code of the script, so people can try it out and see if it works in their game. So, I will post it below. Keep in mind, this is not a whole working script, I stopped adding to it as soon as I started having this error.
Code:
# No Experience Port Upgrade Script
# Version 0.1
# Author : Thor
# This Script will upgrade a port with
# no experience gain
echo "*" "Author's Suggestion : Go to Port upgrade, get Max upgrade levels"
echo "*" "don't do any upgrades, quit Port upgrade screen"
echo "*" "Make sure you have enough cash on hand, run from command prompt"
:preparation
setVar $a 0
setVar $w 0
setVar $x 0
setVar $y 0
setVar $z 0
setVar $count 0
setVar $cycles 0
setVar $oreUpMax 9
setVar $orgUpMax 4
setVar $equUpMax 3
setVar $pos 1
setVar $condition 1
setTextTrigger cmdCheck :cmdCheck "Command [TL=00:00:00]"
send "*"
PAUSE
:cmdCheck
killAllTriggers
setVar $cmdLine CURRENTLINE
getWordPos $cmdLine $cmd "Command"
IF ($cmd <> 1)
echo "*" "Not at command prompt, spoofed, other malfunction"
setVar $pos 2
setVar $condition 2
HALT
Else
goto :input
END
PAUSE
:input
killAllTriggers
setVar $pos 3
setVar $condition 3
echo "*" "Enter how many units of each product you want to upgrade."
echo "*" "Enter 0 (Zero) if you do not want to upgrade that category."
echo "*" "Enter (Y)es if you have enough money, (Q)uit if not."
getInput $oreAmt "How many fuel ore units to upgrade?"
getInput $orgAmt "How many organics units to upgrade?"
getInput $equAmt "How many equipment units to upgrade?"
getInput $credChk "Do you have enough credits? Y (yes) or N (no) ?"
IF ($credChk = "N") OR ($credChk = "n")
echo "*" "Not enough credits, stopping script."
HALT
Else
setVar $pos 4
setVar $condition 4
goto :action1
END
PAUSE
:action1
setVar $pos 5
setVar $condition 5
killAllTriggers
IF ($oreAmt > 0)
setVar $oreUp $oreUpMax
goto :ore
END
IF ($oreAmt = 0) AND ($orgAmt > 0)
setVar $orgUp $orgUpMax
goto :org
END
IF ($oreAmt = 0) AND ($orgAmt = 0) AND ($equAmt > 0)
setVar $equUp $equUpMax
goto :equ
END
IF ($oreAmt = 0) AND ($orgAmt = 0) AND ($equAmt = 0)
echo "*" "Upgrades finished or script error. Stopping Script."
HALT
END
PAUSE
:ore
setVar $pos 6
setVar $condition 6
setTextLineTrigger oreUpgrade1 :oreUpgrade1 "Upgrade Starport Production"
send "O"
PAUSE
:oreUpgrade1
killAllTriggers
waitON "Choice ?"
setVar $oreUpChkLine CURRENTLINE
getWordPos $oreUpChkLine $oreUpChkPos "Choice"
IF ($oreUpChkPos = 1)
setVar $pos 7
setVar $condition 7
goto :oreUpgrade2
Else
echo "*" "script Error"
setVar $pos 8
setVar $condition 8
PAUSE
END
:oreUpgrade2
setTextTrigger oreMath :oreMath "How many units do you want to invest?"
send "1"
PAUSE
:oreMath
killAllTriggers
setvar $oreMathChkLine CURRENTLINE
getWordPos $oreMathChkLine $oreMathChk "units"
if ($oreMathChk <> 3)
echo "*" "Script Error!!!"
PAUSE
END
PAUSE
getText CURRENTLINE $oreMax "want to invest? (" "max, 0 to quit)"
stripText $oreMax " "
PAUSE
So that's all the script code up to this problem. Thanks