Re: Working with charCodes in Scripts
SteveH_66 wrote:
I know that you can use character codes in TWX scripts like in triggers, I am using #11 to trip a trigger in a script now when I press Ctrl + k. What I am wondering is if there is any way to pass character codes back and forth between scripts?
If that were possible, you could use that to communicate between scripts and even call and kill scripts automatically between scripts. I have tried send #11, send #12, things like that and it doesn't work. Can anyone think of something that would work?
Ascii characters < 32 are called control characters #10 is LF, #13 is CR, and you need both of those to start a new line.
If you send control characters #11, send #12 to TWGS/TW2002 it will ignore them and not echo them. This is how a server should correctly handle this.
There are a commands in TWX for interscript communication. Here is an excerpt from Zedbot:
Code:
# In Z-Bot Version Command
:INTCOM_VER
SetVar $Z_Lib~message $scripttitle & " v" & $version & "*"
SetVar $Z_Lib~messageto $sender
SetVar $Z_Lib~messagemode "R"
Gosub :MSGBRIDGE
PROCESSIN 1 "[Z]VERSION[Z]"
Return
# In other scripts i.e. ComsGuard:
SetTextTrigger ver :VERSION "[Z]VERSION[Z]"
PROCESSIN sends a line of text, as if it came from the server, but it not actually sent or echoed.
The end result is that all Zedbot daemons that are running will report their version immediately after Zedbot does.
Zedbot uses a lot of these, including to shudown daemons cleanly.