View unanswered posts | View active topics It is currently Wed Sep 23, 2020 4:02 am



Reply to topic  [ 26 posts ]  Go to page 1, 2  Next
 TWX Proxy - New Commands addQuickText and clearQuickText 
Author Message
Ambassador
User avatar

Joined: Wed Apr 20, 2011 1:19 pm
Posts: 2433
Location: Oklahoma City, OK 73170 US
Unread post TWX Proxy - New Commands addQuickText and clearQuickText
Remember my recent rant about TWX Colors:
Subject: Stupid question of the day?

It included this chart showing TWX codes out of order:

Code:
| Color |  ANSI |  TWX   | TW2002 |
|Black  | ^[30m | ANSI_0 |   ~a   |
|Red    | ^[31m | ANSI_4 |   ~b   |
|Green  | ^[32m | ANSI_2 |   ~c   |
|Yellow | ^[33m | ANSI_6 |   ~d   |
|Blue   | ^[34m | ANSI_1 |   ~e   |
|Magenta| ^[35m | ANSI_5 |   ~f   |
|Cyan   | ^[36m | ANSI_3 |   ~g   |
|White  | ^[37m | ANSI_7 |   ~h   |


This is a partial list, there are actually over 40 codes. The column on the far right is the internal color codes used by TW2002. You can see them in MENUFILE.TXT, which holds the help menu screens, and they are used internally as a shorthand for ANSI color codes in prompts and other screens.

In another post you may have noticed TWX color codes are RED:

Image

They are RED because they should be considered depreciated (Along with setVar). TWX 2.06.05+ will support TW2002 color codes, which are in ANSI order "krgybmcw" and capital letters are the bright versions of the same color. For bright white ANSI_15 is replaced with ~H and you can include the code in the string.

So the above snippet becomes:

Image

Not that much of a difference, but each color code is 10 characters the old way and only 2 characters the new way, so you probably didn't even notice I made the dashes yellow and the string is still shorted than the original. You can also use actual ANSI codes (i.e. "^[3A' - cursor up 3 lines), which are actually still shorter than TWX color codes. This is so much easier to use I may actually consider writing a TWX script.

But wait, there is more!!!

The new commands addQuickText and clearQuickText let you create your own color codes!

Image

User color codes are applied first, so they override built-in color codes, so you can even change existing colors.

See the TWX WIKI for more information:
https://github.com/MicroBlaster/TWXProx ... dQuickText

_________________
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/frrjg6r


Fri Jan 03, 2020 11:12 pm
Profile ICQ YIM WWW
Chief Warrant Officer
User avatar

Joined: Sat Feb 27, 2016 1:01 am
Posts: 168
Location: Molon Labe
Unread post Re: TWX Proxy - New Commands addQuickText and clearQuickTex
Heya, Micro, great job on all your hard work and advancements!

I have a few ideas to throw into the mix...


Multi-threading sounds so that scripts will no longer become frozen during playback, allowing for more immersed gaming experiences (possible means):

https://wiki.lazarus.freepascal.org/Parallel_procedures

https://www.sigmdel.ca/michel/program/f ... ad_en.html

https://forum.lazarus.freepascal.org/in ... ic=31819.0


Adding MP3 files as an option too, would also allow for jukebox scripts and background playlists:

https://forum.lazarus.freepascal.org/in ... ic=33205.0

Quote:
Take a look at the following fresh new bindings:

mpg123: https://github.com/DJMaster/mpg123-fpc
PortAudio: https://github.com/DJMaster/portaudio-fpc

Strongly tested under Windows. Linux and other OSs will be available soon.



Add a compound 'for' command:

for ($i=0;$i<=SECTORS;$i++)

looping...

end

Add 'for' and 'while' breaks:

break

And of course those famous tenary opers (perhaps even compounded):

$c = ($a < $b) ? a : b

$continue = ($a < $b) ? (($x <= $y) ? true : false) : false

Modify 'systemScript' to provide an attribute that also ignores all 'stop' commands, but that the script's internal 'halt' commands will still process.

That is also if the attribute is not included in the command, then it defaults to FALSE.

systemScript {NOSTOP}

As applicable, modify all stored SECTOR.x.x[x] data to update when refreshed in game, such as when running bot 'figs' command, and the like--and not only when a sector is physically visited.

Unless you fixed it already, IIRC, padLeft and PadRight didn't work.

Also, wildcards don't seem to process correctly in compiled scripts.

_________________
The object of life is not to be on the side of the majority, but to escape finding one’s self in the ranks of the insane.” — Marcus Aurelius


Sun Mar 29, 2020 6:05 am
Profile ICQ
Ambassador
User avatar

Joined: Wed Apr 20, 2011 1:19 pm
Posts: 2433
Location: Oklahoma City, OK 73170 US
Unread post Re: TWX Proxy - New Commands addQuickText and clearQuickTex
Great ideas, but pretty far beyond the scope of my abilities in Pascal. We want to wrap up the current version, maybe make a few changes to the setup dialog, and then move one.

The goal here is to get this into c# and then changes you are proposing will be a lot easier. i created an organization on GitHub to keep the code.

Join us on gitHub:
https://github.com/tw2002

Anyone who wants to join in, just send me your Gethub Username.

_________________
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/frrjg6r


Sun Mar 29, 2020 3:53 pm
Profile ICQ YIM WWW
Chief Warrant Officer
User avatar

Joined: Sat Feb 27, 2016 1:01 am
Posts: 168
Location: Molon Labe
Unread post Re: TWX Proxy - New Commands addQuickText and clearQuickTex
...ohhh thought of a few booleans that might be helpful to have:

SECTOR.BLACKHOLE[sector] (zero warps out)

SECTOR.ONEWARPIN[sector] (one warp both in and one or more warps out)

SECTOR.DEADEND[sector] (one way both in and out--the same sector both ways.)

_________________
The object of life is not to be on the side of the majority, but to escape finding one’s self in the ranks of the insane.” — Marcus Aurelius


Last edited by Adept on Fri Apr 03, 2020 12:06 am, edited 1 time in total.



Thu Apr 02, 2020 1:46 am
Profile ICQ
Chief Warrant Officer
User avatar

Joined: Sat Feb 27, 2016 1:01 am
Posts: 168
Location: Molon Labe
Unread post Re: TWX Proxy - New Commands addQuickText and clearQuickTex
Also, I'm updating the syntax highlighter for Notepad++, did I miss any new commands or have anything incorrect?

Code:
addMenu
addQuickText
branch
clearAllAvoids
clearAvoid
clearGlobals
clearQuickText
clientMessage
closeMenu
copyDatabase
copyText
createDatabase
cutLengths
cutText
deleteDatabase
dirExists
echo
editDatabase
fileExists
format
formatString
getAllCourses
getCharCode
getConsoleInput
getCourse
getDate
getDeafClients
getDirList
getDistance
getFileList
getInput   
getLength
getMenuValue
getNearestWarps
getOutText
getQuickStats
getRnd
getScriptVersion
getSector
getSectorParameter
getText
getTime
getTimer
getWord
getWordCount
getWordPos
goSub
goto
isNumber
listActiveScripts
listAvoids
listDatabases
listSectorParameters
load
loadDatabases
loadGlobal
loadVar
logging
lowerCase
makeDir
mergeText
openMenu
padLeft
padRight
processIn
processOut
read
readToArray
removeDir
rename
replaceText
reqRecording
reqVersion
round
saveGlobal
saveVar
selectDatabase
send
setArray
setAutoTrigger
setAvoid
setDeafClients
setDelayTrigger
setEventTrigger
setMenuHelp
setMenuKey
setMenuOptions
setMenuValue
setPrecision
setProgVar
setSectorParameter
setTextLineTrigger
setTextOutTrigger
setTextTrigger
SetVar
setWindowContents
sleep
sortArray
sound
splitText
stripANSI
stripText
switchBot
systemScript
trim
truncate
upperCase
window
write


Code:
if
else
end
elseif
while


Code:
AND
ACTIVEBOT
ALPHACENTAURI
CONNECTED
CURRENTANSILINE
CURRENTLINE
CURRENTSECTOR
CURRENTTURNS
CURRENTCREDITS
CURRENTFIGHTERS
CURRENTSHIELDS
CURRENTTOTALHOLDS
CURRENTOREHOLDS
CURRENTORGHOLDS
CURRENTEQUHOLDS
CURRENTCOLHOLDS
CURRENTEMPTYHOLDS
CURRENTPHOTONS
CURRENTARMIDS
CURRENTLIMPETS
CURRENTGENTORPS
CURRENTTWARPTYPE
CURRENTCLOAKS
CURRENTBEACONS
CURRENTATOMICS
CURRENTCORBOMITE
CURRENTEPROBES
CURRENTMINEDISR
CURRENTPSYCHICPROBE
CURRENTPLANETSCANNER
CURRENTSCANTYPE
CURRENTALIGNMENT
CURRENTEXPERIENCE
CURRENTCORP
CURRENTSHIPNUMBER
CURRENTSHIPCLASS
CURRENTQUICKSTATS
CURRENTANSIQUICKSTATS
DATE
FALSE
GAME
GAMENAME
INCLUDE
LICENSENAME
LOGINNAME
LOGIN.VALIDATED
NO
OR
PASSWORD
PLAYER.LOGINNAME
PLAYER.PASSWORD
PLAYER.ALIAS
PLAYER.CORPNAME
PLAYER.CORPPASS
PLANETNAME
PLAYER.SUBSPACE
PORTBUILDTIME
PORT.BUYEQUIP
PORT.BUYFUEL
PORT.BUYORG
PORT.CLASS
PORT.EQUIP
PORT.EXISTS
PORT.FUEL
PORT.NAME
PORT.ORG
PORT.PERCENTEQUIP
PORT.PERCENTFUEL
PORT.PERCENTORG
PORT.UPDATED
RAWPACKET
RYLOS
SECTOR.ANOMOLY
SECTOR.BACKDOORCOUNT
SECTOR.BACKDOORS
SECTOR.BEACON
SECTOR.CONSTELLATION
SECTOR.DENSITY
SECTOR.EXPLORED
SECTOR.FIGS.OWNER
SECTOR.FIGS.TYPE
SECTOR.FIGS.QUANTITY
SECTOR.LIMPETS.OWNER
SECTOR.LIMPETS.QUANTITY
SECTOR.MINES.OWNER
SECTOR.MINES.QUANTITY
SECTOR.NAVHAZ
SECTOR.PLANETCOUNT
SECTOR.PLANETS
SECTOR.SHIPCOUNT
SECTOR.SHIPS
SECTOR.TRADERCOUNT
SECTOR.TRADERS
SECTOR.UPDATED
SECTOR.WARPCOUNT
SECTOR.WARPINCOUNT
SECTOR.WARPS
SECTOR.WARPSIN
SECTORS
SERVERTYPE
SHIPNAME
SINGLEKEY
STARDOCK
TIME
TRUE
TWX_ACCEPTEXTERNAL
TWX_BUBBLESIZE
TWX_BURST
TWX_CACHE
TWX_CONNECT
TWX_DATA
TWX_DATABASE
TWX_DATABASE_CREATE
TWX_DATABASE_DELETE
TWX_DATABASE_EDIT
TWX_DATABASE_SELECT
TWX_DATABASE_VIEW
TWX_DUMPSCRIPTVARS
TWX_EDITBURST
TWX_EXIT
TWX_HOLOSCAN
TWX_KILL
TWX_LISTACTIVE
TWX_LISTDIRECTORY
TWX_LISTENPORT
TWX_LISTPORTS
TWX_LISTUPGRADEDPORTS
TWX_LOADLASTSCRIPT
TWX_LOADSCRIPT
TWX_LOCALECHO
TWX_LOG
TWX_LOGANSI
TWX_MAIN
TWX_PLOTCOURSE
TWX_PORT
TWX_RECONNECT
TWX_REPEATBURST
TWX_SCRIPT
TWX_SCRIPTKEY
TWX_SCRIPTTEXT
TWX_SETUP
TWX_SHOWANOM
TWX_SHOWBACKDOORS
TWX_SHOWBUBBLE
TWX_SHOWBUBBLES
TWX_SHOWCLIENTS
TWX_SHOWDENSITY
TWX_SHOWFIGS
TWX_SHOWMINES
TWX_SHOWPORT
TWX_SHOWSECTOR
TWX_SHOWSPECIALPORT
TWX_SHOWTRADERS
TWX_STOPALL
TWX_STOPALLFAST
TWX_TOGGLEDEAF
TWX_TOTALSCANNED
YES


Code:
connect
delete
disconnect
halt
killTrigger
killAllTriggers
killWindow
pause
return
stop
waitFor
waitOn


Code:
ANSI_0
ANSI_1
ANSI_10
ANSI_11
ANSI_12
ANSI_13
ANSI_14
ANSI_15
ANSI_2
ANSI_3
ANSI_4
ANSI_5
ANSI_6
ANSI_7
ANSI_8
ANSI_9
~a
~b
~c
~d
~e
~f
~g
~h
~A
~B
~C
~D
~E
~F
~G
~H
~i
~j
~k
~l
~m
~n
~o
~p
^[30m
^[31m
^[32m
^[33m
^[34m
^[35m
^[36m
^[37m
^[1;30m
^[1;31m
^[1;32m
^[1;33m
^[1;34m
^[1;35m
^[1;36m
^[1;37m
^[40m
^[41m
^[42m
^[43m
^[44m
^[45m
^[46m
^[47m
^[2J^[H
\r^[0m^[1K
^[0m
^[0m^[1;36m
^[0m^[1;33m
^[0m^[35m
^[0m^[44m
^[0m^[32m
^[0m^[1;5;31m
^[0m^[1;37m
^[0m^[1;5;31m
^[0m^[30;47m
^[0m^[5;34m
^[0m^[34m
^[0m^[30;41m
^[0;34;47m
^[31;47m
^[1;33;44m
~!
~@
~0
~1
~2
~3
~4
~5
~6
~7
~8
~9
~q
~r
~s
~I
~J
~K


Code:
* / - + -- ++ ^ % & ( ) < > = == [ ] != *= /= += -= := ! ; add divide greater greater= isEqual isGreater isGreaterEqual isLesser isLesserEqual isNotEqual less less= modulus multiply not round subtract xor


Code:
$ : #

_________________
The object of life is not to be on the side of the majority, but to escape finding one’s self in the ranks of the insane.” — Marcus Aurelius


Thu Apr 02, 2020 1:52 am
Profile ICQ
Chief Warrant Officer
User avatar

Joined: Sat Feb 27, 2016 1:01 am
Posts: 168
Location: Molon Labe
Unread post Re: TWX Proxy - New Commands addQuickText and clearQuickTex
...

_________________
The object of life is not to be on the side of the majority, but to escape finding one’s self in the ranks of the insane.” — Marcus Aurelius


Thu Apr 02, 2020 3:01 pm
Profile ICQ
Ambassador
User avatar

Joined: Wed Apr 20, 2011 1:19 pm
Posts: 2433
Location: Oklahoma City, OK 73170 US
Unread post Re: TWX Proxy - New Commands addQuickText and clearQuickTex
Adept wrote:
...ohhh thought of a few booleans that might be helpful to have:

SECTOR.BLACKHOLE[sector] (zero warps out)

SECTOR.ONEWARPIN[sector] (one warp both in and one or more warps out)

SECTOR.DEADEND[sector] (one way both in and out--the same sector both ways.)

Those should be easy.. will add in a future version..

_________________
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/frrjg6r


Fri Apr 03, 2020 3:05 am
Profile ICQ YIM WWW
Ambassador
User avatar

Joined: Wed Apr 20, 2011 1:19 pm
Posts: 2433
Location: Oklahoma City, OK 73170 US
Unread post Re: TWX Proxy - New Commands addQuickText and clearQuickTex
Adept wrote:
Also, I'm updating the syntax highlighter for Notepad++, did I miss any new commands or have anything incorrect?
Just spot checking, but it looks like you even got the new database commands I haven't written yet.

also coming soon:
GetBotList $array

~a will be converted to ^[30m, so you typically woldn't use ^[30m (or the other color literals) that are predefined. ^[30m is valid though as well as any ansi code in that format, not just the predefined ones.

_________________
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/frrjg6r


Fri Apr 03, 2020 3:09 am
Profile ICQ YIM WWW
Chief Warrant Officer
User avatar

Joined: Sat Feb 27, 2016 1:01 am
Posts: 168
Location: Molon Labe
Unread post Re: TWX Proxy - New Commands addQuickText and clearQuickTex
Okay, cool.

I had figured just putting in all the color formats, just so they are there if anyone prefers to use one over the other or whatever.

_________________
The object of life is not to be on the side of the majority, but to escape finding one’s self in the ranks of the insane.” — Marcus Aurelius


Fri Apr 03, 2020 11:06 am
Profile ICQ
Ambassador
User avatar

Joined: Wed Apr 20, 2011 1:19 pm
Posts: 2433
Location: Oklahoma City, OK 73170 US
Unread post Re: TWX Proxy - New Commands addQuickText and clearQuickTex
Adept wrote:
Okay, cool.

I had figured just putting in all the color formats, just so they are there if anyone prefers to use one over the other or whatever.

Just pointing out that ^[*m where * can be any color code is valid, as well as cursor movement, clear screen, and any other ANSI codes. My extension to VSCODE does not highlight them at this time though. I might try to add it later.

_________________
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/frrjg6r


Fri Apr 03, 2020 8:25 pm
Profile ICQ YIM WWW
Chief Warrant Officer
User avatar

Joined: Sat Feb 27, 2016 1:01 am
Posts: 168
Location: Molon Labe
Unread post Re: TWX Proxy - New Commands addQuickText and clearQuickTex
I was testing the new ANSI commands to understand them and think I have found a few issues with them:

Lowercase and uppercase dark colors work whether quoted or not; however, when unquoted lowercase colors (dark colors) display as a bright color and dark when quoted. echo ~c "Test." or echo "~c Test."

Uppercase colors display as bright either way.

~i as a black background displays as white.

Background colors only work as lowercase and conflict with special commands when unquoted, it seems then that they are treated as uppercase.

For the special commands:

~4 is displaying as gray on blue instead of white on blue

~8 is displaying as blinking bright red instead of blinking white.

~! Clear screen doesn't actually clear the screen.

You cannot use ~ when it's a valid color code if you're meaning to use it as a text line as an approximate symbol, as it will strip away the first character.


So, really they should be used only within quotes. As well all ANSI escape codes seem to be working fine--which should also be used within quotes.

_________________
The object of life is not to be on the side of the majority, but to escape finding one’s self in the ranks of the insane.” — Marcus Aurelius


Tue Apr 14, 2020 10:55 am
Profile ICQ
Ambassador
User avatar

Joined: Wed Apr 20, 2011 1:19 pm
Posts: 2433
Location: Oklahoma City, OK 73170 US
Unread post Re: TWX Proxy - New Commands addQuickText and clearQuickTex
Adept wrote:
I was testing the new ANSI commands to understand them and think I have found a few issues with them:

Lowercase and uppercase dark colors work whether quoted or not; however, when unquoted lowercase colors (dark colors) display as a bright color and dark when quoted. echo ~c "Test." or echo "~c Test."

Uppercase colors display as bright either way.

You can't use color codes outside of a string. echo "~c" "Test." should work, because echo just conceits all the arguments it receives. You invalid argument really should have thrown a compiler error.

Are you getting any errors when using color codes INSIDE quotes?

I will add ~~ for use as a literal ~ symbol. Most people don't use the symbol, so I figure impact on existing scripts should be minimal.

What terminal are you using for "Clear Screen"?

'^[2J' acts differently in different terminal programs. Putty clears the screen, but does not home the cursor, while swath does both. I have not tested in any other terminal programs, but strictly speaking I think putty is probably correct. The code "~!" is replaced with "^[2J^[H" which is clear screen and home cursor. It really should work in any terminal program.

_________________
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/frrjg6r


Thu Apr 16, 2020 5:36 pm
Profile ICQ YIM WWW
Chief Warrant Officer
User avatar

Joined: Sat Feb 27, 2016 1:01 am
Posts: 168
Location: Molon Labe
Unread post Re: TWX Proxy - New Commands addQuickText and clearQuickTex
Oh no errors were ever displayed, it either showed the color or as gray.

I am using SWATH in Windows 10.

I also noticed this morning that ASCII characters from PabloDraw (or The Draw) no longer seem to display correctly, but also true for an older version of TWX Proxy, so am wondering if it's due to Windows 10?

The only way to show ASCII now is by using #[number] outside of quotes, e.g.,

echo "* Testing... " #8 #176 "*"

www.webopedia.com/TERM/E/extended_ASCII.html

_________________
The object of life is not to be on the side of the majority, but to escape finding one’s self in the ranks of the insane.” — Marcus Aurelius


Thu Apr 16, 2020 11:45 pm
Profile ICQ
Ambassador
User avatar

Joined: Wed Apr 20, 2011 1:19 pm
Posts: 2433
Location: Oklahoma City, OK 73170 US
Unread post Re: TWX Proxy - New Commands addQuickText and clearQuickTex
Adept wrote:
~i as a black background displays as white.

This was actually a typo in the source code and will be corrected int the next version.

I have decided to go a slightly different route on some of the colors.
a-h,A-H,i-p Will remain the same as well as 0-9, but I deleted the other six colors and added I-P as Blinking versions.

I added Double Tilde (~~) if you need a literal Tilde (~) in your string.

I also added:

~s Save Current Cursor Position
~u Restore Saved Cursor Position

~! Clears the screen and homes the cursor in both Swath and Putty. What terminal where you using when it did not clear the screen?

_________________
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/frrjg6r


Sat Apr 18, 2020 6:23 am
Profile ICQ YIM WWW
Chief Warrant Officer
User avatar

Joined: Sat Feb 27, 2016 1:01 am
Posts: 168
Location: Molon Labe
Unread post Re: TWX Proxy - New Commands addQuickText and clearQuickTex
I used SWATH...perhaps I used it wrong?

Can't flashing text be both dark and bright colored?

...Is a work in progress, but so far am nearly finished with the ANSI characters and colors pages: http://www.dhtwgs.net/twxproxy_view.phtml

_________________
The object of life is not to be on the side of the majority, but to escape finding one’s self in the ranks of the insane.” — Marcus Aurelius


Sun Apr 19, 2020 7:13 am
Profile ICQ
Display posts from previous:  Sort by  
Reply to topic   [ 26 posts ]  Go to page 1, 2  Next

Who is online

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