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
lazyfanatic
Newbie


Joined: 25 Feb 2004
Posts: 6

PostPosted: Mon Mar 01, 2004 6:31 am   

Splitting a list up.
 
I have a list called loot, the list is such:

a small clear topaz
a medium star diopside
a small red jasper
a medium star diopside
a rotting oaken skippet
a worm-eaten wooden coffer
a reinforced ironwood strongbox
a small rock crystal
a medium rock crystal
a mildewy ironwood casket
...etc

I need to strip the entire line to just the rightmost word. I can use %right if I know how far right the word is, but I don't have far the word will be since the line is variable. I looked through all of the functions and I can't figure out a combination that would give me the results I need.

My class so far:

#CLASS {Disarm and Lockpick}
#VAR keep_items {chest|strongbox|casket|crate|caddy|coffer|skippet}
#TRIGGER {In the * you see (*)} {#VARIABLE loot %replace( %replace( %replace( "%1", ",", "|"), ".", "|"), "and a", "|");#FORALL {@loot} {#ECHO %i}}
#CLASS 0

Any help would be appreciated.
Reply with quote
lazyfanatic
Newbie


Joined: 25 Feb 2004
Posts: 6

PostPosted: Mon Mar 01, 2004 6:38 am   
 
Nevermind. The answer is:
#LOOP %numitems( @loot) {#VAR loot %replaceitem( %word( %item( @loot, %i), %numwords( %item( @loot, %i))), %i, @loot)}

It works, if anyone else has any better ideas, I welcome them.
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