quote:
Originally posted by ElderProphet
A TWX script could supress alien hits, but might cause other problems. It would be a bit tricky to get just right. I'd be happy to help someone write it, but I'm not going to tackle it myself anytime soon.
PM if interested.
+EP+
Been there, sorta done that.
Anyway, I wrote a script that would weed out alien messages from your computer message report.
This is an off-line message of an alien hitting one of your offensive figs (i.e. computer, mail):
Received from Deployed Fighters at 03:00:35 PM S.D. 06/21/17:
> Report Sector 5013: M.I.B. Kay's Ominous Black Sedan entered sector.
> Your fighters in sector 5013 lost 1 attacking M.I.B. Kay
This is an off-line message of a player hitting one of your offensive figs.
Received from Deployed Fighters at 00:01:38 AM S.D. 06/22/17:
> Report Sector 2575: Traitor's Grand Vizier entered sector.
> Your fighters in sector 2575 lost 1 attacking Traitor
I used CURRENTANSILINE to check if the color in the 2nd line, after the :, was Cyan (#27[1;36m) for a player, or Yellow (#27[1;33m) for an Alien. If it was yellow, I would put that in a different list from the player hits. You could do the same thing for messages recieved while on-line.
online message from an alien hitting your figs:
Deployed Fighters Report Sector 5196: M.I.B. Kay's Ominous Black Sedan entered sector.
online message from a player hittig your figs:
Deployed Fighters Report Sector 4440: Enemy's Malefactor entered sector.
So, having nothing better to do during lunch today...
# Fig Hit Watcher
# for TWX v2.03 Final
:waitForIncoming
settextlinetrigger incoming :incoming "Deployed Fighters"
pause
:incoming
# The following two lines convert the CurrentLine and CurrentAnsiLine
# into variables.
setvar $line CURRENTLINE
setvar $ansiLine CURRENTANSILINE
# the following 4 lines are anti-spoof.
getword $line $spoofCheck 1
if ($spoofcheck <> "Deployed")
goto :waitForIncoming
end
# The following lines grab the sector number, and
# remove the colon from the end.
getword $line $sector 5
striptext $sector ":"
# The following line will get you either
# " #27[1;36mEnemy Name" if it's a player,
# or " #27[1;36m#27[33mAlien Race Name [36mAlien Name"
gettext $ansiLine $isTrader ":" "'s"
# The following grabs the 9th character (remember, the 1st char is a space)
# It will be a letter if it's a player, or a #27 if it's an alien
# (and I'm using #27 in the above comments to represent the escape key.
# In reality, it's a single character. So if the math below looks off, it's really not.)
cuttext $isTrader $traderCheck 9 1
# The following removes the escape Char
# leaving either " [1;36mEnemy Name" if it's a player,
# or " [1;36[33mAlien Race Name [36mAlien Name"
# I do this AFTER I've gotten $traderCheck, but BEFORE
# I set the $traderName or $alienRace and $alienName,
# because I don't want to deal with the escape code(s) anymore.
striptext $isTrader #27
# So, here is where I do the actual check to see if it was
# a player or an Alien that hit your figgie.
# so, if $traderCheck is an escape code (#27)
# it has to be an alien, since you can't name yourself an escape code.
if ($traderCheck <> #27)
cuttext $isTrader $traderName 8 99
echo ANSI_10 "*It's a Player! Player Name = " $traderName "***"
write GAMENAME & "-fighitlog.txt" DATE & " " & TIME & " " & $traderName & " " & $sector
else
gettext $isTrader $alienRace "[33m" "[36m"
gettext $isTrader $alienName "[36m" ""
echo ANSI_12 "*It's an Alien! Alien Race = " $alienRace " Alien Name = " $alienName "***"
write GAMENAME & "-fighitlog.txt" DATE & " " & TIME & " " & $alienRace & " " & $alienName & " " & $sector
end
# now that I know what hit my fig, I want to ignore the next line,
# since it may or may not contain the phrase Deployed fighters too
# depending on what type of fig was hit.
settextlinetrigger ignoreAttack :ignoreNextLine "is attacking!"
settextlinetrigger ignorelostfig :ignoreNextLine "Your fighters"
settextlinetrigger retreated :retreated "retreated."
pause
:ignoreNextLine
# this is so it doesn't try to parse the next line.
# generally, if they touch your fig, it's dead anyway.
# And you already got the info you really needed.
# cause nobody puts out tolled figs, right?
killtrigger ignoreAttack
killtrigger ignorelostfig
killtrigger retreated
# here is where you would change your fig array to note that you
# no longer have a fig in that sector.
# i.e.
setvar $figArray[$sector] 0
# or however you are storing your figs in an array.
goto :waitForIncoming
:retreated
killtrigger ignoreAttack
killtrigger ignorelostfig
killtrigger retreated
# looks like you didn't loose a fig. so no need to clear
# the array entry here.
goto :waitForIncoming
<sigh> Pity about the formatting. Wish Grimy was back up...
This script just happens to grab the player's full name too.
That can be handy for certain scripts I suppose... [:D]
It also makes a nice log file with timestamps and everything.
Of course, depending on the length of the name of the ship class, or the player or alien name, or the alien race, the text will cover either 1 or 2 lines. So it's a royal pain to check for how many lines up or down you need to move the cursor. And offensive fig hits give you 2 lines of feedback, defensive and tolled figs give 3 lines. And if the alien bounces off your fig (hits it, but doesn't kill it) then you only get 1 line...unless it's name is long and it spills over into 2 lines... And, of course, TWX will still see these long lines as just 1 line, and not 2, but your TERMINAL probably won't. Anyway, it's a royal pain. heh.
I've tried playing around with manualy toggleing the TWX_TOGGLEDEAF menu, but the problem is whenever I call that with openmenu, I can't get the stupid menu to close again from within the script. Once the menu is open, it won't process anything else until you hit a key, like q. I've tried using getmenuvalue on TWX_TOGGLEDEAF, and no matter what it's set at, it returns 0. I've tried using setmenuvalue to set it to 1 and 0 and that hasn't worked either. I would love to be able to suppress incoming text on the fly, but...
http://www.twxproxy.com/support.php?show=623
I've gone over this with Xide in the past already. And as far as I know, it wasn't addressed in 2.03 Final.
-edited for clarity...