ID:263728
 
Please be original in your coding and don't take mine without asking first. D:

Code:
verb/Write_in_Notebook()
set category = "Fighting"
var/T = input("Who's name would you like to write down?")
if(!T)return
for(var/mob/M in world)
var/mob/M
if(T=="[M]")
var/deathreason=input("How would you like to kill [M]?")
usr<<"You have 40 seconds until [M] is judged."
view(8)<<"<font color=red><b>[usr] scribbles something in a strange notebook."
spawn(400)
M.hp-=M.maxhp+1
if(M.client)
M.DeathCheck()
if(M.dead==1)
world<<"<b><font size=2><font color = red>[M] has been killed [deathreason]."
M.Respawn()
else if(M.hp<=0)
usr.exp+=M.level*5
usr.yen+=M.level*5
else
view(8)<<"<font color=red><b>[usr] scribbles something in a strange notebook."
sleep(400)
usr<<"40 seconds pass as you wonder why nobody has died yet."


Problem description:

It won't kill anybody. No matter what you write down in the notebook, it just goes to the last line saying 40 seconds pass. I don't know what I'm doing wrong, and any help would be much appreciated. <3
verb/Write_in_Notebook()
set category = "Fighting"
var/T = input("Who's name would you like to write down?")
if(!T)return
var/mob/found
for(var/mob/M in world)
if(M.name==T)
found = M
break
if(found)
var/deathreason=input("How would you like to kill [M]?")
usr<<"You have 40 seconds until [M] is judged."
view(8)<<"<font color=red><b>[usr] scribbles something in a strange notebook."
spawn(400)
M.hp-=M.maxhp+1
if(M.client)
M.DeathCheck()
if(M.dead==1)
world<<"<b><font size=2><font color = red>[M] has been killed [deathreason]."
M.Respawn()
else if(M.hp<=0)
usr.exp+=M.level*5
usr.yen+=M.level*5
else
view(8)<<"<font color=red><b>[usr] scribbles something in a strange notebook."
sleep(400)
usr<<"40 seconds pass as you wonder why nobody has died yet."
In response to Ter13
EDIT: It doesn't work. The input was showing up now, but it said M was undefined, so I switched the M's to found, and the name showed up, except it didn't do anything... It's probably something really simple I'm missing, but I'm a bit new to coding so I'm just not seeing it =\
In response to Aaiske Drew
This is how I would do a death note verb, it's easily editable.

mob
verb
Death_Note()
set category="Fighting"
var/ID=input("What do you wish to write in the note?")as text
var/choice=input("Do you want to specify a death?")in list("Yes","No")
switch(choice)
if("Yes")
var/reason=input("How do you want them to die?")as text
for(var/mob/M in world)
if(ID == M.name)
view(usr)<<"[usr] writes something onto his death note."
sleep(400)
M.DeathCheck()
world<<"[M] has died due to [reason]"
if("No")
for(var/mob/M in world)
if(ID == M.name)
view(usr)<<"[usr] writes something onto his death note."
sleep(400)
M.DeathCheck()
world<<"[M] has died of a heart attack!"
In response to Scizzees
Now it won't kill the person, XD! I think I screwed something up. I had your code mixed with my death/respawn code, and edited the text of it a bit. It won't let me enter a blank name or someone that's not logged on, but it won't kill the person I put down. D:
In response to Aaiske Drew
Show the current code as it is now..
In response to Scizzees
obj
DeathNote
icon='Extras.dmi'
icon_state="Death Note"
density=0
name="Death Note"
getable=0
verb/Write_in_Notebook()
set category = "Fighting"
usr<<"<b>You open the Death Note."
var/P = input("Who's name would you like to judge?")
if(!P)
usr<<"<b>You can't think of someone to judge, so you close the notebook"
return
var/choice=input("Would you like to specify how they die?")in list("Yes","No")
switch(choice)
if("Yes")
var/deathreason=input("How would you like to kill them?")as text
for(var/mob/M in world)
if(P == M.name)
usr<<"You have 40 seconds until [M] is judged."
view(8)<<"<font color=red><b>[usr] scribbles something in a strange notebook."
spawn(400)
M.hp-=M.maxhp+1
if(M.client)
M.DeathCheck()
if(M.dead==1)
world<<"<b><font size=2><font color = red>[M] has been [deathreason]."
M.Respawn()
else if(M.hp<=0)
usr.exp+=M.level*5
usr.yen+=M.level*5
if("No")
for(var/mob/M in world)
if(P == M.name)
usr<<"You have 40 seconds until [M] is judged."
view(8)<<"<font color=red><b>[usr] scribbles something in a strange notebook."
spawn(400)
M.hp-=M.maxhp+1
if(M.client)
M.DeathCheck()
if(M.dead==1)
world<<"<b><font size=2><font color = red>[M] died of a Heart Attack."
M.Respawn()
else if(M.hp<=0)
usr.exp+=M.level*5
usr.yen+=M.level*5
In response to Aaiske Drew
that code looks fine to me, Are you writing down the name exacly how it looks? with capital letters, and it wont let you cancel if you leave the field blank?
In response to Scizzees
It lets me cancel if the field is blank, but the person who's name is written won't die. I've spelt it using the correct capitals and whatnot, because it shows what I typed when it says "You have 40 seconds until xxx is judged". It's confusing me! D: Should I use sleep instead of spawn while waiting those 40 seconds?

