ID:173109
 
obj
gold
icon = 'gold.dmi'
var
amount
verb
get() //obj/gold/verb/get()
set src in view(0) //src must be close
usr << "You pick up [amount] gold."
usr.gold += amount //add to usr.wealth
del(src) //delete the gold

theres my gold code... Here is my problem, When I go to play the game and actully pick the gold up, this happens - It says you pick up gold and then it adds no gold to the character.. then if you take out the delete src.. you get the gold... so anyone know whats wrong..
did you ever set what amount was?
You haven't set amount anywhere, so it's null, which is treated as "" (nothing) in text, and 0 when doing math. You need to set amount to something.
In response to Majin12345
omg duhhh... thanks
In response to Majinveku
Don't feel stupid... I've made far more obvious mistakes in my relatively short coding career... :)

You know, the ones that keep you banging your head on the keyboard for 3 hours until you finally realize you forgot a semicolon! That's the nice thing about compiled languages though... I wish they had that with every computer program. lol
In response to N649po
I wish that they had little magical leprachauns inside computers, that knew every computer language better than the Guru's (if that is possible!) and could read 200 lines a second! Then, when your code isn't working, you just prod them with the prodding stick and they find the error!

If only...

~Ease~

P.s. Sorry about that, but it would be sooo cool! Lol!
In response to Ease
lol yea thatd be nice..
In response to N649po
N649po wrote:
Don't feel stupid... I've made far more obvious mistakes in my relatively short coding career... :)

You know, the ones that keep you banging your head on the keyboard for 3 hours until you finally realize you forgot a semicolon! That's the nice thing about compiled languages though... I wish they had that with every computer program. lol

AHHH!
Semicolon=Bad
Period=Good

Semicolon only fools the compiler, the actual error is still there. If you're getting a compiler error, don't just plug in, ":". Put a, "." after assigning the correct type path to the variable, proc, or what ever.
In response to Goku72
Goku72 wrote:
AHHH!
Semicolon=Bad
Period=Good

Semicolon only fools the compiler, the actual error is still there. If you're getting a compiler error, don't just plug in, ":". Put a, "." after assigning the correct type path to the variable, proc, or what ever.

Umm..
Semicolon != Colon

Semicolon = Good = ;
Colon = Bad = :

Many languages like C/C++ require you to use semicolons. BYOND allows you to, but doesn't force you to use them.

In response to Jon88
BAH! Sorry, I got them mixed up! >.<
In response to Goku72
Well, that was actually just an example. I wasn't talking about any specific languages, that was more of a comparison saying that you find out that the thing you forgot was something small and (seemingly) insignificant. Thanks for wanting to help anyways though :)