ID:149608
 
Awkwardly this code snippet does not work
verb
say(msg as text)
set name = "Talk"
view() << "[name] says, [msg]"
for(var/obj/electronics/messagenet/O in oview())
for(var/obj/electronics/messagenet/M in world)
M.view() << "[name] says over the MessageNet, [msg]"
Rewrite!

mob/verb/Say(msg as text)
view() << "[name] says [msg]"
var/messagenet = 0
for(var/obj/electronics/messagenet/O in oview())
messagenet = 1
break
if(messagenet)
for(var/obj/electronics/messagenet/M in world)
oview(M) << "[name] says over the MessageNet, [msg]"
No, that probably doesn't help, but I felt like doing it anyway.
Exadv1 wrote:
Awkwardly this code snippet does not work
> verb
> say(msg as text)
> set name = "Talk"
> view() << "[name] says, [msg]"
> for(var/obj/electronics/messagenet/O in oview())
> for(var/obj/electronics/messagenet/M in world)
> M.view() << "[name] says over the MessageNet, [msg]"
>

Not sure if it's the only thing, but your last line should have view(M), not M.view()
In response to Skysaw (#2)
I am using Skysaw's traps and that line does not work correctly. It gives a warning.
mob
var
walkwalls
turf
var/trapped = FALSE // by default turfs are not trapped
Entered()
if(trapped) // the var "trapped" is set by obj/trap/verb/set_trap() below
trigger_traps()
..()

proc/trigger_traps()
var/obj/trap/T
for (T in view(0)) // all traps at this location
if (!(T in usr.contents)) // ...but not in your inventory
T.trigger() // tell the trap to do its stuff!

obj/trap
var/x_image // the image of the placed trap
var/placer
icon = 'trap.dmi'
icon_state = "idle"
verb
set_trap()
set src in usr.contents
loc = usr.loc
invisibility = 30 // make the trap invisible
usr << "Trap set..." << Here
icon = "activated"
placer = usr
x_image = image ('x.dmi', src) // assign the placed trap image
usr << x_image // let only the user see the "X"
for(var/mob/player/M in world)
if(M.team == usr.team)
M << x_image
loc:trapped = TRUE // now we tell the turf it is trapped
Detrap()
set src in oview(1)
detrap()
icon_state = "idle"

proc/trigger() // default trap trigger proc deactivates the trap
loc:trapped = FALSE // the area is no longer trapped
del(x_image) // delete the overlay icon
del(src)
proc/detrap()
loc:trapped = FALSE // the area is no longer trapped
del(x_image) // delete the overlay icon
invisibility = 0

chemical_trap // define as many different types of traps as you want
trigger()
usr << "Ouch! Hydrochloric acid!!"
..() // call parent proc to deactivate the trap

explosive_trap
trigger()
usr << "Oops! You are glued in place!"
// glue code goes here
..() // call parent proc
obj
traps
icon = 'dispenser.dmi'
density = 1
verb
dispense_explosive()
set src in oview(1)
var/obj/O = new/obj/trap/explosive_trap
O.Move(usr)
dispense_chemical()
set src in oview(1)
var/obj/O = new/obj/trap/chemical_trap
O.Move(usr)
In response to Exadv1 (#3)
Exadv1 wrote:
I am using Skysaw's traps and that line does not work correctly. It gives a warning.

Which line is not working? And how is the traps snippet related to your original post? I don't understand.

As a side note, skysaw.traps was a library I released last July, after I had just picked up some BYOND coding. It has not been modified since, and may not work well with changes to BYOND since then.