Determining Current Prompt
| Author |
Message |
|
ElderProphet
Commander
Joined: Tue Oct 07, 2003 2:00 am Posts: 1134 Location: Augusta, GA
|
I've tested several prompts, and each one has a #145 followed by #8. I have a modded version of my ASCII parser script for TWX that uses the new RAWPACKET sysconstant, and it shows the right combo at the end of most prompts after sending #145, but it's in the middle for the Command prompt, like so:
#13 & #27 & "[0m" & #10 & #13 & #10 & #13 & #10 & #27 & "[35mCommand" & #145 & #8 & " [" & #27 & "[1;33mTL" & #27 & "[0;33m=" & #27 & "[1m00:00:00" & #27 & "[0;35m]" & #27 & "[1;37m:" & #27 & "[0;35m[" & #27 & "[1;36m4732" & #27 & "[0;35m] (" & #27 & "[1;33m?=Help" & #27 & "[0;35m)? : "
That is what is received after sending #145 from the command prompt, and you can find the #145 and #8 just after the word Command.
+EP+
_________________ Claim to Fame: only guy to ever crack the TW haggle algorithm, and fig/shield/hold price formula, twice.
|
| Fri Jan 26, 2007 4:46 pm |
|
 |
|
Parrothead
Commander
Joined: Wed May 03, 2006 2:00 am Posts: 1722 Location: USA
|
So this should work then?
send #145
waitfor #145 & #8
_________________ Coconut Telegraph (ICQ)#586137616 Team Speak3@ 220.244.125.70:9987 Founding Member -=[Team Kraaken]=- Winner of Gridwars 2010 - Ka Pla
 Jesus wounldn't Subspace Crawl
|
| Fri Jan 26, 2007 7:03 pm |
|
 |
|
ElderProphet
Commander
Joined: Tue Oct 07, 2003 2:00 am Posts: 1134 Location: Augusta, GA
|
I think so, but haven't tried it.
_________________ Claim to Fame: only guy to ever crack the TW haggle algorithm, and fig/shield/hold price formula, twice.
|
| Fri Jan 26, 2007 9:16 pm |
|
 |
|
Singularity
Veteran Op
Joined: Thu Jun 02, 2005 2:00 am Posts: 5558 Location: USA
|
Uhm...
Code: send #145 waitFor #145 setVar $currentline CURRENTLINE stripText $currentline #145 stripText $currentline #8
Not pretty, but is there any reason it wouldn't work regardless of whether or not the backspace is there?
Not like it's gotta be all that complex or difficult. Heck most usable prompts have "(?=" in them.
_________________ May the unholy fires of corbomite ignite deep within the depths of your soul...
1. TWGS server @ twgs.navhaz.com 2. The NavHaz Junction - Tradewars 2002 Scripts, Resources and Downloads 3. Open IRC chat @ irc.freenode.net:6667 #twchan 4. Parrothead wrote: Jesus wouldn't Subspace Crawl.
*** SG memorial donations via paypal to: dpocky68@booinc.com
|
| Fri Jan 26, 2007 9:58 pm |
|
 |
|
RexxCrow
Captain
Joined: Sat Jun 18, 2005 2:00 am Posts: 2214 Location: USA
|
Thats weird I get the ' after Command when I used #42 but nothing when using the #145.
Though yea what is this really for anyways, you can quickly test the prompt with or without ANSI and you don't need those codes embedded in it, if you worried about spoofing, go with the ANSI encoding and check that. Either way you have to run a test on the prompt to figure out which one you are actually at, that #145 #8 or whatever (unless it only works with the Command prompt and no others? Even if it did work this way, what is wrong with the standardized method?), does not get you any further along in determining that for you.
_________________ Your reliance upon subjective IRM's, subjugates you through utter omission, obfuscation, and distortion of fact! Don't mess with me, I will 26 U.S.C. § 7212(a) your IRS!
|
| Fri Jan 26, 2007 10:25 pm |
|
 |
|
Parrothead
Commander
Joined: Wed May 03, 2006 2:00 am Posts: 1722 Location: USA
|
Rexx go to here -->
Select (A)tmospheric control or (S)ector control
Qcannon Control Type :
now test this with "(?=" and see what you get?
now do a standard escape macro.....q q q q r *
where are we now?
still here--> Qcannon Control Type :
how do we get out?
send #145 waiton #145 & #8 cuttext currentline $prompt 1 7
if ($prompt = Qcannon)
send "s0*"
end
_________________ Coconut Telegraph (ICQ)#586137616 Team Speak3@ 220.244.125.70:9987 Founding Member -=[Team Kraaken]=- Winner of Gridwars 2010 - Ka Pla
 Jesus wounldn't Subspace Crawl
