ID:139627
 
Code:
mob/proc
update_equipment()
var/I
for(I in usr.contents)
if(I.isequipped == 1)
if(I.equip_slot == "Weapon")
usr << output(I, "Weapon:1,1")
else if (I.equip_slot == "Shield")
usr << output(I, "Shield:1,1")
else if (I.equip_slot == "Armor")
usr << output(I, "Armor:1,1")
else if (I.equip_slot == "Ring")
usr << output(I, "Ring:1,1")
else if (I.equip_slot == "Necklace")
usr << output(I, "Necklace:1,1")
else if (I.equip_slot == "Gloves")
usr << output(I, "Gloves:1,1")
else if (I.equip_slot == "Legs")
usr << output(I, "Legs:1,1")
else if (I.equip_slot == "Boots")
usr << output(I, "Boots:1,1")
else if (I.equip_slot == "Waist")
usr << output(I, "Waist:1,1")
else if (I.equip_slot == "Arms")
usr << output(I, "Arms:1,1")
else if (I.equip_slot == "Back")
usr << output(I, "Back:1,1")
else return
obj/equipment
var
equip_slot
isequipped = 0


Problem description:Alright it is giving 13 errors:
GameStarter.dm:72:error: I.isequipped: undefined var
GameStarter.dm:73:error: I.equip_slot: undefined var
GameStarter.dm:75:error: I.equip_slot: undefined var
GameStarter.dm:77:error: I.equip_slot: undefined var
GameStarter.dm:79:error: I.equip_slot: undefined var
GameStarter.dm:81:error: I.equip_slot: undefined var
GameStarter.dm:83:error: I.equip_slot: undefined var
GameStarter.dm:85:error: I.equip_slot: undefined var
GameStarter.dm:87:error: I.equip_slot: undefined var
GameStarter.dm:89:error: I.equip_slot: undefined var
GameStarter.dm:91:error: I.equip_slot: undefined var
GameStarter.dm:93:error: I.equip_slot: undefined var
GameStarter.dm:369:error: update_equipment: undefined proc

Even though i have defined both 'isequipped' and 'equip_slot' as var's, the bottom error is i think because the proc has errors in it, so it is just a byproduct of the other errors.


Try var/obj/equipment/I. You're not even searching for anything, just a variable. The variable equipt_slot is under that object, silly.

Also, you shouldn't be using Text Strings ("") for variables, instead you should be using numbers, with comments for what each one does. Or, you can use the #define macro as such:

#define shield 1 //essentially have shield be the value 1.


Another thing, what's with that huge else if list to update your equipment? I'm sure you can come up with a more efficient way.
In response to OrangeWeapons
I have to loop through each body part because i can't use a varible for the grid ID using output, otherwise i wouldn't have any errors, and this would be shorter.

The problem is my var's are defined, yet the compiler is saying they are not, is there something wrong syntax wise, or is something in the wrong spot, or am i just totally ignorant :/
In response to Wolfnova
Did you read what I posted?...
In response to OrangeWeapons
Yes, but that is not the problem, the problem is a var is defined and yet the compiler says it is not. although, i prefer text strings to numbers anyways, i hate numbers meaning words :/
In response to Wolfnova
Before
var/I


After
var/obj/equipment/I
In response to Wolfnova
You're using text strings improperly, and still didn't use my suggested advice.

mob/proc
update_equipment()
var/obj/equipment/I //USE THIS HERE, NOT VAR/I
for(I in usr.contents)
if(I.isequipped == 1)
if(I.equip_slot == "Weapon")
usr << output(I, "Weapon:1,1")
else if (I.equip_slot == "Shield")
usr << output(I, "Shield:1,1")
else if (I.equip_slot == "Armor")
usr << output(I, "Armor:1,1")
else if (I.equip_slot == "Ring")
usr << output(I, "Ring:1,1")
else if (I.equip_slot == "Necklace")
usr << output(I, "Necklace:1,1")
else if (I.equip_slot == "Gloves")
usr << output(I, "Gloves:1,1")
else if (I.equip_slot == "Legs")
usr << output(I, "Legs:1,1")
else if (I.equip_slot == "Boots")
usr << output(I, "Boots:1,1")
else if (I.equip_slot == "Waist")
usr << output(I, "Waist:1,1")
else if (I.equip_slot == "Arms")
usr << output(I, "Arms:1,1")
else if (I.equip_slot == "Back")
usr << output(I, "Back:1,1")
else return
obj/equipment
var
equip_slot
isequipped = 0
In response to Wolfnova
Wolfnova wrote:
Yes, but that is not the problem, the problem is a var is defined and yet the compiler says it is not.

Never assume the compiler is wrong. The compiler is the one that SAYS what's right and wrong. If you disagree with the compiler, the one who is wrong will always be you.
In response to Garthor
Garthor wrote:
Wolfnova wrote:
Yes, but that is not the problem, the problem is a var is defined and yet the compiler says it is not.

Never assume the compiler is wrong. The compiler is the one that SAYS what's right and wrong. If you disagree with the compiler, the one who is wrong will always be you.

Thank you garthor for at least replying, also, i didn't say the compiler is wrong, i merely stated it is saying i didn't define when i did, i am wondering what i did wrong to make it say that.
In response to OrangeWeapons
Ah, thanks, next time i will remembr var has to be specific, i should have though about that, but alas i didn't, i thought it was the fact compiler didn't know 'something' was for equipment, but i though it was the other vars, not var/I, thanks alot.