| www.ClassicTW.com https://mail.black-squirrel.com/ |
|
| TWX Scripting- Send Special Keys https://mail.black-squirrel.com/viewtopic.php?f=15&t=21557 |
Page 1 of 1 |
| Author: | Harkov [ Wed Feb 11, 2009 6:43 pm ] |
| Post subject: | TWX Scripting- Send Special Keys |
Following some of the scripting and various tutorials, I am curious on the TWX scripting. If you can have: # At Command Prompt send "sh" And you see a scan, holo Is there a way to emulate other keys, such as ALT or Shift? |
|
| Author: | Promethius [ Wed Feb 11, 2009 6:52 pm ] |
| Post subject: | Re: TWX Scripting- Send Special Keys |
Harkov wrote: Following some of the scripting and various tutorials, I am curious on the TWX scripting. If you can have: # At Command Prompt send "sh" And you see a scan, holo Is there a way to emulate other keys, such as ALT or Shift? I have never sent an alt or shift key sequence. I believe it might be done similar to sending the backspace. I'm not sure what the use of keys might be other than to maybe use as a textouttrigger. |
|
| Author: | mob [ Wed Feb 11, 2009 7:05 pm ] |
| Post subject: | Re: TWX Scripting- Send Special Keys |
Harkov wrote: Following some of the scripting and various tutorials, I am curious on the TWX scripting. If you can have: # At Command Prompt send "sh" And you see a scan, holo Is there a way to emulate other keys, such as ALT or Shift? Why would you want to do that? I know you can't use those to run m()m commands if that is what you were thinking about. Not sure about hotkeys in swath or whatever.. |
|
| Author: | Harkov [ Wed Feb 11, 2009 7:27 pm ] |
| Post subject: | Re: TWX Scripting- Send Special Keys |
Unfortunately I am unfamiliar with m()m commands. I am not looking to use it, I was just curious from the script writers here if in fact it is available or an option. TWX uses * for Enter, REXX uses the ^M. I was making some notes and wanted to ask about the keys like ALT, Shift. |
|
| Author: | Singularity [ Wed Feb 11, 2009 7:33 pm ] |
| Post subject: | Re: TWX Scripting- Send Special Keys |
Sorta... Keep in mind that the server will filter out anything that it doesn't understand. Commands sent thru send are sent directly to the server and not parsed thru TWXproxy or your helper. So sending "alt" would do absolutely no good, the server doesn't understand alt and nothing on your end will ever parse it unless you're routing TWXproxy thru something else. You can do something like: send #8 For backspace. Or... send #27 For an escape. I don't know of any way to send modifier codes, like alt or ctrl, but you can basically send any of the things at: http://www.asciitable.com/ For shift, uhm, yea, you can just do the capital letter. Edit: You can also use directional keys, the exact code will depend on if your term program sends as a character or as an ansi sequence, but you can trigger on either. You can use a generic setTextOutTrigger to trap for keys, then echo that ord to the screen. Easy way to figure out what code a key is. |
|
| Author: | Harkov [ Wed Feb 11, 2009 8:25 pm ] |
| Post subject: | Re: TWX Scripting- Send Special Keys |
You answered my next questions. Thank you all. |
|
| Author: | mob [ Wed Feb 11, 2009 8:57 pm ] |
| Post subject: | Re: TWX Scripting- Send Special Keys |
mob wrote: Harkov wrote: Following some of the scripting and various tutorials, I am curious on the TWX scripting. If you can have: # At Command Prompt send "sh" And you see a scan, holo Is there a way to emulate other keys, such as ALT or Shift? Why would you want to do that? I know you can't use those to run m()m commands if that is what you were thinking about. Not sure about hotkeys in swath or whatever.. ehh sorry couldn't be more help, that sounded kinda neg but didn't mean for it to be. I just know when I was learning I tried a couple things like that or wanted to then finding out it really didn't work that way:) No offense... Good luck!! |
|
| Author: | Singularity [ Wed Feb 11, 2009 8:59 pm ] |
| Post subject: | Re: TWX Scripting- Send Special Keys |
If you need to "meta script" by loading multiple scripts or macros, there's various ways to do it. A small swath zoc script works pretty well, I have a few of those. Also a program called "Autohotkey" ... it's freeware, and you can assign any keys you want into a macro. |
|
| Author: | Harkov [ Wed Feb 11, 2009 9:27 pm ] |
| Post subject: | Re: TWX Scripting- Send Special Keys |
mob wrote: mob wrote: Harkov wrote: Following some of the scripting and various tutorials, I am curious on the TWX scripting. If you can have: # At Command Prompt send "sh" And you see a scan, holo Is there a way to emulate other keys, such as ALT or Shift? Why would you want to do that? I know you can't use those to run m()m commands if that is what you were thinking about. Not sure about hotkeys in swath or whatever.. ehh sorry couldn't be more help, that sounded kinda neg but didn't mean for it to be. I just know when I was learning I tried a couple things like that or wanted to then finding out it really didn't work that way:) No offense... Good luck!! Mob, I never found your response negative in any way, so no worries. You asked a legit question. Singularity wrote: If you need to "meta script" by loading multiple scripts or macros, there's various ways to do it. A small swath zoc script works pretty well, I have a few of those. Also a program called "Autohotkey" ... it's freeware, and you can assign any keys you want into a macro. Do you have a swath zoc script you could send me so I could take a look at it? |
|
| Author: | Singularity [ Wed Feb 11, 2009 10:08 pm ] |
| Post subject: | Re: TWX Scripting- Send Special Keys |
Code: /* A simple selection menu script for simplifying hotkeys */ /* Comment out the signal lines and the script will end after */ /* click on a choice. */ Top: what=zocrequestlist("Select?","Exit-Enter Callsaveme|Dumb Reloader|IG Motha|Cancel") if what=0 then do call zocsend "$ssc:/games/tradewars/twxproxy/scripts/dny_exit-callsaveme.ts^M" exit /* signal Top; */ end else if what=1 then do call zocsend "$ssc:/games/tradewars/twxproxy/scripts/dny_dumb_reloader.ts^M" exit /* signal Top; */ end else if what=2 then do call zocsend "$ssc:/games/tradewars/twxproxy/scripts/dny_ig_motha.ts^M" exit /* signal Top; */ end else if what=3 then exit A simple sub-menu script. You can assign something like this to a swath hotkey and get a sub-menu. You could zocsend pretty much anything, and since stuff from the helper goes thru TWXproxy (provided you have it set that way) then you can also script different settings as a single hotkey. Also good for doing a mombot macro command or pretty much whatever. I think swath also supports zocwait, so you can code in a simple series of waitFors to wait for the scripts to load or exit before calling another. |
|
| Author: | Harkov [ Wed Feb 11, 2009 10:52 pm ] |
| Post subject: | Re: TWX Scripting- Send Special Keys |
Thanks for the time and insight. It all helps. |
|
| Author: | LoneStar [ Thu Feb 12, 2009 7:07 am ] |
| Post subject: | Re: TWX Scripting- Send Special Keys |
Code: setTextouttrigger text :text pause :text getOutText $character getCharCode $character $charCode echo "**Character "&$character&", CharCode "&$charCode&"**" Run the above code snippet and press CTRL-F and you should see something like Which means you can use the Control key in place of the ALT key.Hope this helps |
|
| Author: | Singularity [ Thu Feb 12, 2009 7:21 pm ] |
| Post subject: | Re: TWX Scripting- Send Special Keys |
Yeh, some keys will have control codes, but not all of them will. That's because these keys use to have other functions back in the days of yore. Control-C, for instance, used to be "break" ... a way to tell a program to let you out. |
|
| Page 1 of 1 | All times are UTC - 5 hours |
| Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |
|