ID:157799
 
Hello I trying to make a Hotkey System that works and i got

obj/Hotkey
layer=80
density=1
Hud1
icon='Hud 1.dmi'
icon_state="F1"
layer=MOB_LAYER
mouse_drop_pointer=1
mouse_drop_zone=1
New(client/c)
screen_loc="9,16"
c.screen+=src

and i made the skin have macro F1 and Command Hud1 what do i have to do or add to moves and Code to make it so players can drag the pic of the move to the hot key bar and drag it off and use the key F1 to use the move they set it for.
You may be able to mod and put in this old system I never quite finished into your code. In this you click on the skill then click on the spott, it doesnt work perfectly but you may find it useful

mob/var/setting=""
mob/Stat()
statpanel("Skills", contents)
mob/verb/Key1()
set hidden =1
var/obj/Macro/Macrobar1/M
for(M in usr.client.screen)
if(M:Action == "")
..()
else
call (/obj/Verbs/DblClick)()
mob/verb/Key2()
set hidden =1
var/obj/Macro/Macrobar2/M
for(M in usr.client.screen)
if(M:Action == "")
..()
else
call (/obj/Verbs/DblClick)()
mob/verb/Key3()
set hidden =1
var/obj/Macro/Macrobar3/M
for(M in usr.client.screen)
if(M:Action == "")
..()
else
call (/obj/Verbs/DblClick)()
mob/verb/Key4()
set hidden =1
var/obj/Macro/Macrobar4/M
for(M in usr.client.screen)
if(M:Action == "")
..()
else
call (/obj/Verbs/DblClick)()
mob/verb/Key5()
set hidden =1
var/obj/Macro/Macrobar5/M
for(M in usr.client.screen)
if(M:Action == "")
..()
else
call (/obj/Verbs/DblClick)()
mob/verb/Key6()
set hidden =1
var/obj/Macro/Macrobar6/M
for(M in usr.client.screen)
if(M:Action == "")
..()
else
call (/obj/Verbs/DblClick)()
mob/verb/Key7()
set hidden =1
var/obj/Macro/Macrobar7/M
for(M in usr.client.screen)
if(M:Action == "")
..()
else
call (/obj/Verbs/DblClick)()
mob/verb/Key8()
set hidden =1
var/obj/Macro/Macrobar8/M
for(M in usr.client.screen)
if(M:Action == "")
..()
else
call (/obj/Verbs/DblClick)()
mob/verb/Key9()
set hidden =1
var/obj/Macro/Macrobar9/M
for(M in usr.client.screen)
if(M:Action == "")
..()
else
call (/obj/Verbs/DblClick)()
mob/verb/Key0()
set hidden =1
var/obj/Macro/Macrobar10/M
for(M in usr.client.screen)
if(M:Action == "")
..()
else
call (/obj/Verbs/DblClick)()
obj/Macro/var/Action = ""
obj/Macro/Click()
if(usr.setting !="")
Action = usr.setting
icon = usr.setting:icon
icon_state = usr.setting:icon_state
usr.setting = ""
usr.client.mouse_pointer_icon = "mouse.dmi"
obj/Verbs
Click()
usr.setting = src
usr.client.mouse_pointer_icon = src.icon
icon = 'Macrobar.dmi'
DblClick()
usr<<output("<font color=white><B>An attack is placed here.")
/*obj/Verbs/Fireball
Click()
usr.setting = src
usr.client.mouse_pointer_icon = src.icon
icon = 'Macrobar_Fireball.dmi'
DblClick()
usr<<output("<font color=white><B>Fireball.")
*/


obj/Macro/Macrobar1
icon = 'Macrobar.dmi'
icon_state = "1"
New()
screen_loc = "1,10"
/* var/obj/Attack/Sword/S
var/obj/Macro/Macrobar1/M
M:Action = new S ()*/

