So I'm thinking about writing a plugin for MUSHclient that would format the display of progs in Smaug. Say if I mpstat'd a mob, it would rewrite the ouput to maybe something color coded. Whatever would help the builder read it better.
Considering builders sometime indent progs their self, probably leave that alone. Thoughts of what this should do? Maybe color each ifcheck (and what it contains) a different color?
Here's an example I would need to parse:
Anyone else up to working on this with me?
Pseudo code stuff:
First we need to match something to know we're reading a prog. Progs start off with:
So what if we match that? Something like...
And then we start matching in the prog
etc
I suppose it wouldn't hurt put in an option to indent the prog as well if needed.
[EDIT] Here are some basic color changing triggers for a start:
[EDIT 2] I have this on the _prog regex:
But I don't know how to indent lines. The force_indent trigger is a regex that matches anything, but it overwrites everything else.
Considering builders sometime indent progs their self, probably leave that alone. Thoughts of what this should do? Maybe color each ifcheck (and what it contains) a different color?
Here's an example I would need to parse:
>speech_prog yes
if ispc($n)
if hasqbit($n) == 55
tsk
else
if handsfull($n)
mea $n Your hands are full, Snoopy implies.
break
endif
mpqset $n 55
if rand(25)
mpoload 1029
give hat $n
break
endif
if rand(33)
mpoload 1030
give suit $n
break
endif
if rand(50)
mpoload 1031
give boots $n
break
endif
mpoload 1032
give beard $n
endif
endifAnyone else up to working on this with me?
Pseudo code stuff:
First we need to match something to know we're reading a prog. Progs start off with:
Quote:
>greet_prog 100
>greet_prog 100
So what if we match that? Something like...
^>*_prog (.*?)$And then we start matching in the prog
^if (.*?)$^else (.*?)$^break$^endif$etc
I suppose it wouldn't hurt put in an option to indent the prog as well if needed.
[EDIT] Here are some basic color changing triggers for a start:
<triggers>
<trigger
custom_colour="14"
enabled="y"
match="^>(.*?)_prog (.*?)$"
regexp="y"
sequence="100"
>
</trigger>
</triggers>
<triggers>
<trigger
custom_colour="7"
enabled="y"
match="^[\s]*break$"
regexp="y"
sequence="100"
>
</trigger>
</triggers>
<triggers>
<trigger
custom_colour="3"
enabled="y"
keep_evaluating="y"
match="^[\s]*else$"
regexp="y"
sequence="100"
>
</trigger>
</triggers>
<triggers>
<trigger
custom_colour="2"
enabled="y"
match="^[\s]*endif$"
regexp="y"
sequence="100"
>
</trigger>
</triggers>
<triggers>
<trigger
custom_colour="11"
enabled="y"
match="^[\s]*if (.*?)$"
regexp="y"
sequence="100"
>
</trigger>
</triggers>
<triggers>
<trigger
custom_colour="12"
enabled="y"
match="^[\s]*mp[\S]* "
regexp="y"
sequence="100"
>
</trigger>
</triggers>[EDIT 2] I have this on the _prog regex:
inprog = 1
indentnum = 0
EnableTrigger("force_indent", true)But I don't know how to indent lines. The force_indent trigger is a regex that matches anything, but it overwrites everything else.