ID:1907799
 
Code:
client/proc/Place_Hotbars()
for(var/T in typesof(/obj/Keys/)-/obj/Keys)
usr.client += T
obj/var/screenlocation
mob/var/list/obj/Hotbar_Commands=list()
obj/Keys// Creating blank boxes so that the hotbars 'identity' remains hovering
layer=13// over skillcards added to the bar
icon='Hotkeys.dmi'
var/locc
var/hotbar
New(client/C)
icon_state=name
screen_loc=locc
C.screen+=src
..()
Key1
locc = "10,1"
hotbar=1
Key2
locc = "11,1"
hotbar=2
Key3
locc = "12,1"
hotbar=3
Key4
locc = "13,1"
hotbar=4
Key5
locc = "14,1"
hotbar=5
Key6
locc = "15,1"
hotbar=6
Key7
locc = "16,1"
hotbar=7
Key8
locc = "17,1"
hotbar=8
Key9
locc = "18,1"
hotbar=9
Key10
locc = "19,1"
hotbar=10
Key11
locc = "20,1"
hotbar=11
Key12
locc = "21,1"
hotbar=12


obj
Skillcards
layer = 12
New()
..()
src.mouse_drag_pointer = icon(src.icon,src.icon_state)// Changes the mouse's icon when holding a technique tile
MouseDrop(obj/Keys,usr.contents)
usr.Hotbar_Commands[Keys.hotbar] = src
..()
MouseDrop(src)
if(istype(src,/obj/Keys)||istype(src,/obj/Skillcards/))// must be a skillcard being dropped onto a key
..()
else // that they are defined skill cards
return


Problem description:
Basically, I'm trying to make a hotbar system, which allows you to click on the hotbar, activating the skill but, I also want to make it so that you'll be able to press 1,2,3,4,5,6,7,8,9,0,,-,= to activate the skills aswell. For me to do that, I tried use arrays but, couldn't remember how to do it and I don't really understand how the hotbars work in general, I've tried look at a resource only found one and try edit that coding to my liking... You could probably tell it was done poorly.
An easy way of handling hotbars while using numbers is to add it to your macros.

For example go into your interface, then into your macros, and create a new macro for number 1 and type something like Hotslot(1).

mob
verb
Hotslot(var/Key)
switch(Key)
if(1)
//Activate Skill 1
if(2)
//Activate Skill 2
if(3)
//Activate Skill 3


You get the general idea, if you need some more help pager me.
You don't need 12 different /obj types to have a hotbar. Just have one /obj type and use an associated list to store it's location, it's contents(whats being held in the hotbar slot), it's quick-button command, and whatever other data you want associated with that specific hotbar box.

I'm not in the state to give exact details but if I remember correctly you'll just use call() for the quick-button command, and use macros for the slots too.

/edit By associated list, I mean just have a list for the hotbar boxes, and each box will have it's own list for it's own data.
In response to Maximus_Alex2003
That's what I tried do but I didn't know how I was going to be able to do that.