|
| Fri Jan 26, 2007 11:03 pm |
|
 |
|
Parrothead
Commander
Joined: Wed May 03, 2006 2:00 am Posts: 1722 Location: USA
|
send #145 waiton #145 & #8 echo ansi_11 "*It Works*" cuttext currentline $prompt 1 7 echo $prompt & "*"
striptext does not appear to be needed unless you use Currentansiline
Correction:Message prompt with no message like fed subspace or corporate memo will include the #145 and back space it seems.
_________________ Coconut Telegraph (ICQ)#586137616 Team Speak3@ 220.244.125.70:9987 Founding Member -=[Team Kraaken]=- Winner of Gridwars 2010 - Ka Pla
 Jesus wounldn't Subspace Crawl
|
| Fri Jan 26, 2007 11:11 pm |
|
 |
|
Singularity
Veteran Op
Joined: Thu Jun 02, 2005 2:00 am Posts: 5558 Location: USA
|
Laff, yea but on the qcannon thing... if you've ever experienced it you know to just go "bot mac ls0*"
"(?=" also doesn't work on the stardock or class0 prompts either. Nor ports.
Still all of that could be embedded in a better escape macro...
q q q q r z l s 0 * z 0 * z 0 *
And then you don't even need to worry about it. I dunno, I still don't see why we need such a complex solution for such a simple problem.
_________________ May the unholy fires of corbomite ignite deep within the depths of your soul...
1. TWGS server @ twgs.navhaz.com 2. The NavHaz Junction - Tradewars 2002 Scripts, Resources and Downloads 3. Open IRC chat @ irc.freenode.net:6667 #twchan 4. Parrothead wrote: Jesus wouldn't Subspace Crawl.
*** SG memorial donations via paypal to: dpocky68@booinc.com
|
| Sat Jan 27, 2007 12:02 am |
|
 |
|
RexxCrow
Captain
Joined: Sat Jun 18, 2005 2:00 am Posts: 2214 Location: USA
|
If your script is stuck there then it is probably broken anyway, but can't you just use similar to:
getWord CURRENTLINE $losttrack 1 IF $losttrack="Command" send #27 ELSEIF $losttrack="Computer" send "Q" ELSEIF $losttrack="Qcannon" send "S" & $SQSS & " *" ELSEIF $losttrack="Confirmed?" send "N" ELSEIF ...etc., etc. for all possible prompts that the script may encounter ELSE send "'Special Conditions setting out the flares..." send "..." goTo :... ...etc END
_________________ Your reliance upon subjective IRM's, subjugates you through utter omission, obfuscation, and distortion of fact! Don't mess with me, I will 26 U.S.C. § 7212(a) your IRS!
|
| Sat Jan 27, 2007 12:17 am |
|
 |
|
Parrothead
Commander
Joined: Wed May 03, 2006 2:00 am Posts: 1722 Location: USA
|
well actually rexx the if/elseif/else thing is pretty messy.
I have something else in mind.
Of course for most little scripts the idea doesnt have much function and as Sing pointed out an escape macro will solve most situations.However the thread is about the #145 function and not whether you like the example or not.Perhaps for the advancement of TWX code will see some Origanal Rexx Code soon posted on this forum.
_________________ Coconut Telegraph (ICQ)#586137616 Team Speak3@ 220.244.125.70:9987 Founding Member -=[Team Kraaken]=- Winner of Gridwars 2010 - Ka Pla
 Jesus wounldn't Subspace Crawl
|
| Sat Jan 27, 2007 3:19 am |
|
 |
