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

Post Reply
User avatar
tsuujin
Posts: 695
Joined: Fri Feb 26, 2010 12:59 am
Location: California
Contact:

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

Post 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.

Glass
Posts: 16
Joined: Mon Jun 28, 2010 10:00 pm

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

Post 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.

User avatar
tsuujin
Posts: 695
Joined: Fri Feb 26, 2010 12:59 am
Location: California
Contact:

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

Post 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.

User avatar
Heiko
Site Admin
Posts: 1548
Joined: Wed Mar 11, 2009 6:26 pm

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

Post 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.

User avatar
Vadi
Posts: 4852
Joined: Sat Mar 14, 2009 3:13 pm

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

Post by Vadi »


Post Reply