ID:144844
 
Code:
        Hud2
icon_state = "2"
Click()
call(usr,"Say")()
screen_loc = "2,1"

This sorta works but you can't type a message so I tried:
        Hud2
icon_state = "2"
Click()
call(usr,"Say")(msg as text)
screen_loc = "2,1"

Then I get error:msg:undefined Var ,warning: statement has no effect ,as :warning: unused label. I'm pretty sure that's because I'm using call()wrong but that's the way I understood it can someone help me.
oh yeah my say verb(alot of this is text filtering/logging gotta keep the game chat clean and recorded!)
    Say(msg as text)
set category = "Actions"
if(filter(msg,profane) == TRUE)
src.profane()
return
if(filter(msg,bannedwords) == TRUE)
src.bannedwords()
return
else
if(spamcheck == TRUE)
src << "Too much spam please don't spam!"
return
else
src.spamcheck()
view() << "<font color=red>[guilld]</font>{{[title]}}[src] Say: [msg]"
if(log == 1)
text2file("[time2text(world.realtime)]:[src] said, [msg]","log.txt")
Hellsing4 wrote:
>       Hud2
> icon_state = "2"
> Click()
> call(usr,"Say")(msg as text)
> screen_loc = "2,1"
>
>

Then I get error:msg:undefined Var ,warning: statement has no effect ,as :warning: unused label. I'm pretty sure that's because I'm using call()wrong but that's the way I understood it can someone help me.

Yes, you are using it horribly wrong. For one, you shouldn't even be using it here. Just type usr.Say(), instead of call().
Hud2
//blah
usr.Say()


The method of passing arguments in call() isn't by actually passing the type of argument, but by passing the argument itself---a string. I would think that if you left off the second set of parentheses on the first call(blah)() and just made it call(blah), it might work how you want it to. Still, this is horrible abuse. There is no reason to use call() here. This just prevents the compiler from detecting bugs in your game.

Hiead

Hiead
In response to Hiead
What you suggest calls a proc I'm trying to call a verb.(You can't use call without the second set of ().)
In response to Hellsing4
Hellsing4 wrote:
What you suggest calls a proc I'm trying to call a verb.(You can't use call without the second set of ().)

You can call verbs in the same way you would a proc:
mob/verb/Test1()
src << "This is Test1."

mob/verb/Test2()
src << "This is Test2. Calling Test1..."
src.Test1() // Prefix "src." is redundant, but left to show a point.


Hiead
In response to Hiead
When I use usr.Say() It says UNDEFINED PROC.
In response to Hellsing4
Hellsing4 wrote:
What you suggest calls a proc I'm trying to call a verb.(You can't use call without the second set of ().)

Why not just call a proc instead of a verb? It's less stressful.
In response to Branks
Why because your supposed to be able to use call() to call a verb and until now I couldn't get the say proc to work (now it is though). I would still like to know how to fix my call(). Just for the sake of knowing what I did wrong.
In response to Hellsing4
Read the reference. Formats:

call( object, pName )(args)
call( pPath )(args)


object: The object that pName belongs to.
pName: The name of a verb or proc.
pPath: The path to a verb or proc.
Args: Arguments to the proc or verb.
In response to Audeuro
Thanks that helps but I already got it working. I just changed my say verb and it worked:D.
    Say()
var/T=input("","Say")as text
set category = "Actions"
if(!T)return
else
if(filter(T,profane) == TRUE)
src.profane()
return
if(filter(T,bannedwords) == TRUE)
src.bannedwords()
return
else
if(spamcheck == TRUE)
src << "Too much spam please don't spam!"
return
else
src.spamcheck()
view() << "<font color=red>[guilld]</font>{{[title]}}[src] Say: [T]"
if(log == 1)
text2file("[time2text(world.realtime)]:[src] said, [T]","log.txt")