0 Members and 2 Guests are viewing this topic.
This is an improvment on a trivia loader made a while back. You need to make a file called LoadTrivia.xml in your plugins directory, in it includes to all your trivia packs, also lacated in the base plugin directory. They must all be on a separate line, exactly as shown below.
<config> <include file="simpsons.xml"/> <include file="startrek.xml"/> <include file="TV.xml"/> <include file="vidgame.xml"/> <include file="worldcurrency.xml"/> </config>
In your MXC.xml, include the LoadTrivia.xml:
<include file="LoadTrivia.xml"/>
Add this to your MXC.xml (change the directories where neccessary):
<command type="script" mode="thread"> <in>!listtrivia</in> <out type="push" extdata="LineNum">1</out> <out type="push" extdata="TrivNum">0</out> <out type="push" extdata="TEMP"><operator type="readfile" nvalue="C:\Program Files\Metis 2.6\Add-Ons\LoadTrivia.xml" lvalue="l" rvalue="$LineNum$"/></out> <out type="goto" extdata="12" condition="==" lvalue="$TEMP$" rvalue=""></out> <out type="push" extdata="LineNum"><operator type="++" lvalue="$LineNum$"/></out> <out type="goto" extdata="-3" condition="!_?" lvalue="$TEMP$" rvalue="<include"></out> <out type="push" extdata="Loaded" condition="?" lvalue="$TEMP$" rvalue="<!--">#c58#(Not Loaded)</out> <out type="push" extdata="Loaded" condition="!?" lvalue="$TEMP$" rvalue="<!--">#c68#(Loaded)</out> <out type="push" extdata="TEMP"><operator type="strrem" lvalue="$TEMP$" rvalue="<!--"/></out> <out type="push" extdata="TEMP"><operator type="strrem" lvalue="$TEMP$" rvalue="-->"/></out> <out type="push" extdata="TEMP"><operator type="strrem" lvalue="$TEMP$" rvalue='<include file="'/></out> <out type="push" extdata="TEMP"><operator type="strrem" lvalue="$TEMP$" rvalue='.xml"/>'/></out> <out type="push" extdata="TrivNum"><operator type="++" lvalue="$TrivNum$"/></out> <out>$TrivNum$] $TEMP$ $Loaded$</out> <out type="goto" extdata="-12"></out> <out condition="!=" lvalue="$TrivNum$" rvalue="0">Commands: !unloadtrivia # | !loadtrivia # (To [Un]load multiple packs, make seperate commands)</out> <out condition="==" lvalue="$TrivNum$" rvalue="0">Error: No Trivia Added To Script</out> </command> <command type="script" mode="thread"> <in>!loadtrivia%PARAM%</in> <out type="push" extdata="TrivToLoad"><operator type="strrem" lvalue="%PARAM%" rvalue=" "/></out> <out>Loading $TrivToLoad$...</out> <out type="push" extdata="LineNum">1</out> <out type="push" extdata="TrivNum">0</out> <out type="push" extdata="TrivName"></out> <out type="file" extdata="C:\Program Files\Metis 2.6\Add-Ons\LoadTrivia.tmp" mode="t"></out> <out type="push" extdata="TEMP"><operator type="readfile" nvalue="C:\Program Files\Metis 2.6\Add-Ons\LoadTrivia.xml" lvalue="l" rvalue="$LineNum$"/></out> <out type="goto" extdata="15" condition="_?" lvalue="$TEMP$" rvalue="</config>"></out> <out type="push" extdata="LineNum"><operator type="++" lvalue="$LineNum$"/></out> <out type="goto" extdata="-3" condition="_?" lvalue="$TEMP$" rvalue="<config>"></out> <out type="push" extdata="TrivNum"><operator type="++" lvalue="$TrivNum$"/></out> <out type="file" extdata="C:\Program Files\Metis 2.6\Add-Ons\LoadTrivia.tmp" mode="a"condition="!=" lvalue="$TrivToLoad$" rvalue="$TrivNum$">$TEMP$\n</out> <out type="goto" extdata="-6"condition="!=" lvalue="$TrivToLoad$" rvalue="$TrivNum$"></out> <out condition="!?" lvalue="$TEMP$" rvalue="<!--">Error: Already Loaded</out> <out type="break" condition="!?" lvalue="$TEMP$" rvalue="<!--"></out> <out type="push" extdata="TEMP"><operator type="strrep" nvalue="$TEMP$" rvalue="<include" lvalue="<!--<include"/></out> <out type="push" extdata="TEMP"><operator type="strrep" nvalue="$TEMP$" rvalue='"/>' lvalue='"/>-->'/></out> <out type="file" extdata="C:\Program Files\Metis 2.6\Add-Ons\LoadTrivia.tmp" mode="a">$TEMP$\n</out> <out type="push" extdata="TEMP"><operator type="strrem" lvalue="$TEMP$" rvalue='<include file="'/></out> <out type="push" extdata="TEMP"><operator type="strrem" lvalue="$TEMP$" rvalue='.xml"/>'/></out> <out type="push" extdata="TrivName">$TEMP$</out> <out type="goto" extdata="-15"></out> <out condition="==" lvalue="$TrivName$" rvalue="">Invalid Trivia Number</out> <out type="break" condition="==" lvalue="$TrivName$" rvalue=""></out> <out type="push" extdata="LineNum">1</out> <out type="file" extdata="C:\Program Files\Metis 2.6\Add-Ons\LoadTrivia.xml" mode="t"><config>\n</out> <out type="push" extdata="TEMP"><operator type="readfile" nvalue="C:\Program Files\Metis 2.6\Add-Ons\LoadTrivia.tmp" lvalue="l" rvalue="$LineNum$"/></out> <out type="goto" extdata="4" condition="==" lvalue="$TEMP$" rvalue=""></out> <out type="file" extdata="C:\Program Files\Metis 2.6\Add-Ons\LoadTrivia.xml" mode="a">$TEMP$\n</out> <out type="push" extdata="LineNum"><operator type="++" lvalue="$LineNum$"/></out> <out type="goto" extdata="-4"></out> <out type="file" extdata="C:\Program Files\Metis 2.6\Add-Ons\LoadTrivia.xml" mode="a"></config>\n</out> <out>Loaded $TrivName$</out> <out type="control">/mxc load</out> </command> <command type="script" mode="thread"> <in>!unloadtrivia%PARAM%</in> <out type="push" extdata="TrivToUnLoad"><operator type="strrem" lvalue="%PARAM%" rvalue=" "/></out> <out>UnLoading $TrivToUnLoad$...</out> <out type="push" extdata="LineNum">1</out> <out type="push" extdata="TrivNum">0</out> <out type="push" extdata="TrivName"></out> <out type="file" extdata="C:\Program Files\Metis 2.6\Add-Ons\LoadTrivia.tmp" mode="t"></out> <out type="push" extdata="TEMP"><operator type="readfile" nvalue="C:\Program Files\Metis 2.6\Add-Ons\LoadTrivia.xml" lvalue="l" rvalue="$LineNum$"/></out> <out type="goto" extdata="15" condition="_?" lvalue="$TEMP$" rvalue="</config>"></out> <out type="push" extdata="LineNum"><operator type="++" lvalue="$LineNum$"/></out> <out type="goto" extdata="-3" condition="_?" lvalue="$TEMP$" rvalue="<config>"></out> <out type="push" extdata="TrivNum"><operator type="++" lvalue="$TrivNum$"/></out> <out type="file" extdata="C:\Program Files\Metis 2.6\Add-Ons\LoadTrivia.tmp" mode="a"condition="!=" lvalue="$TrivToUnLoad$" rvalue="$TrivNum$">$TEMP$\n</out> <out type="goto" extdata="-6"condition="!=" lvalue="$TrivToUnLoad$" rvalue="$TrivNum$"></out> <out condition="?" lvalue="$TEMP$" rvalue="<!--">Error: Already UnLoaded</out> <out type="break" condition="?" lvalue="$TEMP$" rvalue="<!--"></out> <out type="push" extdata="TEMP"><operator type="strrep" nvalue="$TEMP$" lvalue="<include" rvalue="<!--<include"/></out> <out type="push" extdata="TEMP"><operator type="strrep" nvalue="$TEMP$" lvalue='"/>' rvalue='"/>-->'/></out> <out type="file" extdata="C:\Program Files\Metis 2.6\Add-Ons\LoadTrivia.tmp" mode="a">$TEMP$\n</out> <out type="push" extdata="TEMP"><operator type="strrem" lvalue="$TEMP$" rvalue='<!--<include file="'/></out> <out type="push" extdata="TEMP"><operator type="strrem" lvalue="$TEMP$" rvalue='.xml"/>-->'/></out> <out type="push" extdata="TrivName">$TEMP$</out> <out type="goto" extdata="-15"></out> <out condition="==" lvalue="$TrivName$" rvalue="">Invalid Trivia Number</out> <out type="break" condition="==" lvalue="$TrivName$" rvalue=""></out> <out type="push" extdata="LineNum">1</out> <out type="file" extdata="C:\Program Files\Metis 2.6\Add-Ons\LoadTrivia.xml" mode="t"><config>\n</out> <out type="push" extdata="TEMP"><operator type="readfile" nvalue="C:\Program Files\Metis 2.6\Add-Ons\LoadTrivia.tmp" lvalue="l" rvalue="$LineNum$"/></out> <out type="goto" extdata="4" condition="==" lvalue="$TEMP$" rvalue=""></out> <out type="file" extdata="C:\Program Files\Metis 2.6\Add-Ons\LoadTrivia.xml" mode="a">$TEMP$\n</out> <out type="push" extdata="LineNum"><operator type="++" lvalue="$LineNum$"/></out> <out type="goto" extdata="-4"></out> <out type="file" extdata="C:\Program Files\Metis 2.6\Add-Ons\LoadTrivia.xml" mode="a"></config>\n</out> <out>UnLoaded $TrivName$</out> <out type="control">/mxc load</out> </command>
Commands are: !listtrivia !loadtrivia # (# is the number off the load trivia list) !unloadtrivia # (# same as above)
C:\Program Files\Metis 2.6\Add-Ons\LoadTrivia.xml