|
darmir Sorcerer
Joined: 10 Oct 2000 Posts: 706 Location: USA
|
Posted: Wed Sep 29, 2010 2:18 pm
Creating a trigger from another and using a variable |
Okay I have this menu that I want to be able to create a trigger from the selected text, but I can't get it to work.
Here is an example of the text.
A blue-eyed brown-haired man.
Here is my code:
Code: |
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<module name="Character Short Description" global="true">
<uid>{EE7BE685-DB0C-4F06-B6AF-A513B3C7D969}</uid>
<menu priority="20">
<caption>Add Character</caption>
<value>#local $Name $desc
$Name = %prompt("","Enter the name of the character")
#addkey friends $Name %selected
$desc = %selected
#TR {~{%selected~}} {#window Friends %db(@friends, %i)} Friends</value>
</menu>
<var name="friends" type="Record">
<value>John=a blue-eyed brown haired man|red=a blue-eyed brown haired man|dff=a blue-eyed brown haired man</value>
<json>{"John":"a blue-eyed brown haired man","red":"a blue-eyed brown haired man","dff":"a blue-eyed brown haired man"}</json>
</var>
<class name="Friends">
<trigger priority="120">
<pattern>~{%selected~}</pattern>
<value>#window Friends %db(@friends, %i)</value>
</trigger>
<trigger name="a blue-eyed brown haired man" priority="110">
<pattern>#window Friends %db(@friends, %i)</pattern>
<value>Friends</value>
</trigger>
</class>
</module>
<window name="Friends you know" commandline="false" statusbar="false" visible="false" dockalign="Bottom" left="708" top="292" width="450" height="200" host="none">
<uid>{2F4A8528-439E-47B3-A389-9CA269D7E440}</uid>
<dockuid>{EE7BE685-DB0C-4F06-B6AF-A513B3C7D969}</dockuid>
<packages>English Directions|English Keypad|Clickable URLs|Communication|Character Data Mining|Character Short Description|ShadowsofIsildur</packages>
</window>
</cmud>
|
Now when I look at the new trigger created it isn't putting the values of what was in %selected... Any ideas how to do this? Also I want to display both the key and the value for that trigger in my new window. |
|
_________________ Run as hard as a wild beast if you will, but you won't get any reward greater than that destined for you.
Source: (Egyptian) |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Wed Sep 29, 2010 5:25 pm |
You would need to do something like this:
Code: |
#TRIGGER %concat("~{",%selected,"~}") {#window... |
Otherwise any variable put into the trigger pattern is only expanded when the trigger is tested, not when it is created. |
|
|
|
|
|
|
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
|
|