ID:148845
 
OK, Im not that good at coding and The Blue book says nuthing bout HUD and Myne wont work here it is.

obj
New(client/C) //define the New proc for objs
C.screen += src //add the object to your screen
..() //perform default New stuff

stars1
icon='stars.dmi'
layer=MOB_LAYER+2
screen_loc="5,12"
if (usr.wanted >= 0)
src.icon_state = "wanted"
else
src.icon_state = ""

stars2
icon='stars.dmi'
layer=MOB_LAYER+2
screen_loc="6,12"
if (usr.wanted >= 1)
src.icon_state = "wanted"
else
src.icon_state = ""

stars3
icon='stars.dmi'
layer=MOB_LAYER+2
screen_loc="7,12"
if (usr.wanted >= 2)
src.icon_state = "wanted"
else
src.icon_state = ""

stars4
icon='stars.dmi'
layer=MOB_LAYER+2
screen_loc="8,12"
if (usr.wanted >= 3)
src.icon_state = "wanted"
else
src.icon_state = ""

stars5
icon='stars.dmi'
layer=MOB_LAYER+2
screen_loc="9,12"
if (usr.wanted >= 4)
src.icon_state = "wanted"
else
src.icon_state = ""

stars6
icon='stars.dmi'
layer=MOB_LAYER+2
screen_loc="10,12"
if (usr.wanted == 6)
src.icon_state = "wanted"
else
src.icon_state = ""

mob
Login()
..()
new /obj/stars1(client)
new /obj/stars2(client)
new /obj/stars3(client)
new /obj/stars4(client)
new /obj/stars5(client)
new /obj/stars6(client)
..()

HEre are the Errors:
DM\HUD.dm:10:error:usr.wanted:duplicate definition
DM\HUD.dm:10:error:0:duplicate definition
DM\HUD.dm:10:error:>= :instruction not allowed here
DM\HUD.dm:10:error::empty type name (indentation error?)
DM\HUD.dm:11:error:src.icon_state:undefined var
DM\HUD.dm:11:error::empty type name (indentation error?)
DM\HUD.dm:13:error:src.icon_state:undefined var
DM\HUD.dm:19:error:usr.wanted:duplicate definition
DM\HUD.dm:19:error:1:duplicate definition
DM\HUD.dm:19:error:>= :instruction not allowed here
DM\HUD.dm:19:error::empty type name (indentation error?)
DM\HUD.dm:20:error:src.icon_state:undefined var
DM\HUD.dm:20:error::empty type name (indentation error?)
DM\HUD.dm:22:error:src.icon_state:undefined var
DM\HUD.dm:28:error:usr.wanted:duplicate definition
DM\HUD.dm:28:error:2:duplicate definition
DM\HUD.dm:28:error:>= :instruction not allowed here
DM\HUD.dm:28:error::empty type name (indentation error?)
DM\HUD.dm:29:error:src.icon_state:undefined var
DM\HUD.dm:29:error::empty type name (indentation error?)
DM\HUD.dm:31:error:src.icon_state:undefined var
DM\HUD.dm:37:error:usr.wanted:duplicate definition
DM\HUD.dm:37:error:3:duplicate definition
DM\HUD.dm:37:error:>= :instruction not allowed here
DM\HUD.dm:37:error::empty type name (indentation error?)
DM\HUD.dm:38:error:src.icon_state:undefined var
DM\HUD.dm:38:error::empty type name (indentation error?)
DM\HUD.dm:40:error:src.icon_state:undefined var
DM\HUD.dm:46:error:usr.wanted:duplicate definition
DM\HUD.dm:46:error:4:duplicate definition
DM\HUD.dm:46:error:>= :instruction not allowed here
DM\HUD.dm:46:error::empty type name (indentation error?)
DM\HUD.dm:47:error:src.icon_state:undefined var
DM\HUD.dm:47:error::empty type name (indentation error?)
DM\HUD.dm:49:error:src.icon_state:undefined var
DM\HUD.dm:55:error:usr.wanted:duplicate definition
DM\HUD.dm:55:error:6:duplicate definition
DM\HUD.dm:55:error:== :instruction not allowed here
DM\HUD.dm:55:error::empty type name (indentation error?)
DM\HUD.dm:56:error:src.icon_state:undefined var
DM\HUD.dm:56:error::empty type name (indentation error?)
DM\HUD.dm:58:error:src.icon_state:undefined var