EDIT: Yeah, changing the spawn to sleep made it work. Don't know how exactly, but it did o-o
In response to Aaiske Drew
use sleep(400) not spawn.

btw why dont you do M.hp = 0 instead of M.hp-=M.maxhp+1
In response to Scizzees
I had some problems with my attack code earlier and it seemed to fix it, so when I do an attack that's supposed to instantly kill them, that's what I do now. Just seems like it's more safe to me. XD
In response to Scizzees
Actually.... if he indents properly, he can still use spawn.
In response to Aaiske Drew
Show us your death check code.
In response to Ter13
Here's my Death Check o-o
DeathCheck()
if(src.hp<=0)
src.dead = 1
src.yen-=yen/2


I use it in attacks so it'll respawn players, but delete the NPC's.
In response to Aaiske Drew
All it does is set dead to 1. Where are you actually handling the death?
In response to Ter13
In my attack verb? Right towards the end.
mob
verb
Attack(mob/M in get_step(usr,usr.dir))
set category="Fighting"
if(usr.attacking == 0 & usr.hide==0 & usr.rest==0)
if(!M || !ismob(M))return
if(usr.safe==1)
usr<<"<b>You're in a safe zone!"
return
usr.attacking = 1
usr.awesomeness-=1
usr.strength-=rand(1,3)
usr.state="Attack"
flick("[usr.state]",usr)
var/damage = usr.strength-M.strength/5
if(damage <= 0)
view(8)<<"<b><FONT COLOR=Yellow>[usr]'s attack fails to even scratch [M]!"
sleep(7)
usr.attacking=0
return
if(usr.spartan==0)
usr<<"<b><FONT COLOR=Yellow>You headbutt [M]!"
M<<"<b><FONT COLOR=Yellow>[src] headbutts you for [damage]!"
else if(usr.spartan==1)
usr.strength-=rand(1,2)
usr<<"<b><FONT COLOR=Yellow>You slash [M]!"
M<<"<b><FONT COLOR=Yellow>[src] slashes you with their spear for [damage]!"
M.hp -= damage
if(!M)return
if(M.client)
M.DeathCheck() //Here
if(M.dead==1)
usr.yen += M.level*5
usr.killcount++
usr.CheckLevel()
world<<"<b><font size=2><font color=red>[M] has been killed by [usr]!"
M.Respawn()
else
if(M.hp <= 0)
usr.yen += M.level*10
usr.exp += M.level*5
del(M)
usr.CheckLevel()
if(usr.attacking==1)
sleep(7)
usr.attacking=0
return

Not sure if there's an easier way to have it done, but it works.
In response to Aaiske Drew
You should handle all deaths and stuff in deathcheck() not the attack verb...
In response to Scizzees
Yeah, but I'm a nooblet at coding so it's easier for me this way =\
In response to Aaiske Productions
Sorry for going off topic, but I want to play your game just so I can kill someone by Testicular Cancer.