ID:145099
 
Code:
obj
hud
buttons
icon='hud buttons.dmi'
icon_state="button"
var/val
New(client/C)
C.mob.buttons++ // Here.
src.overlays+=icon('hud buttons.dmi',"[C.mob.buttons]")
src.val=C.mob.buttons
C.screen+=src
var/pos=8+C.mob.buttons
src.screen_loc="2,[pos]"
if(C.mob.buttons<=4) new /obj/hud/buttons(src)
else C.mob.buttons=null


Problem description:
runtime error: undefined variable /obj/hud/buttons/var/mob proc name: New (/obj/hud/buttons/New) source file: Battle System.dm,164 usr: Nishiatsu (/mob/Player/White) src: the buttons (/obj/hud/buttons) call stack: the buttons (/obj/hud/buttons): New(the buttons (/obj/hud/buttons)) the buttons (/obj/hud/buttons): New(Mysame (/client)) Mysame (/mob/Player/White): begin fight(Mysame (/mob/Player/White)) Nishiatsu (/mob/Player/White): Challenge(Mysame (/mob/Player/White))

You're calling it wrong. How are you calling New()?
put <code>ASSERT(istype(C))</code> at the beginning of New, and tell me what happens.
In response to PirateHead (#2)
<code>Battle System.dm:165:error::invalid expression </code>
            New(client/C)
ASSERT(istype(C))
C.mob.buttons++ // Line 165
src.overlays+=icon('hud buttons.dmi',"[C.mob.buttons]")
src.val=C.mob.buttons
C.screen+=src
var/pos=8+C.mob.buttons
src.screen_loc="2,[pos]"
if(C.mob.buttons<=4) new /obj/hud/buttons(src)
else C.mob.buttons=null


How I call it;

mob
var
mob/target
count
verb
Challenge(mob/Player/m in oview())
switch(input(m,"[usr] challenges you. Accept?","Challenge","Yes","No"))
if("Yes")
usr.target=m
m.target=usr
m.client.canmove=0
usr.client.canmove=0
new /obj/hud/blank(src.client)
new /obj/hud/blank(m.client)
new /obj/hud/buttons(src.client)
new /obj/hud/buttons(m.client)
var/beginner=pick(m,usr)
m.begin_fight(beginner)

In response to Mysame (#3)
You don't indent under ASSERT().

And it should be istype(c,/client), I believe.

In response to Jp (#4)
Nah, if you defined what C is, just istype(C) is enough.

I placed it at login, because else I needed another player to test it out on. Anyway;
<code> runtime error: Battle System.dm:164:Assertion Failed: istype(C) proc name: New (/obj/hud/buttons/New) source file: Battle System.dm,164 usr: Choosin (/mob/ppp/Choosin) src: the buttons (/obj/hud/buttons) call stack: the buttons (/obj/hud/buttons): New(the buttons (/obj/hud/buttons)) the buttons (/obj/hud/buttons): New(Mysame (/client)) Choosin (/mob/ppp/Choosin): Login()</code>


AAAAH. Fixed it. It was so brilliantly simple.

I had;
if(C.mob.buttons<=4) new /obj/hud/buttons(src)


<code>src</code> being the that hud button itself, should've been C!!! UGH!

Thanks.

In response to Mysame (#5)
:-/ Told you to post how you were calling it.
In response to Justin B (#6)
Heyhey, that line was in the first post! o.o;;
In response to Mysame (#7)
:-/ Still. I was right :-)