Page 1 of 1

Feature Request: permKey(), tempKey(), deleteKey()

Posted: Sat Jul 31, 2010 6:44 pm
by tsuujin
I have a tendency to like to switch what macros do, on the fly. Currently the only way I've found to to do this is to define macros for each key I want to use, and script each key to change functionality based on variables.

This works, but becomes a lot of effort to change around and isn't very clean. Instead, I'd like the functionality to create, change and delete keys via scripting. This is one of the features I miss most from my days with MUSHclient.

tempKey(key_sequence, code_string)
permKey(key_name, key_sequence, code_string)
deletePermKey(key_name)
deleteTempKey(key_id)
Code: [show] | [select all] lua
aKey = tempKey("numpad8",[[doSomeCode()]])
bKey = permKey("bKey","numpad8+ctrl",[[someOtherCode()]])
cKey = tempKey("numpad8+shift+ctrl",[[anotherCodeBlock()]])
if aKey then deleteTempKey(aKey) end
if exists("bKey","key") then deletePermKey("bKey") end
I can't think of a great reason to have a one-shot key, so tempKey() would extend through the session or until killed.
permKey() would show up on the keys list and exist until deleted.

Re: Feature Request: permKey(), tempKey(), deleteKey()

Posted: Sat Jul 31, 2010 9:23 pm
by Glass
Y'know, I'm writing my system to work with every class in Aetolia, and I might have a solution that could point you in the right direction.

Have you tried making a table of functions? For example, when I log in, it pulls up my score silently to capture my level, class, etc. When it does so, it changes the playerClass variable to whatever my class is. For bashing, I hit my F2 key (it'd be F1, except my key broke off :( ). F2 is simply setup to do classFunctions.bashing.playerClass(), where that given function would look like "sentAttack = 1; send("frenzy " .. target)" for Vampires or "sentAttack = 1; send("secrete camus"); send("bite " .. target) ; send("purge"); gagPurge = 1" for Syssin.

Obviously you don't quite need it to work the same as mine, but you get the idea! Function tables are sweet as hell.

Re: Feature Request: permKey(), tempKey(), deleteKey()

Posted: Sat Jul 31, 2010 11:29 pm
by tsuujin
I've done similar things, but this doesn't really work for what I'm trying to do currently, because I don't want any code actually done in the key editor. I'd rather just do key redefines en bulk based on functions.

Re: Feature Request: permKey(), tempKey(), deleteKey()

Posted: Sun Aug 01, 2010 11:40 am
by Heiko
This sounds like a good idea for a volunteer who wants to submit a patch. It's certainly a feature that should be included for the sake of completeness.

Re: Feature Request: permKey(), tempKey(), deleteKey()

Posted: Wed Apr 05, 2017 9:45 am
by Vadi