|
Register •
FAQ
• Search • Login
|
|
Page 1 of 1
|
[ 4 posts ] |
|
Help with REXX script, parsing text colors?
Author |
Message |
ctsurv553
Staff Sergeant
Joined: Sun Jun 14, 2015 9:24 pm Posts: 12
|
Help with REXX script, parsing text colors?
I am trying to write a ZOC-REXX combat script to capture or kill Ferrengi and Evil Alien Trader ships, and could use some help with one question: Is there a command within ZOC-Rexx to determine the color attribute of text being written to the window by the game server? My problem is this: I want the script to be fully automatic, but it needs to be able to distinguish between Good and Evil AI ships, and only attack Evils, and since about 25% of the Alien Traders are Good, there's almost always some of these mixed in with Evil Aliens in sectors like Rylos or Stardock, where they tend to congregate. I only want to attack Evil Aliens, and since the Alien server assigns names and ship types at random to both Good and Evil aliens, I can't use just the name itself to determine alignment. The Attack command produces this response: "Attack Shugi Maoshez's Scout Marauder (400,000-250) (Y/N) [N]?" The only way to tell if this is a Good or Evil Alien Trader, at least at this particular prompt, is by the color in which the name is written to the screen; Evil aliens are colored Red, Good aliens are colored Cyan. Is there any way in Rexx to parse this color attribute? I've not been able to find one, but then I'm not an expert in Rexx. Thanks!
|
Tue Aug 30, 2016 4:08 pm |
|
|
Micro
Ambassador
Joined: Wed Apr 20, 2011 1:19 pm Posts: 2559 Location: Oklahoma City, OK 73170 US
|
Re: Help with REXX script, parsing text colors?
I don't know anything about ZOC-REXX, but you are looking for an ANSI escape sequence (i.e. ^[[1;33;m). You will need to make sure the program isn't stripping out the color codes.
As an alternative, you could look at the alien's rank before initiating the attack.
_________________ Regards, Micro Website: http://www.microblaster.net TWGS2.20b/TW3.34: telnet://twgs.microblaster.net:2002
ICQ is Dead Jim! Join us on Discord: https://discord.gg/zvEbArscMN
|
Tue Aug 30, 2016 11:12 pm |
|
|
ElderProphet
Commander
Joined: Tue Oct 07, 2003 2:00 am Posts: 1131 Location: Augusta, GA
|
Re: Help with REXX script, parsing text colors?
Just to add to what Micro said, the telnet colors are changed by a sequence of characters that begin with the ESC key code, hence the term escape codes. The Escape key (decimal 27) is usually represented as 2 characters, ^[. Then the escape sequence begins with an open bracket, and ends with the letter m. Scroll to the bottom of this link for a simple table of codes: http://www.termsys.demon.co.uk/vtansi.htmI wrote a script in TWX to help display the codes coming across a telnet session, to aid in determining the right codes to watch for. I can point you towards that script if it would help. +EP+
_________________ Claim to Fame: only guy to ever crack the TW haggle algorithm, and fig/shield/hold price formula, twice.
|
Mon Sep 05, 2016 8:19 pm |
|
|
Kavanagh
Ambassador
Joined: Wed Feb 28, 2001 3:00 am Posts: 1410 Location: Boo! inc. Ireland
|
Re: Help with REXX script, parsing text colors?
ZOC can only capture the text that you see on the display, no ANSI data. As Micro wrote, simpler to parse the other information to determine red/blue alien. Use command line :
call zocwait _trigger_ wye= ZocGetInfo("CURSOR-Y") - where Y is the line at the trigger, then wye=wye-1 askline=ZocGetScreen(0,wye,80)
- goes back -1 (or whatever) to grab the the line with the alien info.
|
Fri Sep 09, 2016 1:49 pm |
|
|
|
|
Page 1 of 1
|
[ 4 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 22 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
|
|