|
Quit Wanderer
Joined: 19 Jul 2008 Posts: 59
|
Posted: Fri Aug 29, 2008 10:18 am
<send></send> |
hi
mud output:
Code: |
You still have to kill * a yellow-winged sparrow (A Natural Platform).
|
and my script:
Code: |
<trigger priority="5570" id="557">
<pattern>^You still have to kill ~* (*) ~((*)~)</pattern>
<value><![CDATA[#VA cpmob {%1}
#VA walkzone {%2}
walkzone = %replace( @walkzone, ', "''")
cpmob = %concat( @cpmob, %repeat( " ", 25-%len( @cpmob)))
#IF (@cptype=ROOM) {#SUB {<color white>MOB</color> - <color lightgreen>@cpmob</color> <color white>ROOM</color> - <color lightblue><send '#MAPQUERY {[Name] LIKE '@walkzone'}'>@walkzone</send></color>}} {#SUB {<color white>MOB</color> - <color lightgreen>@cpmob</color> <color white>ZONE</color> - <color lightblue><send '#EXEC .@walkzone'>@walkzone</send></color>}}]]></value>
</trigger> |
but it this part I cant get to work:
Code: |
<send '#MAPQUERY {[Name] LIKE '@walkzone'}'>@walkzone</send> |
it only show me the second word when I mouse over the @walkzone, I have try to
play around with ' " () but without any luck
When I enter #MAPQUERY {[Name] LIKE '@walkzone'} in the command line it works and show me the room in the Spreadsheet View
and btw what is the <![CDATA[ in the start of the <value> and all the text betweed <value> </value> are all grey in the XML view |
|
|
|
Toxic Adept
Joined: 27 May 2008 Posts: 299
|
Posted: Fri Aug 29, 2008 1:56 pm |
BTW theres no reason to test if cptype = room. on cp check if its a room cp then theres a period at the end, if theres no period then its an area cp. So just include the . in your trigger like the output from the mud suggests and it will only match to cp rooms. Also its nice for when mob is dead and it shows area when its actually a cp room type.
As far as your issues with #MAPQUERY im not sure, I use %mapquery for everything.
The CDATA as I understand it is to escape special characters in the xml so that it will export properly. Basicly just ignore it.
Also redo your %replace to be this...
walkzone = %replace( %2, "'", "''")
Your wasting processing time assigning it to a variable then doing the replace. Also unless you use that walkzone variable elsewhere after its assigned might wanna think about using a local variable instead. |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Fri Aug 29, 2008 2:31 pm |
Try this:
Code: |
<send %concat('#MAPQUERY {[Name] LIKE ', @walkzone, '}')>@walkzone</send> |
I believe the problem is that the <send> statement can have 2 options within it, the second one defining the mouseover. Since @walkzone has a space in it, and is outside the quotes, the space is causing the last word to become the mouseover. The %concat will make sure the whole thing is one string. |
|
|
|
Quit Wanderer
Joined: 19 Jul 2008 Posts: 59
|
Posted: Fri Aug 29, 2008 3:35 pm |
This is my new code:
Code: |
#VA cpmob {%1}
walkzone = %replace( %2, "'", "''")
cpmob = %concat( @cpmob, %repeat( " ", 25-%len( @cpmob)))
#SUB {<color white>MOB</color> - <color lightgreen>@cpmob</color> <color white>ROOM</color> - <color lightblue><send %concat('#MAPQUERY {[Name] LIKE ', @walkzone, '}')>@walkzone</send></color>} |
But it gives me a:
ERROR: Trigger "^You still have to kill ~* (*) ~((*)~).$" fired but did not compile |
|
|
|
Toxic Adept
Joined: 27 May 2008 Posts: 299
|
Posted: Fri Aug 29, 2008 3:48 pm |
Try this...
Code: |
#VA cpmob %1
walkzone = %replace( %2, "'", "''")
cpmob = %concat( @cpmob, %repeat( " ", 25-%len( @cpmob)))
#SUB {<color white>MOB</color> - <color lightgreen>@cpmob</color> <color white>ROOM</color> - <color lightblue><send '#MAPQUERY {"[Name] LIKE '"@walkzone"'"}'>@walkzone</send></color>} |
EDIT: Tested... this works... |
|
|
|
Quit Wanderer
Joined: 19 Jul 2008 Posts: 59
|
Posted: Fri Aug 29, 2008 4:21 pm |
hmm dosent work here, I still only get the second word on mouse over and when I click on the @walkzone it output this:
'#MAPQUERY {[Name] LIKE 'A
You say '#MAPQUERY {[Name] LIKE 'A' |
|
|
|
Toxic Adept
Joined: 27 May 2008 Posts: 299
|
Posted: Fri Aug 29, 2008 4:24 pm |
Yeah I just noticed it. This works with multiple words, dont ask me how it works heh...
Code: |
#VA cpmob %1
walkzone = %replace( %2, "'", "''")
cpmob = %concat( @cpmob, %repeat( " ", 25-%len( @cpmob)))
#SUB {<color white>MOB</color> - <color lightgreen>@cpmob</color> <color white>ROOM</color> - <color lightblue><send '%replace( "#MAPQUERY {"[Name] LIKE ''"@walkzone"''"}","''","'")'>@walkzone</send></color>} |
The mouseover using this is messed up tho, but the link executes correctly |
|
|
|
Toxic Adept
Joined: 27 May 2008 Posts: 299
|
Posted: Fri Aug 29, 2008 4:35 pm |
I think this is actually a bug in <send> The issue is because the <send is parsing the single parenthesis inside of the #MAPQUERY command which cuts it short. So the solution was to escape them with '' then replace them with single ' after the compiling of the <send.
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Fri Aug 29, 2008 5:34 pm |
Yes, the problem is that there are too many quotes to deal with. The SEND tag needs it's command enclosed in quotes, but then the SQL query in #MAPQUERY needs to have it's own quotes too.
I think you are making this too hard and complicated. It seems like it would be much better to create an alias that performs the complex #MAPQUERY stuff. For example:
Code: |
#ALIAS mapquery {#MAPQUERY %concat("[Name] LIKE '",%1,"'")} |
and then use
Code: |
<send 'mapquery @walkzone'>@walkzone</send> |
or something like that. I other words, don't embed the complexity of your query into the SEND link itself...move the complexity into an alias. Makes it easier to understand and easier to debug and support in the future. |
|
|
|
Quit Wanderer
Joined: 19 Jul 2008 Posts: 59
|
Posted: Fri Aug 29, 2008 10:30 pm |
Thanks all got it to work now with a alias
#ALIAS mapquery {#MAPQUERY %concat("[Name] LIKE '",%-1,"'")} |
|
|
|
|
|