View unanswered posts | View active topics It is currently Sat Dec 27, 2025 3:22 am



Reply to topic  [ 8 posts ] 
 Need some help on a script not working right 
Author Message
Ensign

Joined: Wed Nov 06, 2002 3:00 am
Posts: 270
Unread post Need some help on a script not working right
I am working on a script, using an include, and it has really got me stumped. The include is executing correctly from the calling script. The include script is getting the variable I want, in this case "Command [TL". I did some testing, there are no leading or trailing blank spaces in the variable. It seems to be reporting the variable back to the calling script correctly, and when I did a test echo it echo's the variable correctly in the game. But the IF routine I am using to test the variable isn't recognizing it correctly.

I believe that the conditional I am using doesn't like checking against a text string, I believe this is the culprit :

Code:
IF ($check = "Command [TL")


I don't know if TWXProxy no longer likes a text string used in this way or what, and even though It's been a long time since I did much scripting and I'm a bit rusty, I could swear I have been able to use text strings for things like this in past scripts. Maybe I'm wrong? Is it something else? I'm throwing myself on the mercy of the LEET scripter's court on this one, be gentle with me :D

Here's the calling script code, as far as I've gotten with it :

Quote:
# the promptCheck code block, for using the 00PromptCheck.ts include script to check what prompt we are at
:promptCheck
goSub :00PromptCheck~PromptCheck // Uses 00PromptCheck.ts include to get the prompt from CURRENTANSILINE
setVar $check $00PromptCheck~check
echo "*" $check "*" // put this in for debugging purposes, no other use for it in this script

# now let's use this routine to check if we are at the Command prompt
IF ($check = "Command [TL")
echo "*" "You are at the Command prompt, executing" "*"
ELSE
echo "*" "You are not at the Command prompt, must run from Command prompt !!!" "*"
HALT
END
PAUSE // for testing


This is the code for the prompt check include :

Quote:
# This script will check to see what prompt you are at, and return it
# in the form of "$PromptCheck~check" variable for the calling
# script

:PromptCheck
setVar $promptLine CURRENTANSILINE
setVar $promptLine "BOL " & $promptLine & " EOL" // Puts something in for getting 1st/last word from line
getText $promptLine $check "BOL " "="

return


Here is the relevant screen cap from in the game, shows it seems to be getting the variable right :

Quote:
Command [TL=00:00:00]:[8954] (?=Help)? :

Loading and compiling script: C:\TWXProxy2_05\scripts\_working.ts

Command [TL=00:00:00]:[8954] (?=Help)? :
Command [TL

You are not at the Command prompt, must run from Command prompt !!!

Script terminated: C:\TWXProxy2_05\scripts\_working.ts


So what am I doing wrong/missing here?

Edit : used quotes on the code, so the code wouldn't look like it was spill-over, the inline comments ARE all on one line in the script file.


Mon Dec 01, 2014 11:06 pm
Profile
Commander

Joined: Sun Feb 25, 2001 3:00 am
Posts: 1838
Location: Guam USA
Unread post Re: Need some help on a script not working right
1

_________________
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


Last edited by Vid Kid on Tue Dec 02, 2014 4:48 am, edited 3 times in total.



Tue Dec 02, 2014 4:40 am
Profile WWW
Boo! inc.

Joined: Fri Jan 04, 2002 3:00 am
Posts: 221
Location: Canada
Unread post Re: Need some help on a script not working right
did you do a variable dump to see what your $check variable reads? i'm assuming that it contains some ansi characters since you are using CURRENTANSILINE and are pulling your prompt from BOL to =

if that is the case, that is why your "Command [TL" is not matching $check


Tue Dec 02, 2014 4:43 am
Profile
Ensign

Joined: Wed Nov 06, 2002 3:00 am
Posts: 270
Unread post Re: Need some help on a script not working right
Tweety wrote:
did you do a variable dump to see what your $check variable reads? i'm assuming that it contains some ansi characters since you are using CURRENTANSILINE and are pulling your prompt from BOL to =

if that is the case, that is why your "Command [TL" is not matching $check


You hit the nail on the head Tweety. I was originally going to use this for some other checking too, but since I have no way of knowing what the ANSI characters are between "BOL " and Command, I can't think of how I could do that right now. But I am very tired and I have a debugging headache too so that might be playing a role.

I changed CURRENTANSILINE to CURRENTLINE in the scripts and it worked like a charm. Now I remember why I didn't use CURRENTANSILINE much in the past :lol:


Tue Dec 02, 2014 7:15 am
Profile
Ensign

Joined: Wed Nov 06, 2002 3:00 am
Posts: 270
Unread post Re: Need some help on a script not working right
Vid Kid wrote:
1


Thanks Vid, I am assuming by your reply of 1 that I could use getWord to get the first word of a CURRENTLINE or any other line, which is true. I just remember reading somewhere, the Cabal's secret hideout or twxproxy.com support, that you could use CURRENTANSILINE in your code for spoof checking.

I believe Traitor et al were talking about it in their 'stupid ansi tricks' post but I would have to go look it up to be sure. CURRENTLINE will work for a prompt check in this case though, and getWord will involve less coding. So I may change my code to use getWord instead of getText.


Tue Dec 02, 2014 7:32 am
Profile
Boo! inc.

Joined: Fri Jan 04, 2002 3:00 am
Posts: 221
Location: Canada
Unread post Re: Need some help on a script not working right
and just a quick note.

if you use echo to display a string that has ansi characters in it, i believe it prints out with all the same colors and affects onto your screen.

if you use clientMessage. I think it sends it out on its own line, but keeps the ansi characters in the string. I may be wrong there, but i'm pretty sure clientMessage does not display the ansi colors. Its been a while since i've used the commands.


Tue Dec 02, 2014 3:20 pm
Profile
Ensign

Joined: Wed Nov 06, 2002 3:00 am
Posts: 270
Unread post Re: Need some help on a script not working right
Tweety wrote:
and just a quick note.

if you use echo to display a string that has ansi characters in it, i believe it prints out with all the same colors and affects onto your screen.

if you use clientMessage. I think it sends it out on its own line, but keeps the ansi characters in the string. I may be wrong there, but i'm pretty sure clientMessage does not display the ansi colors. Its been a while since i've used the commands.


Yes if you echo a string with ansi characters, at least in the case of this script, it was displaying it in the helper terminal (I was using SWATH) the same way the game shows it. So what advantages would there be to using clientMessage as opposed to echo? Would it help on spoof checking, or are you just saying that it would show up as regular characters in the helper terminal? I can see how that would be helpful to know it was output from a script, but I'm drawing a blank on other uses for it. Not that I don't see the usefulness of it for that purpose alone of course.


Tue Dec 02, 2014 9:56 pm
Profile
Boo! inc.

Joined: Fri Jan 04, 2002 3:00 am
Posts: 221
Location: Canada
Unread post Re: Need some help on a script not working right
for debugging purposes only. knowing what is in the string. characters and all.

but hmm, i should try it first to make sure that command does not automatically strip out all ansi characters haha...

its been a long time.


Wed Dec 03, 2014 5:05 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 8 posts ] 

Who is online

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