Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
freyr
Newbie


Joined: 11 Dec 2007
Posts: 2

PostPosted: Thu Jul 30, 2009 2:53 pm   

[2.37] Sending people packages with triggers that have multiple states
 
I have a package that I'm trying to share with a few friends, and I've just been handing out the package file (it also exists on the Package Library, and the same problems seem to show up when trying to install it from there.)

As best as I can tell, when other people install/open the package, the triggers with multiple states are -only- retaining their first state. The "Loop Pattern" triggers under them are being loaded as if they were just normal triggers.

I.e.

<trigger priority="520" regex="true" id="35">
<pattern>(are|is) using:$</pattern>
<trigger type="Loop Pattern" regex="true">
<pattern>^(<.*>\s+)([a-zA-Z0-9\-\' ]+)(.*)$</pattern>
<value>lore_addrecentitem %trimright(%2)
#SUBSTITUTE {%char(27)"[2z"%1%char(27)"[1z"%2""%3}</value>
</trigger>
</trigger>

has been adding two separate triggers, rather than just one trigger with two states. This has happened with two different people, and both are using fairly fresh 2.37 installs.


Is this type of behavior known, and are there any workarounds?


(also, here is the full XML for the package in question:)

<module name="Lore Database" global="true">
<uid>{A0C3A53E-5FE5-47A0-903F-1E65C43C48D3}</uid>
<alias name="lore_init" id="1">
<value><![CDATA[lore_uninit
#VAR lore_db %comcreate( "ADODB.Connection")
#call @lore_db.Open(@lore_connectionstring)
#class {discovery} 1
#class {capture} 0
#class {item tracking} 1
#show %char(27)"[1z<!ELEMENT loreitem '<send href="%char(34)"lore_searchbyname &text;"%char(34)" PROMPT>'>"
#ECHO <CORE> Lore Database v1.0 Started. (Connected to @lore_db.ConnectionString)]]></value>
</alias>
<class name="vars" id="2">
<var name="lore_db" id="3"></var>
<var name="lore_buffer" type="Literal" id="4"/>
<var name="lore_name" type="Literal" id="5"/>
<var name="lore_mob" type="Literal" id="6"/>
<var name="lore_zone" type="Literal" id="7"/>
<var name="lore_insertcommand" type="Literal" id="8"/>
<var name="lore_rs" type="Literal" id="9"/>
<var name="lore_notes" type="Literal" id="10"/>
<var name="lore_eof" type="Literal" id="11"/>
<var name="lore_tmp" type="Literal" id="12"/>
<var name="lore_sql" type="Literal" usedef="true" id="13">
<default>64</default>
</var>
<var name="lore_tmpb" type="Literal" id="14"/>
</class>
<class name="settings" id="15">
<var name="lore_connectionstring" id="16">Arctic</var>
</class>
<alias name="lore_uninit" id="17">
<value>#var lore_buffer ""
#var lore_db ""
#var lore_eof ""
#var lore_insertcommand ""
#var lore_mob ""
#var lore_name ""
#var lore_notes ""
#var lore_rs ""
#var lore_sql ""
#var lore_tmp ""
#var lore_tmpb ""
#var lore_zone ""
#var lore_itemkws ""
#var lore_matchingitems ""
#var lore_recentitems ""
#class {discovery} 0
#class {capture} 0
#class {item tracking} 0</value>
</alias>
<class name="capture" enabled="false" id="18">
<trigger priority="110" regex="true" id="19">
<pattern>^(.+)$</pattern>
<value>#var lore_buffer {@lore_buffer%1"\r\n"}</value>
</trigger>
<trigger priority="120" regex="true" newline="false" prompt="true" id="20">
<pattern>\d+\w \d+\w.*></pattern>
<value>#class capture 0
#var lore_buffer %subregex(@lore_buffer, "(\.)+$", "")
#yesno "Do you want to save this lore to the database?" {lore_submitlore}</value>
</trigger>
<trigger priority="410" regex="true" id="21">
<pattern>^$</pattern>
<value>#var lore_buffer {@lore_buffer"\r\n"}</value>
</trigger>
</class>
<alias name="lore_search" id="22">
<value>#echo Searching for "'"%params"'..."
#var lore_sql "SELECT id,zone,mob,name,REPLACE(REPLACE(lore,'\r\n','\n'),'\n','\r\n') AS lore,REPLACE(REPLACE(notes,'\r\n','\n'),'\n','\r\n') AS notes,created_at FROM items WHERE lore LIKE '%"%replace(%params,"'","\'")"%' or name LIKE '%"%replace(%params,"'","\'")"%' ORDER BY created_at"
lore_searchbysql
#echo All results returned.</value>
</alias>
<class name="discovery" id="23">
<trigger priority="80" regex="true" id="24">
<pattern>^You feel informed</pattern>
<value>#var lore_buffer ""
#class capture 1</value>
</trigger>
</class>
<event event="onConnect" priority="420" id="25">
<value>lore_init</value>
</event>
<event event="onExit" priority="430" id="26">
<value>lore_uninit</value>
</event>
<class name="item tracking" id="27">
<alias name="lore_addrecentitem" id="28">
<value>#delitem lore_recentitems %params
#if (%numitems(@lore_recentitems) = 50)
{
#DELN lore_recentitems 1
}
#additem lore_recentitems %params</value>
</alias>
<var name="lore_recentitems" type="Literal" id="29"/>
<alias name="lore_pickitem" id="30">
<value>#var lore_matchingitems ""
#if %regex(@lore_buffer,"Object\s+'([^']+)'", @lore_itemkws) {}
#var lore_itemkws %replace(@lore_itemkws," ", "|")
#forall @lore_recentitems {
#var lore_tmp %i
#forall @lore_itemkws {
#if (%pos(%j,@lore_tmp)) {
#var lore_matchingitems %addItem(@lore_tmp,@lore_matchingitems)
}
}
}
#var lore_matchingitems %countlist(@lore_matchingitems)
#var lore_tmp ""
#loopdb @lore_matchingitems {#additem lore_tmp %key}
#var lore_name %pick("p:What is the name of the item?", "o:1", @lore_tmp, "Other...")
#if (@lore_name = "Other...") {#var lore_name %prompt("","Please enter the name of the item manually.")}</value>
</alias>
<var name="lore_itemkws" type="Literal" id="31"/>
<var name="lore_matchingitems" type="Literal" id="32"/>
<trigger priority="500" regex="true" id="33">
<pattern>^You are carrying</pattern>
<trigger type="Loop Pattern" regex="true">
<pattern>^([a-zA-Z0-9\'\- ]+)(.*)$</pattern>
<value>lore_addrecentitem %trimright(%1)
#SUBSTITUTE {""%1""%2}</value>
</trigger>
</trigger>
<trigger priority="520" regex="true" id="35">
<pattern>(are|is) using:$</pattern>
<trigger type="Loop Pattern" regex="true">
<pattern>^(<.*>\s+)([a-zA-Z0-9\-\' ]+)(.*)$</pattern>
<value>lore_addrecentitem %trimright(%2)
#SUBSTITUTE {%char(27)"[2z"%1%char(27)"[1z"%2""%3}</value>
</trigger>
</trigger>
<trigger priority="540" regex="true" id="37">
<pattern>^(\w+ (drop|get|gets|put|give) )(.*)(\.)$</pattern>
<value><![CDATA[#if (%regex(%3,"(.*)( (from |in |to ).*)",@lore_tmp,@lore_tmpb)) {#if (%2="get") {lore_addrecentitem @lore_tmp} {}
#SUBSTITUTE {%1"<loreitem>"@lore_tmp"</loreitem>"@lore_tmpb%4}
} {#if (%2="get") {lore_addrecentitem %3} {}
#SUBSTITUTE {%1"<loreitem>"%3"</loreitem>"%4}
}]]></value>
</trigger>
<trigger priority="550" regex="true" id="38">
<pattern>^(You are zapped by )(.*)( and instantly drop it\.)$</pattern>
<value>lore_addrecentitem %2
#SUBSTITUTE {%1""%2""%3}</value>
</trigger>
<trigger priority="3120" regex="true" id="39">
<pattern>^(You now have )(.*)(\.)$</pattern>
<value>lore_addrecentitem %2
#SUBSTITUTE {%1""%2""%3}</value>
</trigger>
<trigger priority="3340" regex="true" id="40">
<pattern>^[^*]+\((here|carried)\) \:\s+$</pattern>
<trigger type="Loop Pattern" regex="true">
<pattern>^([a-zA-Z0-9\'\- ]+)(.*)$</pattern>
<value>#SUBSTITUTE {""%1""%2}</value>
</trigger>
</trigger>
<alias name="lore_submitlore" id="53">
<value>lore_pickitem
#var lore_zone %prompt("", "What zone did the item come from?")
#var lore_mob %prompt("", "What mob did the item come from?")
#var lore_notes %prompt("", "Please enter any notes about this item that you would like to save with the lore.")
#call @lore_db.Execute("INSERT INTO items (lore,zone,mob,name,notes) VALUES ('"%subregex(@lore_buffer, "'", "\'")"','"%subregex(@lore_zone, "'", "\'")"','"%subregex(@lore_mob, "'", "\'")"','"%subregex(@lore_name, "'", "\'")"','"%subregex(@lore_notes, "'", "\'")"')",1,1)
#echo '@lore_name' added to lore database.</value>
</alias>
</class>
<alias name="lore_presentrecordset" id="43">
<value>#class discovery 0
#var lore_eof @lore_rs.EOF
#while (@lore_eof = "False")
{
#echo {}
#echo ------------------------------------------------------------
#echoprompt "Item: "
#echoprompt @lore_rs.Fields("name").Value
#echoprompt " (lore id #"
#echoprompt @lore_rs.Fields("id").Value
#echo ")]"
#echoprompt "Zone: "
#echo @lore_rs.Fields("zone").Value
#echoprompt "Mob: "
#echo @lore_rs.Fields("mob").Value
#echo ------------------------------------------------------------
#echo @lore_rs.Fields("lore").Value
#echo ------------------------------------------------------------
#echo "Notes: "
#echo @lore_rs.Fields("notes").Value
#echo ------------------------------------------------------------
#call @lore_rs.MoveNext()
#var lore_eof @lore_rs.EOF
}
#class discovery 1</value>
</alias>
<alias name="lore_searchbyname" id="44">
<value>#echo Looking up "'"%params"' in lore database..."
#var lore_sql "SELECT id,zone,mob,name,REPLACE(REPLACE(lore,'\r\n','\n'),'\n','\r\n') AS lore,REPLACE(REPLACE(notes,'\r\n','\n'),'\n','\r\n') AS notes,created_at FROM items WHERE name = '"%replace(%params,"'","\'")"' ORDER BY created_at"
lore_searchbysql
#echo All results returned.</value>
</alias>
<alias name="lore_searchbysql" id="45">
<value>#var lore_rs %comcreate("ADODB.RecordSet")
#call @lore_rs.Open(@lore_sql,@lore_db)
lore_presentrecordset
#var lore_rs ""</value>
</alias>
</module>




(as a side note: if anybody can help me do parameterized queries with just cmud scripting and its com api, i'd be elated :D)
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Tue Aug 04, 2009 5:18 am   
 
The problem maybe that when you post the code to a website, the '& lt ;' gets translated to a '<' and then can't be imported by CMUD. Similarly the '>'. This is especially important when it occurs within the trigger pattern. Compare your first trigger to my example posted here.

Code:
<trigger priority="10" regex="true" id="1">
  <pattern>(are|is) using:$</pattern>
  <trigger regex="true">
    <pattern>^(<.*>\s+)([a-zA-Z0-9\-\' ]+)(.*)$</pattern>
    <value>lore_addrecentitem %trimright(%2)
#SUBSTITUTE {%char(27)"[2z"%1%char(27)"[1z"%2""%3}</value>
  </trigger>
</trigger>


This is especially important when the '
_________________
Asati di tempari!
Reply with quote
freyr
Newbie


Joined: 11 Dec 2007
Posts: 2

PostPosted: Fri Aug 07, 2009 3:19 pm   
 
I wish that were the case; I've only been distributing the .pkg file, and using cmud's script library. Neither are working as advertised.

(I only included the xml of the script itself in this post to see if something had been corrupted or saved improperly, which i'd have hoped to be picked up by one of the resident experts. :)
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23381
Location: Colorado, USA

PostPosted: Fri Aug 07, 2009 4:19 pm   
 
You could email me the PKG file at [email protected]. But if they are using the *.PKG file directly, then there isn't any issue with any sort of conversion...they should see exactly the same thing that you see in your package file. v2.37 might have had some XML import/export problems that were fixed in the 3.x beta, but that shouldn't impact using the PKG file directly.

I'm assuming that you are telling people to store the *.PKG file in their My Documents/My Games/CMUD/Packages directory and then click the Edit Session for their session and then click the + button to add your package to their session?
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net