Mushclient Questions

by Esano

Back to Mechanic's Corner.

Ayisdra2010-02-04 16:38:24
Regarding plugins -ish: The scripting language right now I have set to Lua. If I write a plugin, say in python or anything not in Lua. would this work even when the language is different than the setting of the language?
Unknown2010-02-04 17:23:37
Yes, as long as the language is installed on the machine where the plugin is loaded (when you give it to someone else, I mean).
Dynami2010-02-05 03:40:03
I tried using the following trigger from an old post to tell when someone is at half ego, but it does not seem to work
CODE
^The max\\/current ego strength of +\\: (\\d+)\\/(\\d+)$

if %2 <= %1 / 2 then ColourNote("red", "", "<<< ", "yellow", "", "AT HALF EGO", "red", "", " >>>") end

Any ideas?
Esano2010-02-05 04:09:55
Try making it tonumber("%2") <= tonumber("%1")/2
Dynami2010-02-05 04:20:07
QUOTE (Esano @ Feb 4 2010, 11:09 PM) <{POST_SNAPBACK}>
Try making it tonumber("%2") <= tonumber("%1")/2

Like this?
CODE
if tonumber("%2") <= tonumber("%1")/2 then ColourNote("red", "", "<<< ", "yellow", "", "AT HALF EGO", "red", "", " >>>") end

Razenth2010-02-05 04:39:10
Yes
Unknown2010-02-05 11:58:14
If you capture only numbers, tonumber is superfluous.
Unknown2010-02-20 05:24:10
Ok I got a question. I've made an entire group from start of the Treant (meaning I added aliases that work along with the treant aliases) Problem is... I just want to turn on and off one group. I have a group called "bard" and a group called "necro" I want to turn those on and off, but the MUSHClient Configuration Interface does not have that option! Can't I just make the group turn off? Like I should be able to say "Filter by group" but that doesn't seem to work. By the way, I don't know nothing about script. Well, I do know that scripts are something for predetermined commands. But these aliases I added onto the Treant aliases via Configuration Interface-Aliases.

Why can't I just flip a switch??
Unknown2010-02-20 05:37:25
Assuming LUA:
EnableGroup ("groupname", true)
EnableGroup ("groupname", false)
Eldanien2010-02-20 06:25:30
EnableTriggerGroup or EnableAliasGroup

Syntax as above.
Unknown2010-02-20 23:16:12
QUOTE (AllergictoSabres @ Feb 20 2010, 05:37 AM) <{POST_SNAPBACK}>
Assuming LUA:
EnableGroup ("groupname", true)
EnableGroup ("groupname", false)



Which then brings me to my next question. Where exactly do I put this? I'm typing it in the command line while I'm in game, and I keep getting the messages like this.


Black soot rains down like snow from the striated and polluted skies above the Capital City of Magnagora, showering you with grimy chemical residue.
2982h, 3228m, 3045e, 10p, 12600en, 14430w ex-

EnableAliasGroup ("necro", true)
I don't follow.
EnableAliasGroup ("bard", true)
One more time?



(Please remember, I've NEVER made my own script or anything like that. I'm not sure how to do that, and I'm running on Treant.)
Unknown2010-02-20 23:24:06
Create a new alias. In the "Alias" box put something like necon

Click the 'Convert to Regular Expression' button underneath.

In the "Send" box, put:
EnableGroup ("necro", true)

In the "Send to:" drop down box, set that to "Script".

Click ok at the bottom.

Do the same thing, only call the alias necoff or something and make that true a false.
Unknown2010-02-23 03:28:59
QUOTE (AllergictoSabres @ Feb 21 2010, 12:24 AM) <{POST_SNAPBACK}>
Create a new alias. In the "Alias" box put something like necon

Click the 'Convert to Regular Expression' button underneath.

In the "Send" box, put:
EnableGroup ("necro", true)

In the "Send to:" drop down box, set that to "Script".

Click ok at the bottom.

Do the same thing, only call the alias necoff or something and make that true a false.



Wooh! It worked! Thank you so much!
calina2010-03-01 18:56:32
i feel like i almost have this trigger working, but i still seem to have something wrong. what i have is this

Trigger

^(\\w+)'s mana stands at (\\d+)\\/(\\d+)

SetVariable("TargetsMaxmana", %3)
SetVariable("TargetsCurrentMana", %2)
if TargetscurrentMana <= ("TargetsMaxMana" * 0.5) then send("abs")

error i get is...

Run-time error
World: Treant
Immediate execution
:3: attempt to perform arithmetic on a string value
stack traceback:
:3: in main chunk

I'm guessing it's because it's trying to do math on a word instead of retrieving the value of the variable and doing math on it instead. but i don't know how to retrieve the value of the variable. Some help would be great.
Unknown2010-03-01 19:07:55
You don't need to store them as variables, unless you have a need for them elsewhere (outside the trigger).

if %2 <= %3 * 0.5 then
Execute("abs")
end
Unknown2010-03-01 19:09:47
QUOTE (calinagmail @ Mar 1 2010, 01:56 PM) <{POST_SNAPBACK}>
i feel like i almost have this trigger working, but i still seem to have something wrong. what i have is this

Trigger

^(\\w+)'s mana stands at (\\d+)\\/(\\d+)

SetVariable("TargetsMaxmana", %3)
SetVariable("TargetsCurrentMana", %2)
if TargetscurrentMana <= ("TargetsMaxMana" * 0.5) then send("abs")

error i get is...

Run-time error
World: Treant
Immediate execution
:3: attempt to perform arithmetic on a string value
stack traceback:
:3: in main chunk

I'm guessing it's because it's trying to do math on a word instead of retrieving the value of the variable and doing math on it instead. but i don't know how to retrieve the value of the variable. Some help would be great.


Also, you have "TargetsMaxMana" * 0.5 ... which makes it a string, not the value of TargetsMaxMana
Unknown2010-03-01 19:10:05
Edit: Ninja'd by Zarquan AND Demonic. sad.gif
calina2010-03-02 00:59:31
thank you very much. works perfectly.
Mirami2010-03-08 05:46:02
Is there a way in Lua to gag a trigger from an if statement, I.E. if "%1" == "something" then ?
Unknown2010-03-08 07:35:08
QUOTE (Romertien @ Mar 8 2010, 06:46 AM) <{POST_SNAPBACK}>
Is there a way in Lua to gag a trigger from an if statement, I.E. if "%1" == "something" then ?

Using regex would do the same thing as that if statement. ^(Bob|Joe|Bill|Doug) enter from the \\w+\\.$ Check omit from output. So if those four enter from the whatever, it'll gag the line, otherwise it'll show the person entering. If that's not the functionality you're looking for, it might help to specify what you're trying to accomplish exactly so that the most fitting solution can be found.