Welcome Guest (107.21.156.140)! (Login - Register)
Your Ad Here
Home - FAQs - Forums - Join a Game - Game Index - Links

Generators (Topic #30175)

Main Forum (#13) > Site Questions, Suggestions, and Admin Requests (#931) > Site Feature Descriptions (#30486) > Generators

Roleplay Market



Subscription Options

You must be logged in to subscribe to this topic by e-mail or to add it to your favorites.



Support RPM through Kachingle or Flattr:


Post Reply
Body
BobTHJ

Owner of the Market
1/5/2010 11:37:07 AM
PostID: 328772
Generators are a new feature added to RPM as of 01/05/2010.

Generators allow you to randomly generate random results for names, treasures, NPCs, etc. quickly and easily. Some of you may be familiar with TableSmith or Abulafia....this works in a similar fashion.

To make a generator, simply create a new topic of the type "Generator". A generator is a 'table' from which random results can be chosen. Each row in the table has a probability and a result. You can add new rows to a generator by typing them in the box below the generator display. For example, entering the following:
1|Roleplay Market
2|Google
5|MSN

would create a generator with three rows. When called, 1/8 of the time "Roleplay Market" would be chosen, 1/4 of the time "Google" would be chosen, and 5/8 of the time "MSN" would be chosen (the probability is a relative weight).

You can use smart tags, HTML, and other RPM specific tag-language in the generator results, including calls to other generators. You can also use and IScript function call in place of the probability to make a generator with dynamic probabilities. For example, the following would be valid generator rows:
1|<*#My Generator*>
(+ 2 3)|<gen>Another Generator</gen>


Once you have created a generator you can call it from other posts, documents, etc. within Roleplay Market to generate random results. There are two ways to call a generator. The first is to use a smart tag topic include like this:
<*#(generator)*>

In the above example you would replace (generator) with the topic name or topic ID number of your generator. When included this way, the generator is queried and new random results are generated each time someone views the text you entered. If you'd rather generate results once and use those same results for all future pageviews then use the new <gen> tag like this:
<gen>(generator)</gen>

Again, replace (generator) in the above with the topic name or ID number of your generator.

NOTE ON IMPLEMENTATION
generators with a large number of rows (100+), generators using many nested generator calls, or generators making excessive use of IScript may run slowly. You can improve performance of your generators by using the TopicID numbers instead of Topic Names when making generator calls. To prevent infinite loops that lock up the processor nested generator calls are limited to 50 levels....contact me if you need to exceed this maximum.
  This post last edited on 1/5/2010 11:39:32 AM   Like this post 2 users like this post
BobTHJ

Owner of the Market
1/5/2010 11:51:21 AM
PostID: 328780
Oh, by the way...

If you do any experimenting with this new feature link your results here. I'm curious to see what ideas you guys come up with to use this.
   Like this post
BobTHJ

Owner of the Market
1/5/2010 12:39:02 PM
PostID: 328788
Repost here since it applies:
New IScript Function

To enhance the new Generators feature:

Generate
Generates random results from a generator. Takes three or four parameters. The first is the topicID of the generator to generate from. The second is a boolean; If not-nil, then each row from that generator will be returned a maximum of once. The third is an integer specifying the number of times to generate results from this table. The fourth optional parameter is a list of weights. If this parameter is specified then the normal probability weights for this table will be overridden with those weights specified in the fourth parameter. Returns a list containing the generated results.
Example: (Generate 30007 nil 3) Returns: (3 results from the generator, with the possibility of duplicates)
Example 2: (Generate 30007 t 5) Returns: (5 results from the generator, with no duplicates)
Example 3: (Generate 30007 nil 1 (List 3 3 3)) Returns: (one result from the generator, overriding the probability weights of the first three rows in the generator with 3).
   Like this post
zilonox
avatar
Honored Guide
1/5/2010 1:15:43 PM
PostID: 328800

As a quick experiment, I decided to try an old standby - the Tavern/Inn Name Generator.

I created three generators: TavInnAdj, containing descriptive words; TavInnNoun, containing objects; and TavInnEnd, containing synnonyms for Tavern/Inn.

At this point, there aren't many entries in any of the tables (only about 10 in each), but as I said, this was just a quick experiment. Also, I'm not certain what permissions need to be set on the generator documents to ensure they work for everyone, so if you don't see any examples below, then let me know and I'll try to adjust the permissions level.

For the examples, I will show the code I used and then show the results. I went with the smart tag option BobTHJ listed above, so everytime you refresh the page you should get a new set of examples.

Example 1
The <*#TavInnAdj*> <*#TavInnNoun*>
The Laughing Cog

Example 2
<*#TavInnAdj*> <*#TavInnNoun*> <*#TavInnEnd*>
Wanton Tempest Taproom

Example 3
The <*#TavInnNoun*> and <*#TavInnNoun*> <*#TavInnEnd*>
The Hand and Oak Cellar

 


These are the cries of the carrots, the cries of the carrots!
You see, Reverend Maynard, tomorrow is harvest day and to them it is the holocaust.
 

  This post last edited on 1/5/2010 1:19:28 PM   Like this post
BobTHJ

Owner of the Market
1/5/2010 1:46:45 PM
PostID: 328808
Just to add to Zilonox's tavern name generator, and to demonstrate how nested Generators can work, I took Z's three examples above and combined them into a new generator: TavernName. You can query it like this:
<*#TavernName*>

and it will respond with a tavern name as generated using one of the Zilonox's three examples above (chosen at random). Here are some samples:

Secret Tankard Coachhouse
The Fiery Crown
Nine Perch Barroom

   Like this post
zilonox
avatar
Honored Guide
1/5/2010 1:52:45 PM
PostID: 328813

LOL! You beat me to it, Bob. I was going to create a similar meta-generator once I did a bit more planning. I was thinking of adding verb and adverb generators as well.

In the meantime, I added a ton more options to the adjective and noun generators, thanks to Bob's foresight in allowing multiple entries to be added at one time. *That* is a real time saver, so thanks, Bob!
 


These are the cries of the carrots, the cries of the carrots!
You see, Reverend Maynard, tomorrow is harvest day and to them it is the holocaust.
 

   Like this post
valadam
avatar
Lucky Punk
1/5/2010 1:54:09 PM
PostID: 328815
I can't see any of the results.
   Like this post
zilonox
avatar
Honored Guide
1/5/2010 2:12:12 PM
PostID: 328821

valadam, I've adjusted the view permissions on my generators to 'Everyone'. Let me know if that allows you to view the results...
 


These are the cries of the carrots, the cries of the carrots!
You see, Reverend Maynard, tomorrow is harvest day and to them it is the holocaust.
 

   Like this post
BobTHJ

Owner of the Market
1/5/2010 2:28:50 PM
PostID: 328827
valadam: There was a permissions bug that I think I fixed. Let me know if you can now see the generated results.
   Like this post
valadam
avatar
Lucky Punk
1/5/2010 2:40:45 PM
PostID: 328832
They're all there now.
   Like this post
valadam
avatar
Lucky Punk
1/5/2010 2:46:45 PM
PostID: 328836
A new thing now though, I am noticing that they are changing each time I refresh the page.
  This post last edited on 1/5/2010 2:48:20 PM   Like this post
BobTHJ

Owner of the Market
1/5/2010 2:52:00 PM
PostID: 328838
As they should, if you specify them in this format:
<*#TavernName*>


If you want them to generate initially and then remain the same (instead of changing each time the page is refreshed) use this format:
<gen>TavernName</gen>

   Like this post
BobTHJ

Owner of the Market
1/5/2010 4:47:28 PM
PostID: 328869
New addition for generators:

TAGS

Tags can be used in generators to filter or modify the results. To add a tag to a generator row just pick a tag name and surround it by @ symbols like this:
@(tag name here)@


All tags should appear at the end of the result - after all other text you would return. Tag names will not appear in the results. Yyou can include an alternate result after a tag for modification tags (see below).

Tags come in two varieties. To see an example of both, take a look at the Colors generator:

Filter Tags
These tags simply add some relevant information about the row that allows the end user of the generator to determine if they want to include that row as an option when generating results from that generator. The "Primary" tag in the Colors generator is an example of this.

Modification Tags
These tags allow you to return alternate results from a row. The "Hex" tag in the Colors generator is an example of this. When adding a modification tag to a row include the modified result directly after that tag.

Using Tags

When calling a generator, you can include an @ symbol after the name or ID of that generator followed by a list of tags. The tags should be separated by | (pipes), like this:
<*#My Generator@(first tag)|(second tag)|(third tag)*>


The generator will only return a result that contains all the specified tags. If no results match all the specified tags, then "nil" will be returned.

You can include a - (dash) symbol before the name of a tag to exclude results that contain that tag.

You can add a * (asterix) symbol before the name of a modification tag to return the alternate results specified by that modification tag.

Example:
<*#My Outfit Generator@Bottoms|-Underpants|*Female*>

If the above generator created clothing outfits, it would return only results with the @Bottoms@ tag that did not also contain the @Underpants@ tag. When available, those results would be modified to use the alternate text for @Female@ outfits.

Some examples using the Colors generator:
<*#Colors@Primary*> - returns only common colors
<*#Colors@-Primary*> - returns only uncommon colors
<*#Colors@*Hex*> - returns the HTML hex code for the color instead of its name (if available)
<*#Colors@Primary|*Hex*> - returns the HTML hex code of a common color

   Like this post
BobTHJ

Owner of the Market
1/6/2010 8:36:52 AM
PostID: 328974
Another addition for Generators:

Parameters

Parameters can be passed to a generator in the same manner as tags. This allows a generator to use custom information provided by the user of that generator to customize the results. Parameters are passed along with tags when calling the generator, like this:
<*#(generator name)@#(parameter name)=(value)*>
Example: <*#My Dungeon Generator@#Rooms=5*>


Precede the parameter name with a # (pound) symbol, and then use an = (equals) symbol after the name followed by the value to assign to that parameter.

Parameters can be used in the IScript of the called generator and all subsequently called nested generators. To use a parameter, treat it as an IScript variable, like this:
#(parameter name)
Example: (+ 2 #Rooms)


You can use parameters right along other tags when calling a generator, just separate each tag and parameter with a | (pipe) symbol.
   Like this post
BobTHJ

Owner of the Market
1/6/2010 9:46:13 AM
PostID: 328990
Initializing Generators:

You can cause a generator to run an IScript whenever it is called prior to generating results. Just store the IScript in a variable in the "Data" section of that generator (below the Secure Die Roller at the bottom). Name the variable "_ongenerate" (with a leading underscore) and set the value equal to the IScript (without opening or closing tags) that you wish to execute. The generator will execute that script prior generating results.

An initialization script like this can be handy for processing any parameters passed to your generator.
   Like this post
BobTHJ

Owner of the Market
1/9/2010 10:40:55 PM
PostID: 329662
Another update for Generators:

* if the "_ongenerate" initialization script (detailed in the post above) returns the word "tag" followed by an @ symbol and a tag list then that tag list will be appended to the tag list (if any) used to call the generator.

* You can use a + (plus) symbol in front of a tag to favor results containing that tag. Results containing that tag will be twice as likely to be returned as they normally would.

* You can use ! (exclamation) symbol in front of a tag to disfavor results containing that tag. Results containing that tag will be only half as likely to be returned as they normally would.

This will likely be the last update to this feature for a while. I'll try to compile all this information into one better organized FAQ.
  This post last edited on 1/9/2010 10:42:39 PM   Like this post
cromt
avatar
Destroyer of Worlds
1/10/2010 11:09:56 AM
PostID: 329717
Wow, neat stuff!
   Like this post
zilonox
avatar
Honored Guide
1/25/2010 11:53:18 AM
PostID: 332774

So, can I pass in an iScript variable as a tag to a generator?

Suppose I have the generators named g1, g2, g3 and g4. Generator g1 picks a result from g2, and then uses that result to pick results from g3 and g4.

My thoughts on how to accomplish this was to use an iScript in g1 something along the lines of:


(set var(<*#g2*>) (& (<*#g3@var*> <*#g4@var*>)))


Would that work? Or would the generator look for the literal "var" as a tag in g2 instead of the value represented by the variable var?

I can't use the following because I need the same tag/filter result when pulling from g3 and g4 and the code below (I believe) would pull a different random result from g2 for g3 and g4.


(& (<*#g3@<*#g2*>*> <*#g4@<*#g2*>*>))
 


These are the cries of the carrots, the cries of the carrots!
You see, Reverend Maynard, tomorrow is harvest day and to them it is the holocaust.
 

  This post last edited on 1/25/2010 12:11:27 PM   Like this post
BobTHJ

Owner of the Market
1/25/2010 12:48:06 PM
PostID: 332786
I don't think your IScript above would work as the smart tag parser only makes one pass over the document. Your script would require two passes (one to parse the IScript and the other to parse the Smart Tag include). My suggestion would be to use the generate function like this:

(Index (Generate (& g3@ (Index (Generate g2 nil 1) 0) nil 1) 0)


NOTE: You have to enclose the Generate function with the Index function because Generate returns a list.

Another option would be to use the Markup and Generate functions like this:

(Markup (& <*#g3@ (Index (Generate g2 nil 1) 0) *>))


The Markup function runs its only parameter through RPM's tag parser and essentially works as the "second pass" in your example above.


  This post last edited on 1/25/2010 12:49:57 PM   Like this post
BobTHJ

Owner of the Market
1/25/2010 12:55:25 PM
PostID: 332790
I didn't see your edit until after I posted, but yes...you would want to use the "Set" function to store the results of g2 if you want to generate both g3 and g4 from the same result - assuming you intend to call g3 and g4 from the same script.

If you need to call g3 and g4 in separate scripts (in different places on the same g1 generator row) then you could use SetData and GetData instead to temporarily store the results of g2.


   Like this post
page  of 2 pages containing 27 items.Items per page:

Your Ad Here

Home - Control Panel - FAQs - Forums - Join a Game - Create a Game - Game Index - User Directory - Privacy Policy -
System Time: 6/20/2013 2:15:59 AM
RPG,D&D Library VigLink badge