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.
 Entire forum ➜ MUSHclient ➜ Lua ➜ Help with Adder

Help with Adder

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


Posted by Biran   (8 posts)  Bio
Date Wed 07 Jun 2017 08:20 AM (UTC)
Message
This is the trigger line -- Empty [Room 6200]

function adder(x)
return function (y) return x + y end
end
a1 = adder(1)
Send(a1(6200))

This will print a1+%1 or tather 6201 I need it to print something more unique like Empty6201 or even A6201 Much help would be very appriciated!

This is probably simple but im a complete newbie
Top

Posted by Nick Gammon   Australia  (23,121 posts)  Bio   Forum Administrator
Date Reply #1 on Thu 08 Jun 2017 05:51 AM (UTC)
Message
This looks incredibly complicated for your stated purpose. Please post your actual trigger.

Template:copying For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.

- Nick Gammon

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

Posted by Biran   (8 posts)  Bio
Date Reply #2 on Sat 10 Jun 2017 06:22 AM (UTC)
Message
<triggers>
<trigger
enabled="y"
match="Empty [Room *]"
send_to="12"
sequence="100"
>
<send>function adder(x)
return function (y) return x + y end
end
a1 = adder(1)
Send(a1(%1))</send>
</trigger>
</triggers>
Top

Posted by Fiendish   USA  (2,533 posts)  Bio   Global Moderator
Date Reply #3 on Sat 10 Jun 2017 09:05 AM (UTC)

Amended on Sat 10 Jun 2017 09:08 AM (UTC) by Fiendish

Message
LOL.

Biran, I'm still not really sure what you're asking about.
Are you asking how to do arithmetic with the captured %1 value?

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Nick Gammon   Australia  (23,121 posts)  Bio   Forum Administrator
Date Reply #4 on Sun 11 Jun 2017 05:09 AM (UTC)
Message
How about:


<send>
Send("Empty" .. (%1 + 1))
</send>


You don't need to write a function to add 1 to something.

- 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.


16,709 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.