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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
easal
Novice


Joined: 21 Jun 2005
Posts: 38

PostPosted: Mon Jan 28, 2008 6:26 pm   

Problem parsing a rift list.
 
Alright, here's the output from the game. This changes, if you don't have anything in a slot, say blueberry for example, it dissapears so I can't trigger off the lines, only individual slots.


Code:
Glancing into the Rift, you see:
  [   8] blue ink           [  30] blueberry          [  62] coal
  [ 631] dandelion root     [   2] emerald            [  48] endive root
  [ 390] fenugreek          [ 448] galingale flower   [1058] ginger root
  [   3] gold               [   4] gold ink           [  45] green ink
  [  20] grub bait          [  31] hyssop stem        [   8] ice
  [ 101] iron               [  54] juniper berry      [ 295] kelp
  [ 252] laurel             [ 165] leather            [ 357] linseed
  [ 366] lovage             [  79] maidenhair leaf    [ 101] mandrake root
  [ 512] myrrh gum          [ 259] nightshade root    [ 110] orichalcum
  [ 250] orphine seed       [  20] pellet             [   1] platinum
  [ 206] prickly pear       [  23] primrose           [  16] purple ink
  [ 253] quince fruit       [ 300] red ink            [ 250] rope
  [   1] ruby               [   6] saltpetre          [  20] shrimp bait
  [ 139] silver             [  75] steel              [  69] sulphur
  [  17] toadstool          [   2] venom sac          [ 456] violet root
  [  23] weed               [  40] wood               [  19] worm bait
  [ 541] wormwood root      [  13] yellow ink


I make a new trigger

#tr ~[ %1~] blueberry {#va blueberry %1} in a class on its own called rifts.

I type ir (brings up the riftlist) and see what happens. Zmud has created a new class called ink and placed the @blueberry var in it with the value 8]

Both presumably from the entry before blueberry.

I have -no- idea what I'm doing wrong here. Any help would be more than appreciated.


Edit: Oh, to explain what I want to do, basically harvest the values into variables and spew out a nicer looking format with an echo or say. Inks together, herbs together, comms together etc.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Mon Jan 28, 2008 6:34 pm   
 
"it dissapears so I can't trigger off the lines, only individual slots."

Oh, you can't? Regex:

Code:
^  \[\s*(\d+)\] ([a-z ]+)\s*(?:\[\s*(\d+)\] ([a-z ]+)\s*)?(?:\[\s*(\d+)\] ([a-z ]+))?


As for zMUD putting your new variables in a new class, I'd use a data record variable rather than a huge group of variables and completely delete it each time you check the rift, with something like

Code:
#oninput {ir} {}
#cond {Glancing into the Rift, you see:} {#var RiftContents ""} {within|param=5}
#cond {^  \[\s*(\d+)\] ([a-z ]+)\s*(?:\[\s*(\d+)\] ([a-z ]+)\s*)?(?:\[\s*(\d+)\] ([a-z ]+))?} {#addkey RiftContents %2 %1;#if (%3) {#addkey RiftContents %4 %3};#if (%5) {#addkey RiftContents %6 %5} {regex|looplines|param=20}


Might need to use %trim on the item names, I'm not sure whether the [a-z ]+ will capture all the extra spaces.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
easal
Novice


Joined: 21 Jun 2005
Posts: 38

PostPosted: Mon Jan 28, 2008 7:13 pm   
 
Hrm I'll see what I can make of it. Thanks Fang.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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