ID:144005
 
Code:
        ooc(Text as text) // a chatting verb
set category = "Commands"
set desc = "World Say"
if(src.muted==0)
if(src.talkdelay==0)
if(length(Text) < 100)
for(var/client/c in world)
if(Text && usr.ooc == 1 && c.mob.ooc == 1)
c << "<b>[usr] (OOC): [scantext(Text)]"
usr << "<b>[usr] (OOC): [scantext(Text)]"
// world << "<b><font color=orange>[src] (OOC): [scantext(Text)]"
src.talkdelay=1
sleep(10)
src.talkdelay=0
return
else return
else
src << "Sorry, that message is too long."
else
src<<"You can't talk too fast!"
else
src<<"You can't do that!"


Problem description:

Well, it seems to me like it would work, yet when I try to use ooc, nothing happens. I'd appreciate any help I can get. :)

EDIT: Well, I tried making bug checks, putting usr << "Bug" at the else statements etc. And I've found something interesting. It seems that once you get to the for statement, nothing else works. I'm not to sure why.
Well I took a better look and that will only go to 1 person. Heres a better one you can use.
mob
verb
OOC(t as text)
if(!t) return
if(src.talkdelay)
src << "No spamming"
if(!src.ooc)
src << "You need to turn on OOC to use this"
if(length(t) > 350)
t = copytext(t,1,351)
t = scantext(t) // only call the proc once
else
for(var/client/C)
if(!C.mob.ooc) continue
C << "\icon[src][src.name]: [t]"
src.talkdelay = 1
spawn(5) src.talkdelay = 0

In response to Xx Dark Wizard xX
Well, I edited your code (Thank you for it), yet I can't get it to work. Here's the edited code:

        ooc(Text as text)
set category = "Commands"
set desc = "World Say"
if(src.muted==1)
usr << "You can't do that, your muted!"
if(!Text) return
if(!src.talkdelay==1)
src << "You can't talk too fast!"
if(!src.ooc)
src << "You currently have OOC turned off."
if(length(Text) > 100)
usr << "Sorry, the message:<br>'[Text]' is too long, please shorten it."
Text = scantext(Text) // only call the proc once
for(var/client/C)
if(!C.mob.ooc==1)
C << "\icon[src][src.name]: [Text]"
usr << "\icon[src][src.name]: [Text]"
src.talkdelay = 1
spawn(5) src.talkdelay = 0
In response to Michael3131
Use if(var) and if(!var) for true and false.
   ooc(Text as text)
set category = "Commands"
set desc = "World Say"
if(src.muted)
usr << "You can't do that, your muted!"
if(!Text) return
if(!src.talkdelay)
src << "You can't talk too fast!"
if(!src.ooc)
src << "You currently have OOC turned off."
if(length(Text) > 250) // 100 chars is very short
Text = copytext(Text,1,251) // limit the text
Text = scantext(Text) // only call the proc once
for(var/client/C)
if(C.mob.ooc)
C << "\icon[src][src.name]: [Text]" // this includes usr
src.talkdelay = 1
spawn(5) src.talkdelay = 0
Does that work?

Can I see scantext.
In response to Xx Dark Wizard xX
Um sure I guess, it works fine now, thanks for your help!

    scantext(m as text)
// scanhacks()
var/p
m = " " + copytext(m,1) + " "
// Profanity fixes
// Scan through each of the words found in the profanity list and replace them
// More checks can be added, see demo file for emoticons and slangs
if(profanity.len)
for(var/i=1,i<=profanity.len,i++)
p = findtext(m,profanity[i])
while(p)
m = copytext(m,1,p) + profanityfix[i] + copytext(m,p+length(profanity[i]))
p = findtext(m,profanity[i])
//var/p
m = " " + copytext(m,1) + " "
if(hack.len)
for(var/i=1,i<=hack.len,i++)
p = findtext(m,hack[i])
while(p)
m = copytext(m,1,p) + hackfix[i] + copytext(m,p+length(hack[i]))
p = findtext(m,hack[i])
return m
Clients are not in the world, they are only connected to it.
(their mobiles are)

for(var/client/C) // correct, cycle through all existing clients
for(var/client/C in world) // incorrect, cycle through all existing clients within the world's contents, which is none


edit: I see that Dark Wizard answered this, useless post.