wor///HUD - The button were added, all buttons were removed , and we rock ;)
// all button need to be connected
client/New()
command_text = ".alt "
preload_rsc = 2
new/obj/hud/pl_bar1(src)
new/obj/hud/pl_bar2(src)
new/obj/hud/mp_bar1(src)
new/obj/hud/mp_bar2(src)
new/obj/hud/exp_bar1(src)
new/obj/hud/exp_bar2(src)
new/obj/hud/exp_bar3(src)
new/obj/hud/att(src)
new/obj/hud/save(src)
new/obj/hud/say(src)
new/obj/hud/drop(src)
new/obj/hud/roleplay(src)
new/obj/hud/guildsay(src)
new/obj/hud/rest(src)
new/obj/hud/privatemsg(src)
new/obj/hud/who(src)
new/obj/hud/worldsay(src)
new/obj/hud/website(src)
..()
obj/hud/pl_bar1
icon ='life1.dmi'
icon_state ="24"
layer=MOB_LAYER+100
var
width = 24
min = 0
num = 0
proc/edit()
for(var/mob/character/M as mob in world)
if(src.owner == M)
src.num = (M.pl/M.maxpl)*src.width
if(src.num >src.width)
src.num = src.width
if(M.pl <= 0)
src.num = 24
src.icon_state = "[round(src.num)]"
New(client/C)
src.screen_loc ="6,13"
C.screen +=src
obj/hud/pl_bar2
icon ='life2.dmi'
icon_state ="49"
layer=MOB_LAYER+100
var
width = 49
min = 25
num = 0
proc/edit()
for(var/mob/character/M as mob in world)
if(src.owner == M)
src.num = (M.pl/M.maxpl)*src.width
if(src.num >src.width)
src.num = src.width
if(M.pl <= 0)
src.num = 25
src.icon_state = "[round(src.num)]"
New(client/C)
src.screen_loc ="7,13"
C.screen +=src
obj/hud/mp_bar1
icon ='power1.dmi'
icon_state ="25"
layer=MOB_LAYER+100
var
width = 25
num = 0
proc/edit()
for(var/mob/character/M as mob in world)
if(src.owner == M)
src.num = (M.mp/M.maxmp)*src.width
if(src.num >src.width)
src.num = src.width
if(M.mp <= 0)
src.num = 0
src.icon_state = "[round(src.num)]"
New(client/C)
src.screen_loc ="6,13"
C.screen +=src
obj/hud/mp_bar2
icon ='power2.dmi'
icon_state ="24"
layer=MOB_LAYER+100
var
width = 24
num = 0
proc/edit()
for(var/mob/character/M as mob in world)
if(src.owner == M)
src.num = (M.mp2/M.maxmp)*src.width
if(src.num >src.width)
src.num = src.width
if(M.mp2 <= 0)
src.num = 0
src.icon_state = "[round(src.num)]"
New(client/C)
src.screen_loc ="7,13"
C.screen +=src
obj/hud/exp_bar1
icon ='exp1.dmi'
icon_state ="0"
layer=MOB_LAYER+100
var
width = 27
num = 0
New(client/C)
src.screen_loc ="6,13"
C.screen +=src
obj/hud/exp_bar2
icon ='exp2.dmi'
icon_state ="0"
layer=MOB_LAYER+100
var
width = 32
num = 0
New(client/C)
src.screen_loc ="7,13"
C.screen +=src
obj/hud/exp_bar3
icon ='exp3.dmi'
icon_state ="0"
layer=MOB_LAYER+100
var
width = 14
num = 0
New(client/C)
src.screen_loc ="8,13"
C.screen +=src
obj/hud/att
icon ='atcicon.dmi'
icon_state ="blast"
layer=MOB_LAYER+100
var
width = 14
num = 0
New(client/C)
src.screen_loc ="8,13"
C.screen +=src
//end of bars
// Main button firctory
obj/hud
layer = FLY_LAYER+49
invisibility = 99
//save button
save
name="Naruto - Academy"
icon ='mrhud.dmi'
icon_state ="save"
layer = MOB_LAYER+50
New(client/C)
screen_loc ="2,1"
C.screen +=src
//say button
say
name="Naruto - Academy"
icon ='mrhud.dmi'
icon_state ="say"
layer = MOB_LAYER+50
New(client/C)
screen_loc ="3,1"
C.screen +=src
Click()
var/msg=input("Talk to the world")as null|text
if(!msg)
return
else
view(6)<<"<font size = 2> [html_encode(usr)]<font color=white> says: <tt>[html_encode(msg)]</tt>"
//drop button
drop
name="Naruto - Academy"
icon ='mrhud.dmi'
icon_state ="drop"
layer = MOB_LAYER+50
New(client/C)
screen_loc ="4,1"
C.screen +=src
//roleplay button
roleplay
name="Naruto - Academy"
icon ='mrhud.dmi'
icon_state ="roleplay"
layer = MOB_LAYER+50
New(client/C)
screen_loc ="6,1"
C.screen +=src
//guildsay button
guildsay
name="Naruto - Academy"
icon ='mrhud.dmi'
icon_state ="guildsay"
layer = MOB_LAYER+50
New(client/C)
screen_loc ="8,1"
C.screen +=src
//rest button
rest
name="Naruto - Academy"
icon ='mrhud.dmi'
icon_state ="rest"
layer = MOB_LAYER+50
New(client/C)
screen_loc ="9,1"
C.screen +=src
//privatemsg button
privatemsg
name="Naruto - Academy"
icon ='mrhud.dmi'
icon_state ="privatemsg"
layer = MOB_LAYER+50
New(client/C)
screen_loc ="7,1"
C.screen +=src
//who button
who
name="Naruto - Academy"
icon ='mrhud.dmi'
icon_state ="who"
layer = MOB_LAYER+50
New(client/C)
screen_loc ="10,1"
C.screen +=src
Click()
usr.Who()
//worldsay button
worldsay
name="Naruto - Academy"
icon ='mrhud.dmi'
icon_state ="worldsay"
layer = MOB_LAYER+50
New(client/C)
screen_loc ="5,1"
C.screen +=src
//website button
website
name="Naruto - Academy"
icon ='mrhud.dmi'
icon_state ="website"
layer = MOB_LAYER+50
New(client/C)
screen_loc ="5,1"
C.screen +=src
Click()
usr<<usr.website()
// end of buttons
Problem description:
I am trying to make the hud basicly,and i just started coding stuff, well the problem is that whatever button i put in the end (like in this case the website button is at the end) takes over all of the other buttons actions.
I usually do php so there might be many errors in this crap :(
I am thinking >
+ this happen b/c i didn't gave all of the button action yet
PLEASE HELP :(
As it stands, your Click()s are all obj/hud/Click(). If they were 1 tab further over to the right, they'd be obj/hud/save/Click(), obj/hud/website/Click(), and such. That way each Click() would belong to only its own hud object, instead of to all hud objects in the world, like you have now.