|
RexxCrow
Captain
Joined: Sat Jun 18, 2005 2:00 am Posts: 2214 Location: USA
|
Messy? Um, the IF structured tree is an effective and efficient means to create programs and "origanal Rexx Code"? Just because your moderator of this thread now does not mean you get to say bull**** to other users, but I could of course be wrong... of course I seem to recall you crying about having that done to you last week, but what the hell... just remember who your Chief Administrator is and don't go complaining to him when you get knocked down on you Butt, which you will eventually. Uh, what's that? You already were... oh my bad.
Now back to the subject matter at hand, DID I OR DID I NOT POST A LEGITIMATE QUESTION ABOUT WHAT THE PURPOSE OF USING THIS WAS ACTUALLY FOR, HENCE EVEN USING THE ESCAPE CODES YOU STILL NEED TO RUN THOUGH A IF TREE TO FIGURE OUT WHAT PROMPT YOU ARE ACTUALLY AT, BEING THAT USING THE ESCAPE CODES DOES NOT AUTOMATICALLY FIGURE OUT THE PROMPT FOR (UNLESS IT ONLY APPLIES TO ONE SINGLE PROMPT, WHICH I HAD ALSO PREVIOUSLY ASKED IF THAT WAS THE CASE, BUT DO NOT BELIEVE THAT IS THE CASE), YOU AS IT CAN ONLY TELL YOU THAT YOU ARE AT A PROMPT, AND BEING AS SUCH YOU ARE ALWAYS AT A PROMPT WHEN STATIONARY ANYWAY SO YOU ALREADY KNOW THAT TO BE THE CASE? ...SO WHAT'S THE POINT?
The only other options to the use of an IF tree is as Sing mentioned a general purpose macro and in a few cases the use of triggers, though those will not work in every situation and could be risky to use; and of course for security you would want to integrate ANSI verification (or just use the standardized Comm's checking.)
_________________ Your reliance upon subjective IRM's, subjugates you through utter omission, obfuscation, and distortion of fact! Don't mess with me, I will 26 U.S.C. § 7212(a) your IRS!
|
| Sat Jan 27, 2007 3:57 am |
|
 |
|
Traitor
Lieutenant Commander
Joined: Thu Mar 21, 2002 3:00 am Posts: 890 Location: USA
|
Rexx,
it's used for helpers to figure out what prompt they are at.
In twx, I use it all the time for trigger management and making sure my script knows what prompt it's at. (When you run as many as I do, its important to know where you are before you start launching certain scripts...)
I use it all over the place in my movehelper script to handle timing and as a shortcut to clean up after all the ansi manipulation I use.
Also, when your script ends, it's a clean way of redisplaying your current prompt.
Rev,
yeah, I misunderstood. I've been using it for so long that I don't even think about how it's supposed to work.
/ works in most cases, but sometimes you don't want all that clutter.
_________________ 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 Jan 27, 2007 6:44 am |
|
 |
|
RexxCrow
Captain
Joined: Sat Jun 18, 2005 2:00 am Posts: 2214 Location: USA
|
Oh ok so it is used to re-prompt after you echo a nicely formatted display, take notes P-head, that wasn't so Darn difficult, now was it?
BTW, Traitor I was tooling around with that script awhile back, it was complex, though I really like where you were going with it, really kewl script!
_________________ Your reliance upon subjective IRM's, subjugates you through utter omission, obfuscation, and distortion of fact! Don't mess with me, I will 26 U.S.C. § 7212(a) your IRS!
|
| Sat Jan 27, 2007 7:22 am |
|
 |
|
Parrothead
Commander
Joined: Wed May 03, 2006 2:00 am Posts: 1722 Location: USA
|
Dont get upset rexx.No insult was intended just a long drawn out if/else tree it not how I do it but to each his own.I was thinking more along the lines of a subruotine against an array to issue error codes per se to determine the next step.If the whole is subject comes to nothing then it was still an interesting exercise.
_________________ Coconut Telegraph (ICQ)#586137616 Team Speak3@ 220.244.125.70:9987 Founding Member -=[Team Kraaken]=- Winner of Gridwars 2010 - Ka Pla
 Jesus wounldn't Subspace Crawl
|
| Sat Jan 27, 2007 11:33 am |
|
 |
|
RexxCrow
Captain
Joined: Sat Jun 18, 2005 2:00 am Posts: 2214 Location: USA
|
Alright, I am envisioning at initial startup a preloaded array of prompt and matching burst macros which are called as needed via a WHILE <> subroutine, once/if a match is found then the coordinating array macro is sent... that is actually a very good idea, I do have to admit.
_________________ Your reliance upon subjective IRM's, subjugates you through utter omission, obfuscation, and distortion of fact! Don't mess with me, I will 26 U.S.C. § 7212(a) your IRS!
|
| Sat Jan 27, 2007 12:13 pm |
|
 |
|
Who is online |
Users browsing this forum: No registered users and 26 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
|
|