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..
ID:173109
![]() Feb 16 2004, 10:12 am
|
|
![]() Feb 16 2004, 10:20 am
|
|
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.
|
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 |
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! |
N649po wrote:
Don't feel stupid... I've made far more obvious mistakes in my relatively short coding career... :) 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. |
Goku72 wrote:
AHHH! 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. |