[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  Help with Adder
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Help with Adder

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


Posted by Biran   (2 posts)  [Biography] 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
[Go to top] top

Posted by Nick Gammon   Australia  (21,321 posts)  [Biography] 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
[Go to top] top

Posted by Biran   (2 posts)  [Biography] 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>
[Go to top] top

Posted by Fiendish   USA  (1,641 posts)  [Biography] 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
[Go to top] top

Posted by Nick Gammon   Australia  (21,321 posts)  [Biography] 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
[Go to top] 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.


1,366 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]