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
dazed-n-confused999
Wanderer


Joined: 03 Aug 2004
Posts: 79

PostPosted: Tue Apr 16, 2013 3:20 am   

help with long lists
 
1452h, 1452m dEeix- td drache
You examine the clues, sniff the air and question your intuition; you see an echo of Centre of the Cassiandora square marketplace.
It is within Mercinae.
Using your enhanced skill at Itemlore you recall nearby locations named: Cassiandora square marketplace. East of Cassiandora square. Grassy knoll at the centre
of the square. Southeast of Cassiandora square. South of Cassiandora square. Southwest of Cassiandora square. Cassiandora square marketplace. Cassiandora
square marketplace. Stock beneath a market stall.
1452h, 1452m dEeix-

It would be nifty if someone could help me by putting the list of locations after: Using your enhanced skill at Itemlore... into a string list variable.
This is one of the longest examples the game would produce, as you can see some names may get cut off mid-word and the message can cover 3 or more lines between prompts.
Any help is appreciated.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4690
Location: Pensacola, FL, USA

PostPosted: Tue Apr 16, 2013 5:11 am   
 
Code:
#TR {Using your enhanced skill at Itemlore you recall nearby locations named: (*)} {tempList=%params}
#COND {^%w} {
  tempList=%concat(@tempList, " ", %line)
  #STATE 1
} {within|Param=1}

#TR {^(%d)h, (%d)m} {
  #IF (@tempList) {
    $thisList=%replace(@tempList, ". ", ".|")
    @tempList=""
  //Some further processing of your new string list $thislist
  }
  //other stuff dealing with prompt data
} _nodef {prompt}


Something like this should work... untested
_________________
Discord: Shalimarwildcat
Reply with quote
dazed-n-confused999
Wanderer


Joined: 03 Aug 2004
Posts: 79

PostPosted: Wed Apr 17, 2013 1:41 am   
 
That worked like a charm!
first trigger I used verbatim, the second one I just added:
#IF (@tempList) {thisList = %replace( @tempList, ". ", ".|")} to my prompt trigger.
tried to do the second one cut/paste and gave some parsing error, but it seems to be working great now.
Thank you again.
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Fri Apr 26, 2013 5:14 pm   
 
Playing Avalon eh? :-)

Why add it to your prompt trigger? Create an onPrompt event for things like this. Keep it separated.

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <var name="locationList" usedef="true" copy="yes">
    <json>[]</json>
  </var>
  <var name="tempList" usedef="true" copy="yes"/>
  <trigger name="locationRecall" priority="70" regex="true" copy="yes">
    <pattern>^Using your enhanced skill at Itemlore you recall nearby locations named\: (.+)</pattern>
    <value>#T+ RecordLocations
tempList = %params</value>
    <trigger type="Within Lines" param="1" regex="true">
      <pattern>.+</pattern>
      <value>tempList = %concat(@tempList, " ", %line)
#STATE 1</value>
    </trigger>
  </trigger>
  <trigger name="prompt" priority="80" regex="true" newline="false" prompt="true" copy="yes">
    <pattern>^(\d+)h, (\d+)m ([bexpvydlohczfiwa]*)\-</pattern>
    <value>#raiseevent onPrompt</value>
  </trigger>
  <event event="onPrompt" priority="90" name="RecordLocations" enabled="false" copy="yes">
    <value>#T- RecordLocations
#if (@tempList)
{
  locationList = %replace(@tempList, ". ", ".|")
  tempList = ""
}</value>
  </event>
</cmud>
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