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
Eyeless
Wanderer


Joined: 02 Dec 2001
Posts: 80
Location: Canada

PostPosted: Sat Jul 02, 2005 1:45 am   

Multiline capture to a variable
 
First off, I don't know how to multi line anything... But capturing to a string variable is way beyond me.

Here is an example of what I need to capture:

The following heavenly bodies are visible: //this is the trigger to start capturing.

Over half of the Cat is obscured by clouds.
The Heart is unobscured by clouds.
The Spider is unobscured by clouds.
The Ram is unobscured by clouds.
The Dolphin is unobscured by clouds.
Fully half of the Wolf is blocked by the clouds overhead.
All but the smallest bit of the Toad is obscured by clouds.
Two-thirds of the Magpie is blocked by cloud cover above.
Over half of the Raven is obscured by clouds.
The Wolverine is unobscured by clouds.
The Unicorn is unobscured by clouds.
All but the smallest bit of the Albatross is obscured by clouds.
A rather large cloud has covered nearly a third of the Cobra.
Two-thirds of the Mongoose is blocked by cloud cover above.
The Giant is unobscured by clouds.
A rather large cloud has covered nearly a third of the Dove.
You notice Xibar is in the sky.
You didn't notice Katamba.
You didn't notice Yavash.
Roundtime: 56 seconds. // This line ends what I want in the variable.


When I am done, I want the variable to be Xibar|Dove|Giant|Mongoose|Cobra|Albatross|Unicorn|Wolverine|Raven|Magpie|Toad|Wolf|Dolphin|Ram|Spider|Heart|Cat

Now I am not asking someone to write this for me, but a good step in the right direction would be greatly appreciated.
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Sat Jul 02, 2005 11:23 am   
 
Should start you off:
Code:
#CLASS {heavenlyBodies} {disable}
#VAR heavenlyBodies {Cat|Heart|Spider|Ram|Dolphin|Wolf|Toad|Magpie|Raven|Wolverine|Unicorn|Albatross|Cobra|Mongoose|Giant|Dove|Xibar} {}
#TRIGGER {^A rather large cloud has covered nearly a third of the (%w).$} {#additem heavenlyBodies {%1}}
#TRIGGER {^All but the smallest bit of the (%w) is obscured by clouds.$} {#additem heavenlyBodies {%1}}
#TRIGGER {^Fully half of the (%w) is blocked by the clouds overhead.$} {#additem heavenlyBodies {%1}}
#TRIGGER {^Over half of the (%w) is obscured by clouds.$} {#additem heavenlyBodies {%1}}
#TRIGGER {^The (%w) is unobscured by clouds.$} {#additem heavenlyBodies {%1}}
#TRIGGER {^Two-thirds of the (%w) is blocked by cloud cover above.$} {#additem heavenlyBodies {%1}}
#TRIGGER {^You notice (%w) is in the sky.$} {#additem heavenlyBodies {%1}}
#TRIGGER {^Roundtime: %d seconds.$} {#say @heavenlyBodies;#class {heavenlyBodies} (0)}
#CLASS 0
#TRIGGER {^The following heavenly bodies are visible:$} {#class {heavenlyBodies} (1);#variable heavenlyBodies {%null} {%null} "heavenlyBodies"}


Guinn
_________________
CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;)
Reply with quote
mr_kent
Enchanter


Joined: 10 Oct 2000
Posts: 698

PostPosted: Sat Jul 02, 2005 7:45 pm   
 
Guinn's solution will create a striing-list variable.

Your original variable was reverse ordered. Is Guinn's solution satisfactory, or does the variable need to be ordered?
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