Anywho, what I did was make a system that scans through all the base mob's verbs upon world startup, and apply any accepted names to a macroing list. In doing this, it is possible to make a verb like, mob/verb/A(), and it automatically be set to the A key. Or even, mob/verb/AUP() and /AREP() for up and repeat controls.
Granted, this is a little extreme given one could simply make a master list that sets all macros for them,
var/list/macrosMaster=list("W"="walkNorth","W+UP"="walkNorthRelease")
or even simply set the macros in the game's interface.
I suppose when all is said and done, I made this for the sake of making it, and I posted this for the sake of posting. It is an interesting concept though. However, somewhat useless because, there is no practicality to using something like this after all.
var/macroParent="macro"
//For more dynamic arguments, add to list manually.
var/list/macros=list(
"F1"="Say \"I need backup!\"",
"F2"="Say \"All clear.\"",
"F3"="Say \"Take Cover\"",
"1"="Slot 1",
"2"="Slot 2",
"3"="Slot 3",
"4"="Slot 4",
"5"="Slot 5"
)
var/scanning=1
/*
the keys list is a mass list which represents all acceptable key presses.
*/
var/list/keys=list("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z",
"F1","F2","F3","F4","F5","F6","F7","F8","F9","F20","F11","F12","NUM1","NUM2","NUM3","NUM4","NUM5","NUM6","NUM7","NUM8","NUM9","NUM0","NORTH","SOUTH","EAST",
"WEST","NORTHEAST","NORTHWEST","SOUTHEAST","SOUTHWEST","CENTER","PAUSE","TAB","ESC","INSERT","EQUALS","SUBTRACT","DIVIDE","MULTIPLY",
"RETURN","ADD","SUBTRACT2","DELETE","GRAVEACCENT","COMMA","PERIOD","FORWARDSLASH","SEMICOLON","APOSTROPHE","STARTBRACKET",
"ENDBRACKET","BACKSLASH","NUMPAD1","NUMPAD2","NUMPAD3","NUMPAD4","NUMPAD5","NUMPAD6","NUMPAD7","NUMPAD8","NUMPAD9")
var/list/keyTrans=list("GRAVEACCENT"="`","EQUALS"="=","SUBTRACT"="-","COMMA"=",","PERIOD"=".","FORWARDSLASH"="/","SEMICOLON"=";",
"APOSTROPHE"="'","STARTBRACKET"="\[","ENDBRACKET"="]","BACKSLASH"="\\","NUM1"="1","NUM2"="2","NUM3"="3","NUM4"="4","NUM5"="5","NUM6"="6","NUM7"="7","NUM8"="8","NUM9"="9","NUM0"="0")
world/New()
..()
sleep(10)
var/list/mobs
mobs=typesof("[world.mob]/verb")
if(istype(mobs,/list/)&&mobs.len>0)
var/first="[mobs[1]]"
var/spot
//This little bit will find the final /, so that the verb name will be the only thing read.
for(var/v=1 to length(first))
var/lspot=spot
spot=findtext(first,"/",spot+1)
if(spot==null||spot<=lspot)
spot=lspot
break
//And here's where the real work is done. This simply goes through the verb list,
//and checks to see if it ends with a REP or a UP. If so, it applies and it to the exst variable and
//then checks to see if the verb name is in the accept key presses.
for(var/m in mobs)
var/mob/v=m
var/tx="[v]"
var/exst=""
tx=copytext("[tx]",spot+1,length("[tx]")+1)
var/l=length(tx)
if(findtextEx(tx,"REP",l-3))
tx=copytext(tx,1,l-2)
exst="+REP"
else
if(findtextEx(tx,"UP",l-2))
tx=copytext(tx,1,l-1)
exst="+UP"
if(tx in keys)
if(tx in keyTrans)
tx=keyTrans[tx]
macros["[tx][exst]"]=v.name
scanning=null//This trigger is used to hold MOBS until the system is done scanning.
/////////////////////////////////////////////////////////////////////////////////////////////////////
world/mob=/mob/attackable/player
mob/attackable/player
Login()
while(scanning)//Holds login until macro list is returned.
sleep(1)
for(var/v in macros)
winset(src,"Macro[v]","parent=[macroParent];name=\"[v]\";command=[url_encode(macros[v])]")
..()
verb
ExamineList()
for(var/v in macros)
src<<"[v]=[macros[v]]"
A()
set name = "Attack"
src<<"You attack!"
MULTIPLY()
set name = "Mimic"
src<<"Multiply!"
AREP()
set hidden=1
world<<"AREP"
LUP()
set hidden=1
world<<"L released."
Slot(n as num)
set hidden = 1
var/list/Slots=list("Egg","Knife","Banana","Roll of Toilet Paper")
if(n>0&&n<=Slots.len)
src<<"In slot [n] you have a(n) [Slots[n]]."
EQUALS()
set hidden=1
src<<"Equals what?"
ADD()
set hidden=1
src<<"Plus..."
NUMPAD1()
set hidden=1
src<<"NP1"
Say(t as text)
world<<"[src] says: [t]"