ID:138982
 
Code:
proc
checkmacpos(skillname,mob/M)
for(var/i=1,i<=17,i++)
if(M.maclist[i]==skillname)
return(i)
mob
var
list
maclist[17]
skills = new/list()

verb
MacroSkill(N as num)
set hidden = 1
if(maclist[N])
call(maclist[N])(src)

obj
Skills
Click()
call(text2path("[src.type]/proc/Tech"))(usr)

MouseDrop(obj/O,srcLoc,OLoc,srcControl,OControl,params)
var/list/P = params2list(params)
var/obj/Btn = text2path("[src.type]/proc/Tech")
var/pos = ButtonPlacement(P["screen-loc"], Btn, usr)
if(checkmacpos(text2path("[src.type]/proc/Tech"),usr))
if(!pos && srcControl!="window1.info1") //REPLACE WITH NAME OF INTERFACE INFO PANEL
Btn=src
else if(pos)
Btn=src
else
return
else if(pos)
Btn=new Btn
if(pos)
if(O.screen_loc==pos && Btn.screen_loc && O.type in typesof(/obj/Skills))
O.screen_loc=Btn.screen_loc
else if(O.screen_loc==pos && O.type in typesof(/obj/Skills))
usr.client.screen-=O
Btn.screen_loc = pos
usr.client.screen+=Btn
else if(Btn)
usr.maclist[checkmacpos(Btn,usr)] = null
usr.client.screen-=Btn
proc
ButtonPlacement(btnloc, skillname,mob/M as mob)
var/num1 = copytext(btnloc,1,findtext(btnloc,":"))
var/middlenum = findtext(btnloc,",")
var/num2 = copytext(btnloc,middlenum,findtext(btnloc,":",middlenum))
if(num2!=",2")return
if(text2num(num1)<1 || text2num(num1)>17) return//FOR SCREEN LOC, 2 & 10 is the in between spaces for skill btns
var/prevmacloc = checkmacpos(skillname,M)
var/macpos = text2num(num1) //FOR SCREEN LOC, change -1 to whatever distance it needs to be

if(M.maclist[macpos] && prevmacloc)
M.maclist[prevmacloc]=M.maclist[macpos]
else if(prevmacloc)
M.maclist[prevmacloc]=null
M.maclist[macpos]=skillname

return "[num1][num2]"


mob/proc/Skillsadd()
src.skills += new/obj/Skills/Grand_Fireball
client
Del()
if(mob.cansave)
var/savefile/F = new("Savefiles/[ckey].sav")
F["mob"] << mob
for(var/obj/HUD/x)
mob.client.screen-=x
var/I=1
while(I<18)
F["[I],2"]=null
I++
for(var/obj/Skills/G in screen)
F[G.screen_loc]<<G.type

..()
client
proc
Load()
var/savefile/F = new("Savefiles/[ckey].sav")
F["mob"] >> mob
mob.overlays += mob.prevoverlays
mob.underlays += mob.prevunderlays
mob.addHUD()
var/I=1
while(I<18)
if(F["[I],2"])
var/T = F["[I],2"]
var/obj/Skills/G = new T
G.screen_loc="[I],2"
screen+=G
I++

// example of a skill

obj/Skills/Grand_Fireball
icon='Fire.dmi' //31x31 graphic for skill
icon_state="6"
mouse_drag_pointer="6" //same as icon_state
layer=91
proc
Tech(mob/M) //DO NOT CHANGE NAME, you can add arguments for your skills
set popup_menu = 0 //keep for all skills
src=M
// some stuff going beneath src=M here.


Problem description:
Well, when I first place the skill on the hotbar, then press the hotkey for where I placed the skill, the skill gets executed fine. For example, spot one's hotkey is key '&', the macro for it is set in the interface file as 'MacroSkill 1'. This for every key I have on my hotbar, until 'MacroSkill 17'. Well, when I relog, the saving and loading happens, but when I try and execute the skill by pressing the hotkey from the place of the hotbar where the skill is saved and loaded, the skill doesn't get executed. Does anyone know a solution?

PS: The MacroSkill verb is found almost at the top of the code snippet.