Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Lua ➜ Need Some Help

Need Some Help

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Aduka   (3 posts)  Bio
Date Thu 30 Jul 2009 10:49 PM (UTC)
Message
I'm attempting to make an alias that when typed will report the data this below locals each time. I already have it running in a note, but I'm not sure of the command to send messages to the world. Like Note put it to the output, what is the command to put it into say the world itself.

^Your .* \[(\d+)\]$

function TotalDmg

local Dmg
local TotalDmg

Dmg = %1

TotalDmg = tonumber (GetVariable("Total_Damage"))

if TotalDmg == nil then

local FinalDmg

FinalDmg = 0 + Dmg

SetVariable ("Total_Damage", FinalDmg)

else

local FinalDmg

FinalDmg = TotalDmg + Dmg

SetVariable ("Total_Damage", FinalDmg)

end
Top

Posted by Hoax   (14 posts)  Bio
Date Reply #1 on Thu 30 Jul 2009 11:13 PM (UTC)
Message
Note/ColourNote will send a given string to the output of the world. Is that what you wanted to do, or not?

Cheers.
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #2 on Thu 30 Jul 2009 11:51 PM (UTC)
Message
Do you mean, to send back to the MUD? Like, you are telling others in your group your stats? In that case, Send.

http://www.gammon.com.au/scripts/function.php?name=Send

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Aduka   (3 posts)  Bio
Date Reply #3 on Thu 30 Jul 2009 11:51 PM (UTC)
Message
I want the command that would allow me to send it like this

Tell Charneus This This This

Now if I entered that into the prompt on the screen it would send it as a command, and send charneus a message stating this this this, how would I do that from a script.

I use Colournote for my output.
Top

Posted by Aduka   (3 posts)  Bio
Date Reply #4 on Thu 30 Jul 2009 11:54 PM (UTC)

Amended on Thu 30 Jul 2009 11:56 PM (UTC) by Aduka

Message
What am I doing wrong?

Error:

Run-time error
World: Aardwolf
Immediate execution
[string "Alias: "]:1: attempt to concatenate global 'Charneus' (a nil value)
stack traceback:
[string "Alias: "]:1: in main chunk

Alias:

ReportDmg * *

Script:

Send(%1.." "..%2.." ".."@WT@wotal @WD@wamage @WD@wealt as of @R:@w "..os.date().. " @R:@y "..GetVariable( "Total_Damage" ).."@R.@W")

@ = A color code.
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #5 on Fri 31 Jul 2009 12:08 AM (UTC)
Message
It has replaced %1 by Charneus, so you have:


Send(Charneus .. " " .. whatever .." " .. blah blah


Charneus is a variable, which will be nil. You need to quote it:


Send ("Tell %1 " .. whatever 


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


17,887 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.