About Us
Products
Purchase
Downloads
Support
Forums
Contact Us
Site
 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
Fizgar
Magician


Joined: 07 Feb 2002
Posts: 333
Location: Central Virginia

PostPosted: Fri Jan 14, 2011 6:01 pm   

[3.33a] #addkey not working as expected
 
Just like the help file states you can do:
Code:
#addkey testdb {v1=50|v2=60}

and the value for v1 and v2 will be added to the db var correctly. However if you take the following trigger:
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger priority="30" copy="yes">
    <pattern>value1:%s(%d)%svalue2:%s(%d)</pattern>
    <value>#addkey testdb {v1=%1|v2=%2}</value>
  </trigger>
</cmud>

And on the command line type:
Code:
#show {value1: 10 value2: 20}

Only the first k/v pair is assigned.
_________________
Windows Vista Home Premium SP2 32-bit
AMD Athlon Dual Core 4400+ 2.31 GHz
3 GB RAM
CMUD 3.34
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Fri Jan 14, 2011 8:02 pm   
 
Additionally, creating an alias such as the one below refuses to work properly, either:

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <alias name="testadd" copy="yes">
    <value>#ADDKEY testdb {v1=%1|v2=%2}</value>
  </alias>
</cmud>


This has been tested with local variables, as well. The only key that is passed is the v1. Everything afterwards (no matter how many values you intend on setting) is ignored.
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Fri Jan 14, 2011 10:05 pm   
 
The number of parameters is irrelevant. It will only take the first one you use.
The trigger fires correctly since the variables %1...%N will echo correctly to the screen.
As to why both the trigger and alias fail, I imagine that the script body is processed by the same routine.
This only seems to apply to db records, string lists are processed correctly:
Code:

<trigger name="testtrig2" priority="30" regex="true" id="3">
  <pattern>^value1:\s*(\d+)\s*value2:\s*(\d+)\s*value3:\s*(\d+)$</pattern>
  <value>#additem testlist {%1|%2|%3}</value>
</trigger>

With input:
Code:

#show {value1: 37 value2: 71 value3: 91}

will produce:
Code:

<var name="testlist" type="StringList" id="5">
  <value>"37|71|91"</value>
  <json>[[37,71,91]]</json>
</var>
_________________
Sic itur ad astra.
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