ID:162989
 
i'm relatively new at coding and trying to make it to where when write a name in the obj 'death note' and its an npc, a random npc dies, but if its a key name the key dies and outputs the text
"[usr/npc] has died from a mysterious heart attack"
however if its misspelled or something then it says "odd, nothing happened."

Heres how i've been trying to write it tried to write it:
    Deathnote
icon = 'deathnote.dmi'
verb
read()
set src in view(1)
usr << "Death Note: The name of the human who's name is written in this book shall die."
write(msg as text)
set src in view(1)
usr << "you write a name in the death note"
if (msg = bug)
Del(mob/bug)
world << "M has died of a mysterious heart attack"
other
usr << "odd, nothing happened"


naturally it didnt work and idk what im doing wrong, HELP PLEASE!!! i keep getting:
error 58: undefined var
error 59: undefined var
and a couple other errors like that
First of all, your code is indented wrong under the
usr << "you write a name in the death note"


Then you need two "="s if you're checking something in an if() statement. M in
world << "M has died of a mysterious heart attack"

Should be in brackets.

The main problem is "bug" doesn't exist as a variable.
In response to Kaiochao2536
Okay, so how do i make 'bug' a variabe while still having an effect on the mob? seems to me like thats a long and complicated process.... or is there a way to shorten it?
In response to Akuheis
First, what is "bug"?
In response to Kaiochao2536
oh, sorry, Thats my NPC monser.
In response to Akuheis
    Deathnote
icon = 'deathnote.dmi'
verb
read()
set src in view(1)
usr << "Death Note: The name of the human who's name is written in this book shall die." //Redundant, much?
write(msg as text)
set src in view(1)
src<<"You write a name in the death note"
for(var/mob/M in world)
if(M.key==msg)
world << "[M] has died of a mysterious heart attack"
return
src<<"Odd, nothing happened."

Hmm...
                    other  //What the heck is an other? 
usr << "odd, nothing happened"
In response to Kaiochao2536
umm.... i dont get it what r u saying?
In response to Akuheis
Well actually what I wrote kills everyone in the game... I'll fix that :/

My brain has left the building.
In response to Kaiochao2536
oh ok, i was wondering what that was, thanks a bunch!
In response to Akuheis
it didnt work... it compiled fine but when i wrote 'bug' nothing happened.