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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » Finished MUD Scripts

Joined: 22 Nov 2003
Posts: 34

PostPosted: Fri Dec 12, 2003 8:17 pm   

Genesis Container Script
It seems the container scripts posted here are pretty MUD specific.
Here's one I use on Genesis. It's a bit different than all the
ones previously posted. To be more specific:

- Genesis stacks everything, so there is no need for the
%countlist function.

- Sometimes you see the number spelled out (two), and sometimes
it's a number (2).

- If you have a lot of one item, you can no longer count them by
looking at them, so you just see "many," or "a huge heap" of

Here's the script:

#CLASS {Containers}
#VAR contents {}
#VAR cardnums {one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twenty|twenty-one|twenty-two|twenty-three|twenty-four|twenty-five|twenty-six|twenty-seven|twenty-eight|twenty-nine|thirty|thirty-one|thirty-two|thirty-three|thirty-four|thirty-five|thirty-six|thirty-seven|thirty-eight|thirty-nine|forty|forty-one|forty-two|forty-three|forty-four|forty-five|forty-six|forty-seven|forty-eight|forty-nine|fifty|fifty-one|fifty-two|fifty-three|fifty-four|fifty-five|fifty-six|fifty-seven|fifty-eight|fifty-nine|sixty|sixty-one|sixty-two|sixty-three|sixty-four|sixty-five|sixty-six|sixty-seven|sixty-eight|sixty-nine|seventy|seventy-one|seventy-two|seventy-three|seventy-four|seventy-five|seventy-six|seventy-seven|seventy-eight|seventy-nine|eighty|eighty-one|eighty-two|eighty-three|eighty-four|eighty-five|eighty-six|eighty-seven|eighty-eight|eighty-nine|ninety|ninety-one|ninety-two|ninety-three|ninety-four|ninety-five|ninety-six|ninety-seven|ninety-eight|ninety-nine|one hundred}
#TRIGGER {^The (*) contains (*).$} {
  #VAR contents {%2}
  #VAR contents {%subregex( %subregex( %subregex( @contents, "^a |^an ", "1 "), ", an |, a | and a | and an ", "|1 "), ", | and ", "|")}
  #VAR contents {%replace( %replace( @contents, "many ", "Many "), "1 huge heap of ", "A huge heap of ")}
  #SUB {The %1 contains:}
  #FOR @contents {#IF {%ismember( %word( %i, 1), @cardnums)} {#SH {%ismember( %word( %i, 1), @cardnums) %trim( %remove( %word( %i, 1), %i))}} {#SH %i}}
  #SH %cr

This will change:

The leather pouch containing herbs (open) contains a little blue berry, four red berries, eight redweeds, 12 green berries and many golden flowers.


The leather pouch containing herbs (open) contains:
1 little blue berry
4 red berries
8 redweeds
12 green berries
Many golden flowers

The @cardnums variable simply stores all the number words so that
the function %ismember("two",@cardnums) = 2. This seems to be a
pretty simple solution for converting number words to actual
numbers. I also have a variable called "ordnums" for doing the same
thing with ordinal numbers. Works great.

Anyway, I hope this helps someone out there. I know it's not exactly
what previous posters on the topic were looking for, but I figured
I'd post it, since it's different and it works for me.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » Finished MUD Scripts 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