obj/Macro/Macrobar2
icon = 'Macrobar.dmi'
icon_state = "2"
New()
screen_loc = "1,9"
obj/Macro/Macrobar3
icon = 'Macrobar.dmi'
icon_state = "3"
New()
screen_loc = "1,8"
obj/Macro/Macrobar4
icon = 'Macrobar.dmi'
icon_state = "4"
New()
screen_loc = "1,7"
obj/Macro/Macrobar5
icon = 'Macrobar.dmi'
icon_state = "5"
New()
screen_loc = "1,6"
obj/Macro/Macrobar6
icon = 'Macrobar.dmi'
icon_state = "6"
New()
screen_loc = "1,5"
obj/Macro/Macrobar7
icon = 'Macrobar.dmi'
icon_state = "7"
New()
screen_loc = "1,4"
obj/Macro/Macrobar8
icon = 'Macrobar.dmi'
icon_state = "8"
New()
screen_loc = "1,3"
obj/Macro/Macrobar9
icon = 'Macrobar.dmi'
icon_state = "9"
New()
screen_loc = "1,2"
obj/Macro/Macrobar10
icon = 'Macrobar.dmi'
icon_state = "0"
New()
screen_loc = "1,1"
In response to Darkjohn66
John i not understanding sorry lol but i see a lot of codes and my brain is like screaming how i edit to my stuff lol if it help what i basic doing is like Naruto next generation and GOA
In response to Darkjohn66
im pretty sure this is the part you want
obj/Macro/Click()
if(usr.setting !="")
Action = usr.setting
icon = usr.setting:icon
icon_state = usr.setting:icon_state
usr.setting = ""
usr.client.mouse_pointer_icon = "mouse.dmi"

Then I think you would make a verb for each key and have the verb be set by the macro or something... lol trying my best here, maybe try searching for similar threads?

<small>its john/Tictac(:P) from msn btw<small>
In response to Darkjohn66
Thank you John For you help and i will keep searching if i have to i pay Solar to do it if it also helps what i was wanting to do is you have 10 moves and 9 slots are open instead of clicking the tab and hitting move you just drag the move pic/name over to the F1-F9 Slot in HotKeys Then all you got to do is Hit F1 and if you want to remove them you just drag them off idk if this helps more at all or not and again thanks for all your help.
I know there's a way, but I don't know it, but you could make it so when they click the icon in their verbs it pops up a list to add it to the HUD.

Or, like John said, click the icon...then click the hotkey area. That would be simple. If need be, I'll write-up a system...
In response to Hi1
Yes Please Thank you i would really appreciate it if i have to i can send you every thing i got or add me to msn [email protected] and i can show you useing Team viewer what all i got including icons and all
In response to Darkjohn66
That snippet really hurts my eyes. You practically abuse all of the DM taboos and the code's a mess. All client-input based actions should be stored within the players themselves, not the HUD. The HUD should mainly be used for graphical enhancement and/or data display.

Not only does he have bad code, but he also has to manually add everything, which can lead to more spaghetti code. Stuff like this is more efficient when it's object-oriented.

mob
var/list
HotKeys=list("F1","F2","F3","F4","F5","F6","F7","F8")

verb/UseKey(key as text)
set hidden=1
if(HotKeys[key])
var/obj/Skill/O=HotKeys[key]
O.Initiate(src)

proc/SetKey(key,object) HotKeys[key]=object

obj
icon='Stuff.dmi'
Skill
proc/Initiate(mob/Owner)

MouseDrag()
mouse_drag_pointer=icon(icon,icon_state)

MouseDrop(over_location)
mouse_drag_pointer=null
if(istype(over_location,/obj/Hud/HotKeys))
var/obj/O=over_location
O.overlays=list(icon(icon,icon_state))
usr.SetKey(O.name,src)

Sword
icon_state="skill"
Initiate(mob/Owner)
world<<"[Owner.name] used this sword skill!"
Boom
icon_state="boom"
Initiate(mob/Owner)
world<<"[Owner.name] used this magic skill!"

Hud
HotKeys
mouse_drop_zone=1

New() icon_state=name
Click()
overlays=null
usr.HotKeys[name]=null

F1/screen_loc="2,2"
F2/screen_loc="3,2"
F3/screen_loc="4,2"
F4/screen_loc="5,2"
F5/screen_loc="6,2"
F6/screen_loc="7,2"
F7/screen_loc="8,2"
F8/screen_loc="9,2"


