ID:173751
 
I am try o play a sound every time the world repopulates. But I want the use to be able to turn it off. This what I got.

2 verbs one that turns on the sound (sets the var sound to 1) and one thast turns is off (stes the var sound to 0)

FX_sound_on()
usr.Sound = 1
usr << "<B><font size=2 color=red>FX sound on"
FX_sound_off()
usr.Sound = 0
usr << "<B><font size=2 color=red>FX sound off"


Now when I call a sound it is in the form of a proc, an example

mob
proc
sound_flash3()
if(usr.sound)
usr << 'Flash3.wav'

Now, the world repop proc looks likes this.

world
proc

Reload_World()
world.Repop()
world << "A year has passed and the earth has grown back to it's origanal state."
repoping_world = 1
for(var/mob/characters/P in world) P.sound_repop()
for(var/obj/temp/destroyed/T in world) del(T)
spawn(2000) Reload_World()
if(quest > 1)
for(var/mob/monsters/start/Z in world) del(Z)

The line

for(var/mob/characters/P in world) P.sound_repop()

is the problem, I think.

the proc sound_repop is this

mob
proc
sound_repop()
if(usr.sound)
usr << 'repop.wav'
else
..()

When I run it in dream seeker I get the error

runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
usr: null
src: Human (/mob/characters/Human)
call stack:
Human (/mob/characters/Human): sound repop()
: Reload World()
: Start Saga()
Login()
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
usr: null
src: Human (/mob/characters/Human)
call stack:
Human (/mob/characters/Human): sound repop()
: Reload World()
: Start Saga()
Login()
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
usr: null
src: Human (/mob/characters/Human)
call stack:
Human (/mob/characters/Human): sound repop()
: Reload World()
: Start Saga()
Login()
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
usr: null
src: Human (/mob/characters/Human)
call stack:
Human (/mob/characters/Human): sound repop()
: Reload World()
: Start Saga()
Login()
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
usr: null
src: Human (/mob/characters/Human)
call stack:
Human (/mob/characters/Human): sound repop()
: Reload World()
: Start Saga()
Login()
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
usr: null
src: Human (/mob/characters/Human)
call stack:
Human (/mob/characters/Human): sound repop()
: Reload World()
: Start Saga()
Login()
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
usr: null
src: Human (/mob/characters/Human)
call stack:
Human (/mob/characters/Human): sound repop()
: Reload World()
: Start Saga()
Login()
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
usr: null
src: Human (/mob/characters/Human)
call stack:
Human (/mob/characters/Human): sound repop()
: Reload World()
: Start Saga()
Login()
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
usr: null
src: Human (/mob/characters/Human)
call stack:
Human (/mob/characters/Human): sound repop()
: Reload World()
: Start Saga()
Login()
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
usr: null
src: Human (/mob/characters/Human)
call stack:
Human (/mob/characters/Human): sound repop()
: Reload World()
: Start Saga()
Login()
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
usr: null
src: Human (/mob/characters/Human)
call stack:
Human (/mob/characters/Human): sound repop()
: Reload World()
: Start Saga()
Login()
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
usr: null
src: Human (/mob/characters/Human)
call stack:
Human (/mob/characters/Human): sound repop()
: Reload World()
: Start Saga()
Login()
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
usr: null
src: Human (/mob/characters/Human)
call stack:
Human (/mob/characters/Human): sound repop()
: Reload World()
: Start Saga()
Login()
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
usr: null
src: Human (/mob/characters/Human)
call stack:
Human (/mob/characters/Human): sound repop()
: Reload World()
: Start Saga()
Login()
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
usr: null
src: Human (/mob/characters/Human)
call stack:
Human (/mob/characters/Human): sound repop()
: Reload World()
: Start Saga()
Login()
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
usr: null
src: Human (/mob/characters/Human)
call stack:
Human (/mob/characters/Human): sound repop()
: Reload World()
: Start Saga()
Login()
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
usr: null
src: Human (/mob/characters/Human)
call stack:
Human (/mob/characters/Human): sound repop()
: Reload World()
: Start Saga()
Login()
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
usr: null
src: Human (/mob/characters/Human)
call stack:
Human (/mob/characters/Human): sound repop()
: Reload World()
: Start Saga()
Login()
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
usr: null
src: Human (/mob/characters/Human)
call stack:
Human (/mob/characters/Human): sound repop()
: Reload World()
: Start Saga()
Login()
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
runtime error: Cannot read null.Sound
proc name: sound repop (/mob/proc/sound_repop)
A year has passed and the earth has grown back to it's origanal state.

If you need anymore info, just ask. Thanks in advance.
~~TK6000~~
I'm gonna say this before Lummox JR does.

NO USE USR IN PROC! UNGH

I mean, ...

Usr in null, so it can't read it's Sound variable. Remove "usr." from all of the procedures that DO NOT REQUIRE IT.
In response to Yota
And use src instead? I am a little new, so if you could tell me the diff or point me to were I could read about it.

Thanks though.
In response to TK6000
try using client << 'sound.wav' on repop
In response to ZDarkGoku
Alrighty thanks alot. src works though. I really need to find out what the diff is from usr, client, and src. I kinda understand client, but not very well.
In response to TK6000
usr is the mob that is assigned to the user.

mob
verb
text()
usr << "hi"

note that usr is mob

mob
verb
text2()
src << "hi"

src is the mob so it shows "hi" to the one who activates the verb (or the source)

obj
shirt
icon='shirt.dmi'
layer=1
verb
wear()
usr << "you wear the shirt"
usr.overlays += /obj/shirt

this is an object. the src in hear is the obj but the usr is still the mob you assigned to the user.

i think that's all needs to know. its easy after a while.
In response to TK6000
src = The thing with the verb/procedure.
usr = The thing that called the verb/procedure.

Example:
obj/verb/Test()
set src in world
usr << "[usr] used Test() on the [src]"

You see here, this object's verb is usable by anyone. (Because of the first set statement.)
What you are doing when you use the test verb is is calling something that belongs to something else. Src is always that something that you call. In this case, an object. (src is source) Now, whoever uses the verb is always usr. (usr is user) You see?
In response to Yota
so your thing would print out

"username used Test() on the Test"

?
In response to ZDarkGoku
Oh, I understand now. Thanks alot guys.