ID:145144
 
Code:
obj
var/unlocked = 0
Godly_Sword
price = 300
if(unlocked == 1)
name = "Godly_Sword"
icon_state = "Godly"
weapon_strength = 20
else
name = "average_Sword"
icon_state = "average"
weapon_strength = 10


if won't work in the obj was wondering if this was just a problem with byond it'self or an error.

I have about 5 errors come up with it and i don't see anything wrong.


1) Indent var/unlocked = 0 as where it is placed currently make it's as the tree rather than obj

2) Umm, in name = "Godly_Sword", you don't need the _ there for a space, this'll make the _ actually show up since it's a text (that is if you intended to have it be a space)

3) I am pretty sure that the whole
if(unlocked == 1)
name = "Godly_Sword"
icon_state = "Godly"
weapon_strength = 20
else
name = "average_Sword"
icon_state = "average"
weapon_strength = 10
should be under a new proc when it is created, like:
        New(loca,unlocked)//loca=location.... cuz I feel like messing you up
..()
if(unlocked)//<--reason for this
name = "Godly_Sword"
icon_state = "Godly"
weapon_strength = 20
else
name = "average_Sword"
icon_state = "average"
weapon_strength = 10
src.Move(loca)

4) The reason stated in #3 is found <a href=http://bwicki.byond.com/ByondBwicki.dmb?TrueFalse>here</a>. I suggest you try reading it, it may give you a very useful tip.

5) It would help a lot if you copy/pasted the errors >.>

- GhostAnime
In response to GhostAnime
right copy and paste error's i'll try to remember that next time...


well i couldn't indent in the whole dm thing i was actually rewriting the relevant parts of the code so the indentation of Var and everything is actually correct.. it posted before i could stop it. Edited again but could fix it.

Thanks for the _ tip didn't know.

and thanks for the tip in #3 i'll check it out.


although using a proc for an object and the whole loca.. location thing messed me up.. i fixed the true false part though took care of 6 errors.

So thanks for that advice, but i am confused.

this is what it looks like after i fixed the True and false part.
        Godly_Sword
price = 300
if(src.unlocked)
name = "Godly_Sword"
icon_state = "Godly"
weapon_strength = 20
else
name = "average_Sword"
icon_state = "average"
weapon_strength = 10

tried commenting this part and using your code but i'm really not sure how to work with it. I'm just not all that experienced with some things in byond locations in procs that are for objects happen to be one of them.
In response to Ronincyanide
Godly_Sword
price = 300
New()
..()
if(src.unlocked)
name = "Godly_Sword"
icon_state = "Godly"
weapon_strength = 20
else
name = "average_Sword"
icon_state = "average"
weapon_strength = 10

You missed the whole thing about New(). Not sure if that will work as I haven't tested it myself, just adding what you missed. I don't know if this will work anyways since it only checks if the item is unlocked when it is created, unless you create another instance of it.
In response to Exophus
Ah! I just had an epiphany about what Rinun wanted *bangs his head*

If you want the sword to change after doing some sort of event or something instead of it happening at it's initial creation (which was the whole thing I posted the New() proc was about), I suggest you make another proc which can be called through special conditions... eg:
Godly_Sword
price = 300
name = "average_Sword"
icon_state = "average"
weapon_strength = 10
proc/Unlock()
if(unlocked)return//just a safety check
name = "Godly_Sword"
icon_state = "Godly"
weapon_strength = 20
unlocked=1


I am pretty sure you can find some way of modifying this into what you want

- GhostAnime

PS: Thanks Exophus for that delightful post that caused the epiphany
In response to GhostAnime
GhostAnime wrote:
Ah! I just had an epiphany about what Rinun wanted *bangs his head*

If you want the sword to change after doing some sort of event or something instead of it happening at it's initial creation (which was the whole thing I posted the New() proc was about), I suggest you make another proc which can be called through special conditions... eg:
> Godly_Sword
> price = 300
> name = "average_Sword"
> icon_state = "average"
> weapon_strength = 10
> proc/Unlock()
> if(unlocked)return//just a safety check
> name = "Godly_Sword"
> icon_state = "Godly"
> weapon_strength = 20
> unlocked=1
>

I am pretty sure you can find some way of modifying this into what you want

- GhostAnime

PS: Thanks Exophus for that delightful post that caused the epiphany

YES THATS EXACTLY WHAT I WANT!! and it makes sence to! then again so did my code... i'll have to test this out but i believe this will work.

Thanks, didn't realize i didn't make all that much sence but i'm glad you figured it out. If i had a cookie it would be yours.

Not sure how to acess the proc but i'll find a way!