slotmode
mouse_opacity = 1
icon = 'buttons.dmi'
icon_state = "slot"
New(client/c)
screen_loc="2,3"
c.screen+=src
Click()
set src in usr.client.screen
usr << "<font=yellow><b>You are now in slot mode.</b></font>"
usr.mousemode = "slot"
interactmode
mouse_opacity = 1
icon = 'buttons.dmi'
icon_state = "interact"
New(client/c)
screen_loc="1,3"
c.screen+=src
Click()
set src in usr.client.screen
usr << "<font=yellow><b>You are now in slot mode.</b></font>"
usr.mousemode = "slot"
mob/proc
updateHealth()
var/percent=round(src.HP.value/src.HP.max*100,5)
if(percent>100) percent=100
if(percent<0) percent=0
for(var/obj/hudMeters/health/o in src.client.screen)
o.icon_state="[num2text(percent)]"
spawn(10)
src.updateHealth()
updateMana()
var/percent=round(src.MP.value/src.MP.max*100,5)
if(percent>100) percent=100
if(percent<0) percent=0
for(var/obj/hudMeters/mana/o in src.client.screen)
o.icon_state="[num2text(percent)]"
spawn(10)
src.updateMana()
Problem description:
When I click on my "slotmode" or "interactmode" buttons, I receive this runtime error:
runtime error: Cannot read null.screen
proc name: updateHealth (/mob/proc/updateHealth)
usr: GamerMania (/mob)
src: GamerMania (/mob)
call stack:
GamerMania (/mob): updateHealth()
GamerMania (/mob): updateHealth()
runtime error: Cannot read null.screen
proc name: updateMana (/mob/proc/updateMana)
usr: GamerMania (/mob)
src: GamerMania (/mob)
call stack:
GamerMania (/mob): updateMana()
GamerMania (/mob): updateMana()
Also, you don't really need to do set src in usr.client.screen under Click(). Unless you have some ulterior motive that I am oblivious to.