ID:142549
 
Code:
//hud code:
obj
hud
HUD
layer = 99999999
icon = 'buttons.dmi'
say
icon_state = "say"
Click()
usr.say()
New(client/C)
screen_loc = "1,1"
C.screen+=src
worldsay
icon_state = "wsay"
Click()
usr.OOC()
New(client/C)
screen_loc = "2,1"
C.screen+=src
save
icon_state = "save"
Click()
usr.SaveK()
New(client/C)
screen_loc = "3,1"
C.screen+=src

client/New()
..()
new/obj/hud/HUD/say(src)
new/obj/hud/HUD/worldsay(src)
new/obj/hud/HUD/save(src)

//say code:

var/smiley/S=new
mob
verb //tried making this a proc :P same result.
say(msg as text)
set category = "Commands"
msg=S.ParseHTML(msg)
if(filter(msg,profane) == TRUE) //if the msg has profanity in it
src.profane() // call the proc
return //stop it from sending
if(filter(msg,bannedwords) == TRUE) // if the msg has banned words in it
src.bannedwords() //call the proc
return //stop it from sending
else //if it checks out
if(spamcheck == TRUE)//if the player is spamming
src << "Spam rate exceeded please wait a moment and try again!"//tell him to wait for a second
return //stop it from sending
else//if the message is ok to send
src.spamcheck()//check for spam
view() << "[src] says: [msg]" // send the world the message
if(log == 1)//if logging is turned on
text2file("[time2text(world.realtime)]:[src] says, [msg]","log.txt") // add it to the log


Problem description:

ok thing is, when i click the "say" button the input box doesnt pop up. it just sends a blank message :( any idea why?
Your not passing anything into say.
usr.say()
In response to Flame Sage
you mean like............

usr.say(msg as text) ??? coz i think i tried that one. var errors.
In response to Gogeta126
var/T = input("Can I has a msg?")
usr.say(T)

Or better yet...
usr.say(input("Can I has a msg?"))
In response to Flame Sage
oooo. nice nice. Guess my brain wasnt in the mood to think of that.

thanks. solved ^^
            if(filter(msg,profane) == TRUE)  //if the msg has profanity in it
src.profane() // call the proc
return //stop it from sending
if(filter(msg,bannedwords) == TRUE) // if the msg has banned words in it
src.bannedwords() //call the proc
return //stop it from sending
else //if it checks out


Technically this won't cause any problems (as you're returning anyway), but this is constructed incorrectly. When you want to handle only one of a number of cases, you do this:

if
//first case
else if
//second case
...
else if
//nth case
else
//last case
In response to Garthor
Garthor wrote:
Technically this won't cause any problems (as you're returning anyway), but this is constructed incorrectly.

In fact, there is nothing bad with such 'construction'. There is no point in using the 'else' statement when you've got 'return' on the if(s) before it since it will be impossible for the code to reach it and fail it's test anyway. Mind you, personally, I do it in these cases and I'd actually call this better construction, since it doesn't have redundant statements. And it is also naturally more efficient.
However, the OP does use both "methods" mixed in his code, so the question might be, of course, if he actually realizes why his code works without the 'else'. But that's another thing.