Help with Adder

Posted by Biran on Wed 07 Jun 2017 08:20 AM — 5 posts, 22,932 views.

#0
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
Australia Forum Administrator #1
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.
#2
<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>
USA Global Moderator #3
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?
Amended on Sat 10 Jun 2017 09:08 AM by Fiendish
Australia Forum Administrator #4
How about:


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


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