Thank you to whoever can help me
You have code outside of procs listed where there should only be vars. If you are going to initialize something to values which are not constant, such as when you check the wanted var to initialize the icon_state differently, do it inside a proc such as New().

Don't use usr in procs. In most cases it is not defined. It is best to avoid it whenever possible. If the screen objects are being sent a client, you may check the client's mob var. If the wanted var is a property of the client, use the client that was passed in. (The usr var is a mob.)
In response to ACWraith
COuld some one show me how to do what he said?
Charlesisdapimp wrote:

obj
New(client/C) //define the New proc for objs
C.screen += src //add the object to your screen
..() //perform default New stuff

stars1
icon='stars.dmi'
layer=MOB_LAYER+2
screen_loc="5,12"
it should be like i think
obj
stars1
icon='stars.dmi'
layer=MOB_LAYER+2
if (usr.wanted >= 0)
src.icon_state = "wanted"
else
src.icon_state = ""
New(client/C)
screen_loc="5,12"
C.screen += src


you must do that to the rest of them too
In response to Charlesisdapimp
Charlesisdapimp wrote:
COuld some one show me how to do what he said?

Maybe he meant this (which is my solution):

obj
New(client/C) //define the New proc for objs
C.screen += src //add the object to your screen
..() //perform default New stuff

stars1
icon='stars.dmi'
layer=MOB_LAYER+2
screen_loc="5,12"

Click()
if (usr.wanted >= 0)
src.icon_state = "wanted"
else
src.icon_state = ""


Obviously not the ideal soultion, but I don't think you can't change it in real time without a seperate proc.
In response to Da_Rushyo
Close. The original code looked like it was trying to initialize the hud object when it was created. I was suggesting using the derived New procs.

The problem is, considering the rather fundamental mistakes that were made, I can't tell if wanted is a var for mob or client. The usr var is a mob, but Charlesisdapimp might not have known that when he wrote it so I can't go on that information.

The following is an example. (I took out the "" icon_state assignment because the icon_state is "" by default.)

obj/stars1
icon='stars.dmi'
layer=MOB_LAYER+2
screen_loc="5,12"

// If the wanted var is for /mob, use this.
New(client/C)
if ( !isnull(C) && !isnull(C.mob) && (C.mob.wanted >= 0) )
src.icon_state = "wanted"
..(C)

/*
// If the wanted var is for /client, use this.
New(client/C)
if ( !isnull(C) && (C.wanted >= 0) )
src.icon_state = "wanted"
..(C)
*/


PS: Heh, you just had to use a proc where usr works to confuse those who don't understand the usr var, didn't you? ;)
In response to ACWraith
PS: Heh, you just had to use a proc where usr works to confuse those who don't understand the usr var, didn't you? ;)

I don't see what the confusion is :)
In response to ACWraith
ACWraith wrote:
PS: Heh, you just had to use a proc where usr works to confuse those who don't understand the usr var, didn't you? ;)

Technically Click() is a verb.

Lummox JR
Charlesisdapimp wrote:
OK, Im not that good at coding and The Blue book says nuthing bout HUD and Myne wont work here it is.

Just a note here: The reason HUDs aren't mentioned in the Blue Book is that they're a feature created during the string of betas that led up to... what was it, 314, 316? One of those. The Blue Book predates version 300, I believe.

Lummox JR
In response to Lummox JR
Lummox JR wrote:
ACWraith wrote:
PS: Heh, you just had to use a proc where usr works to confuse those who don't understand the usr var, didn't you? ;)

Technically Click() is a verb.

I know the way in which Click() operates. However, if someone does not understand usr, they are probably not going to understand how Click() is different when the helpfiles straight out tell them it's a "proc".