First of all, I've finished my first ever lua-type script/trigger/plugin for MUSHclient! (I'm so happy, heh)
It does what I want, but I'd like to polish it up in a certain way.
It's a stat reroller for a smaug mud. It functions perfectly. However, I also have it spamming out ColourNotes whenever a stat is rolled at or above the desired amount, and each of these stat ColourNotes appear on a new line.
Is there a way to create some sort of variable, and append each ColourNote to that variable, so that I can put all the output on ONE line, vice seven?
I've saved it as a plugin (including the 7 stat variables). I didn't think about it before making it a plugin--but by adding the variables, I take away all GUI-based editing for those variables. That's just a minor annoyance.
Here it is. Any pointers would be gladly appreciated, as I'm not much of a programmer!
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Thursday, April 03, 2008, 11:12 AM -->
<!-- MuClient version 4.23 -->
<!-- Plugin "SMAUG_Reroller" generated by Plugin Wizard -->
<muclient>
<plugin
name="SMAUG_Reroller"
author="SKYY"
id="26aeadabb6c27a7ef1c9ae7e"
language="Lua"
purpose="Rerolls SMAUG 1.8 stats based on desired abilities."
save_state="y"
date_written="2008-04-03 11:10:42"
requires="4.23"
version="1.0"
>
<description trim="y">
<![CDATA[
This plugin rerolls stats for SMAUG 1.8 muds. It outputs the seven stats in their own colors as it rolls, so that the user can clearly see which stats are above the desired levels. This allows the user to get a general idea of any requested stat levels which may be too high.
Set the seven stat variables by editing the plugin, and changing the numbers in the variables at the bottom of the text file.
]]>
</description>
</plugin>
<!-- Get our standard constants -->
<include name="constants.lua"/>
<!-- Triggers -->
<triggers>
<trigger
enabled="y"
expand_variables="y"
group="ReRoll"
lines_to_match="2"
match="^Str: (\d{1,2}) Int: (\d{1,2}) Wis: (\d{1,2}) Dex: (\d{1,2}) Con: (\d{1,2}) Cha: (\d{1,2}) Lck: (\d{1,2})$"
name="ReRoll"
regexp="y"
send_to="12"
sequence="100"
>
<send>if %1>=tonumber(GetVariable("str"))
then
ColourNote("#ff3030","","STR: ","#ff3030","",%1)
else
ColourNote("#ff3030","","STR:")
end
if %2>=tonumber(GetVariable("int"))
then
ColourNote("#ccaaff","","INT: ","#ccaaff","",%2)
else
ColourNote("#ccaaff","","INT:")
end
if %3>=tonumber(GetVariable("wis"))
then
ColourNote("#30ffff","","WIS: ","#30ffff","",%3)
else
ColourNote("#30ffff","","WIS:")
end
if %4>=tonumber(GetVariable("dex"))
then
ColourNote("#30ff30","","DEX: ","#30ff30","",%4)
else
ColourNote("#30ff30","","DEX:")
end
if %5>=tonumber(GetVariable("con"))
then
ColourNote("#ffaa30","","CON: ","#ffaa30","",%5)
else
ColourNote("#ffaa30","","CON:")
end
if %6>=tonumber(GetVariable("cha"))
then
ColourNote("#77aaff","","CHA: ","#77aaff","",%6)
else
ColourNote("#77aaff","","CHA:")
end
if %7>=tonumber(GetVariable("lck"))
then
ColourNote("#ffffaa","","LCK: ","#ffffaa","",%7)
else
ColourNote("#ffffaa","","LCK:")
end
if %1>=tonumber(GetVariable("str")) and %2>=tonumber(GetVariable("int")) and %3>=tonumber(GetVariable("wis")) and %4>=tonumber(GetVariable("dex")) and %5>=tonumber(GetVariable("con")) and %6>=tonumber(GetVariable("cha")) and %7>=tonumber(GetVariable("lck"))
then
	Send("y")
else
	Send("n")
end</send>
</trigger>
</triggers>
<!-- Variables -->
<variables>
<variable name="str">15</variable>
<variable name="int">18</variable>
<variable name="wis">18</variable>
<variable name="dex">14</variable>
<variable name="con">14</variable>
<variable name="cha">3</variable>
<variable name="lck">15</variable>
</variables>
</muclient>
|