For the above code, all that needs to be added are the skills themselves. To actually use the macros, add the macros and command in your interface file (ex. Key: F1, Command: UseKey "F1").
In response to Jub369
I wrote a snippet in reply to John's post ([link]) that does everything you need and it much neater. I only went up to F8 though, but you can easily edit in F9.
In response to Mega fart cannon
i was only trying to help gosh you're vicious for flatulence
In response to Mega fart cannon
for some reason the use key verb doesnt seems to work right i've been editing it for the past 2 days. so far i got it to the point where it runs the Initiate but it runs all the initiates.
In response to Akriloth
Did you notice this post is 5 months old? Just make a new one. (Oh also, I don't program like that anymore XD)
In response to Darkjohn66
yeah i noticed it was 5 months old and it helped me alot and i was talking about Mega fart cannon's code.
i made this a some time ago but im pretty sure you can get some ideas from it :) .

mob
var
tmp
Skill
Macro0
Macro1
Macro2
Macro3
Macro4
Macro5

/*
What I Used For Skill

Skill
parent_type = /obj

Click()
..()
src.Use(usr)

proc
Use(var/mob/A)
if(mode == BUY)
return
if(used)
return
else
if(mode == USE)
if(used == TRUE) return
used = TRUE
if(A.MPCost(mp_cost))
..()
overlays += /obj/cooling/
suffix = "(Cooling Down...)"
spawn(cool_down)
used = FALSE
overlays -= /obj/cooling/
suffix = ""
. = TRUE
else
.=FALSE

Skill
FireBall
Use(var/mob/A)
.=..()
if(.)
A.FireBall()
*/



obj
HUD
SkillMacros
var/macro_num=0
mouse_drop_zone = 1
icon = 'skill hud.dmi'
layer = EFFECTS_LAYER - 3
var/tmp/Skill/to_remove

New()
..()
var/obj/L = new
L.icon = 'letters.dmi'
L.icon_state = macro_num
L.pixel_y = 20
L.pixel_x = 2
L.layer = EFFECTS_LAYER
overlays += L

proc
MacroUse()

Click()
MacroUse(usr)
..()

Zero
macro_num = "0"
screen_loc = "EAST, 8"
MacroUse(var/mob/A)
if(A.Macro0)
A.Macro0.Use(A)
One
macro_num = "1"
screen_loc = "EAST, 7"
MacroUse(var/mob/A)
if(A.Macro1)
A.Macro1.Use(A)
Two
macro_num = "2"
screen_loc = "EAST, 6"
MacroUse(var/mob/A)
if(A.Macro2)
A.Macro2.Use(A)
Three
macro_num = "3"
screen_loc = "EAST, 5"
MacroUse(var/mob/A)
if(A.Macro3)
A.Macro3.Use(A)
Four
macro_num = "4"
screen_loc = "EAST, 4"
MacroUse(var/mob/A)
if(A.Macro4)
A.Macro4.Use(A)
Five
macro_num = "5"
screen_loc = "EAST, 3"
MacroUse(var/mob/A)
if(A.Macro5)
A.Macro5.Use(A)

Skill
New()
..()
var/icon/I = new(src.icon, src.icon_state)
mouse_drag_pointer = I

MouseDrag(over_object,src_location,over_location,src_control,over_control,params)


MouseDrop(over_object,src_location,over_location,src_control,over_control,params)
var/obj/HUD/SkillMacros/H
if(istype(over_object, /obj/HUD/SkillMacros/))
H = over_object
H.overlays -= H.to_remove
H.overlays += src
H.to_remove = src
if(H.macro_num=="0")
usr.Macro0 = src
if(H.macro_num=="1")
usr.Macro1 = src
if(H.macro_num=="2")
usr.Macro2 = src
if(H.macro_num=="3")
usr.Macro3 = src
if(H.macro_num=="4")
usr.Macro4 = src
if(H.macro_num=="5")
usr.Macro5 = src

mob
verb
USAGE(num as text)
set hidden = 1
if(num == "0")
if(src.Macro0)
src.Macro0.Use(src)
if(num == "1")
if(src.Macro1)
src.Macro1.Use(src)
if(num == "2")
if(src.Macro2)
src.Macro2.Use(src)
if(num == "3")
if(src.Macro3)
src.Macro3.Use(src)
if(num == "4")
if(src.Macro4)
src.Macro4.Use(src)
if(num == "5")
if(src.Macro5)
src.Macro5.Use(src)


yea so then after that for macro just make it looke like

F1+REP - USAGE 1