# O.G.R.E: Online Generic Randomizer Engine



## Morrus

This is the OGRE discussion thread.

http://www.enworld.org/forum/dnd_portal.php

Info/help page: http://www.enworld.org/forum/showwiki.php?title=O-G-R-E


----------



## Janx

nice write up on how the syntax is working out.

Looks like it covers the bases of what we talked about, and I'm looking forward to seeing the working product.


----------



## Morrus

Janx said:


> nice write up on how the syntax is working out.
> 
> Looks like it covers the bases of what we talked about, and I'm looking forward to seeing the working product.




Should be very soon!


----------



## Morrus

Janx said:


> nice write up on how the syntax is working out.
> 
> Looks like it covers the bases of what we talked about, and I'm looking forward to seeing the working product.




If you're interested in taking a look, Janx, feel free to play around here:

http://www.enworld.org/dnd_portal.php

Note that of the scripting functions, only the dice roll is coded at present. The other scripts will be added in v1.1.


----------



## Janx

yippee!  I'll try to check it out tomorrow.  stuck working on stuff tonight.


----------



## Morrus

Just a kind of idea of where it's at right now - this was quickly whipped up and could obviously be less formulaic with a bit more effort:

_The planet Mindartis, a gargantuan icy interplanetary age world, known for its deposits of copper in the east, warring factions, and its many active volanoes orbits a tiny yellow star. This planet is fourth in its system, has a dense atmosphere, 2 moons and a population of hundreds of millions. Its flag is a red oval on a violet triangle. Vaccination against harbek dyloma is recommended before visiting; symptoms include joint aches and coma. _


_<HR>_
_The planet Paelias, a gargantuan jungle medieval world, known for its deposits of iron in the northwest, remarkably fast horses, and its lawlessness orbits a huge violet star. This planet is tenth in its system, has a standard atmosphere, 2 moons and a population of tens of millions. Its flag is a indigo star on a violet triangle. Vaccination against fargrim opia is recommended before visiting; symptoms include itchiness and blurred vision. _


_<HR>_
_The planet Arannis, a small mountainous stone-age world, known for its deposits of adamantium in the west, unusual alien race - the Rhogar - , and its exotic plantlife orbits a small yellow star. This planet is eighth in its system, has a thin atmosphere, 3 moons and a population of trillions. Its flag is a orange square on a red triangle. Vaccination against orsik sclerosis is recommended before visiting; symptoms include convulsions and pustules. _


_<HR>_
_The planet Hadarai, a huge mountainous late industrial world, known for its deposits of tin in the east, exotic plantlife, and its hospitality to visitors orbits a gargantuan red star. This planet is third in its system, has a very thin atmosphere, 2 moons and a population of a few hundred. Its flag is a red circle on a blue hexagon. Vaccination against rangrim mycosis is recommended before visiting; symptoms include paranoia and convulsions. _


_<HR>_
_The planet Aramil, a large desert late industrial world, known for its deposits of lead in the northwest, hospitality to visitors, and its unfriendly natives orbits a small yellow star. This planet is third in its system, has a standard atmosphere, 1 moons and a population of tens of millions. Its flag is a red star on a indigo circle. Vaccination against harbek dystrophy is recommended before visiting; symptoms include joint aches and headache._


----------



## Morrus

So I think we've got most of the bugs; seems to be running fairly smoothly now. Time to start work on those scripting upgrades!


----------



## Kilmore

*Random Grandma Generator*

It's giving me a database error when I try to post my Random Grandma Generator. It previews fine though. Here's what I typed.

As a human (or other temporary person), you should have two grandmothers, one on your mother's side, and one on your father's side. Both are (or were) remarkable people.

Your maternal grandmother is {5d10+25} years older than you and is {Kilmore(Grandma Mortality)}. {Kilmore(Grandma Description)} She is remarkable in the following ways. {Kilmore(General Grandma)}

Also, if she is deceased, the following applies to her. {Kilmore(Dead Grandma)} 

If she's still alive, this applies to her. {Kilmore(Living Grandma)}

Your paternal grandmother is {5d10+25} years older than you and is {Kilmore(Grandma Mortality)}. {Kilmore(Grandma Description)} She is remarkable in the following ways. {Kilmore(General Grandma)}

Also, if she is deceased, the following applies to her. {Kilmore(Dead Grandma)} 

If she's still alive, this applies to her. {Kilmore(Living Grandma)}


----------



## Morrus

Kilmore said:


> It's giving me a database error when I try to post my Random Grandma Generator. It previews fine though. Here's what I typed.




What does the database error say?


----------



## Kilmore

Database error 
The EN World: RPG News & Reviews database has encountered a problem. 

--------------------------------------------------------------------------------

Please try the following: 
Load the page again by clicking the Refresh button in your web browser. 
Open the www.enworld.org home page, then try to open another page. 
Click the Back button to try another link. 

The www.enworld.org forum technical staff have been notified of the error, though you may contact them if the problem persists. 

We apologise for any inconvenience.


----------



## Fox Lee

A few questions (which may be worth clarifying in the wiki text itself)

Tables can reference tables - does this include themselves? Like, could you implement the oft-seen "100) Roll twice" by giving your table its own name in position 100?

Can scripts be used in tables or only in generators? If they can be used in tables, do I put them before or after the body of the table, or can I use them between rows?

Is the example given the exact syntax for a table - i.e.: 
1) Thing1
2) Thing 2
...etc.? Are the brackets, spaces and line breaks necessary for O.G.R.E to recognise the table items?And can one use leading zeroes (like, 01 instead of 1)?

Can you use a number range in the table, e.g. 01-05 as in the image example, or must you make multiple entries for a particular result if you want that one to be more probable than another?

(EDIT: Remembered that this thread is pretty old and I should probably mention  [MENTION=1]Morrus[/MENTION] or something if I want a response ^^; Did I do that right?)


----------



## Morrus

Fox Lee said:


> A few questions (which may be worth clarifying in the wiki text itself)
> 
> Tables can reference tables - does this include themselves? Like, could you implement the oft-seen "100) Roll twice" by giving your table its own name in position 100?




No, it won't let you create a possibly infinite loop.



> Can scripts be used in tables or only in generators? If they can be used in tables, do I put them before or after the body of the table, or can I use them between rows?




Certainly some can be used in tables; I haven't tried them all.  I don't understand the second half of your question.



> Is the example given the exact syntax for a table - i.e.:
> 1) Thing1
> 2) Thing 2
> ...etc.? Are the brackets, spaces and line breaks necessary for O.G.R.E to recognise the table items?And can one use leading zeroes (like, 01 instead of 1)?




I'm not understanding the question again.

I'm guessing you haven't seen the system yet?  It was active a while ago before the hack, and there's a beta version active now.  When you see it, you'll see that tables are created in text box fields, not a blank canvass.  Generators are creates on blank canvasses.  So you can't insert things between table rows, and the brackets and spaces aren't actually part of the system.  A quick look will totally clear all that up for you (I've put a link at the bottom of this post).



> Can you use a number range in the table, e.g. 01-05 as in the image example, or must you make multiple entries for a particular result if you want that one to be more probable than another?




Yes.

It's probably easier for you to just play around with the system itself.  Bear in mind it may be slightly buggy.


----------



## Fox Lee

Nope, never seen the system. The information given in the wiki article was all I could find, so I assumed it was an example of how the system actually worked. I see it now! Thanks.


----------



## Morrus

Fox Lee said:


> Nope, never seen the system. The information given in the wiki article was all I could find, so I assumed it was an example of how the system actually worked. I see it now! Thanks.




Feel free to try it out! The more the merrier!


----------



## coriolis

Can we edit exisiting tables which we haven't built? There's a typo in the last sentence of the Sci Fi Corporation Generator that should be fixed ("It's main breakthrough is..." should be "Its main breakthrough is...")


----------



## Morrus

coriolis said:


> Can we edit exisiting tables which we haven't built? There's a typo in the last sentence of the Sci Fi Corporation Generator that should be fixed ("It's main breakthrough is..." should be "Its main breakthrough is...")




No, you can't alter other people's tables; you can just reference them. Thanks for pointing that out though!


----------



## Hedrik

*Error saving first test generator...*

Just tried creating my first generator:

"This is a test of the {Mephos[Disease]} O.G.R.E system."


Unfortunately when I tried saving it, or even previewing it, I received the following error:

"An error occured in getting the block for Disease."


Note please that I did copy/paste the generator reference from the generator's description page (id=270) as recommended, rather than typing it in by hand.

I do see that this generator has the category of "No category" - perhaps that is the issue?  If so, I recommend not allowing saves without a category being selected...


----------



## Morrus

*O.G.R.E.*

Try using his table, rather than his generator. I get the same issue with his generator, but using his table works fine.  His generator just prints the table.


----------



## Hedrik

It must be the category then - we have an RFE!


----------



## Morrus

Hedrik said:


> It must be the category then - we have an RFE!




Radio Free Europe?


----------



## Nylanfs

Is there a way to see another persons table? I like the sci-fi corp one, and would like to use it as a base for a modern one without the space specific stuff.


----------



## Nylanfs

NM Found it


----------



## Nylanfs

Is there a "quick" way to import a large number of items into a table? I have several lists of items in a plain text file that I'd like to make tables from to make a generator


----------



## Morrus

*O.G.R.E.*



Nylanfs said:


> Is there a "quick" way to import a large number of items into a table? I have several lists of items in a plain text file that I'd like to make tables from to make a generator




Sorry, nope. Gotta do it manually!


----------



## Fox Lee

Morrus said:


> Feel free to try it out! The more the merrier!



Yeah, I feel like a bit of a jackass. I _tried_ to experiment, but on closer inspection what happened was that I didn't notice the tabs for creating generator/table/etc. So what I saw was the default page after clicking "create", which is the mostly-empty Generator form, which led to me thinking the table structure must have been expressed in text. Huge fail and such >3>;

Anyway, I will be messing with it once I have today's assignment done ^^ I have a race called the soratami whose language basically uses Japanese syllables, and that seems like the easiest thing ever to make a name generator, so good times.


----------



## Hedrik

LOL!  RFE = Request For Enhancement...


----------



## Nylanfs

Nylanfs said:


> Is there a way to see another persons table? I like the sci-fi corp one, and would like to use it as a base for a modern one without the space specific stuff.




Okay I thought that "Browse Generator/Table" option under Create table would show how a table/generator was created but it doesn't. So back to my original question, Is there a way to see a generator's construction?


----------



## Morrus

Nylanfs said:


> Okay I thought that "Browse Generator/Table" option under Create table would show how a table/generator was created but it doesn't. So back to my original question, Is there a way to see a generator's construction?




There's an example of one on the help page.  It's just a text box, but you insert tags where you want stuff to appear, but you can copy the example I put there.


----------



## Texicles

So, without the ability to self-reference for things like "roll again," I assume the way to handle this would be to create two tables which are identical except for their names and have them reference each other on the reroll case. Is this correct?

If it is, any chance we could get a way to copy tables to cut down on repetitive data entry (or could someone kindly tell me where it is if such a thing exists already)?

Finally, in dabbling tonight, I haven't quite figured out math (e.g. multiplication). Say I want 3d6*5, is there a syntax for that? I created some tables to return the values I wanted, but I can't help but think that was not the best way to go about it.

Either way, this is both fun and exciting, and I'm going to try to dedicate some time to working on this. I can't promise I'll come up with any interesting/fun/exciting/useful generators, but I'll do my best to populate some tables for others to use.


----------



## Zaltys

Texicles said:


> Finally, in dabbling tonight, I haven't quite figured out math (e.g. multiplication). Say I want 3d6*5, is there a syntax for that? I created some tables to return the values I wanted, but I can't help but think that was not the best way to go about it.



This seems to work:
{$temp: {3d6}}{$temp: $temp*5}{print: $temp}

Also, I noticed that it doesn't seem possible to reset variables. This rolls the same number twice: 
{$temp: {3d6}}{print: $temp}
{$temp: {2d5}}{print: $temp}


----------



## Morrus

*O.G.R.E.*



Texicles said:


> Finally, in dabbling tonight, I haven't quite figured out math (e.g. multiplication). Say I want 3d6*5, is there a syntax for that?




Yes: {3d6*5}.


----------



## kungfuchris99

Can we create new categories? If so, how? If not (which totally makes sense), can you create a "Superheroes" category? I have a ton of superhero RPG tables and generators I'd like to create. 

--Chris M.


----------



## Morrus

*O.G.R.E.*



kungfuchris99 said:


> Can we create new categories? If so, how? If not (which totally makes sense), can you create a "Superheroes" category? I have a ton of superhero RPG tables and generators I'd like to create.
> 
> --Chris M.




Sure thing; I can create those.


----------



## kungfuchris99

Morrus said:


> Sure thing; I can create those.




Thanks! I have begun putting the category to good use.  


--Chris M.


----------



## kungfuchris99

I have a functionality request: Could we make it where, when editing a table and then saving it, the code could re-sort the table by range? In other words, let's say I have a table like this: 

1d10

1-3: sword
4-5: axe
6: mace
7-8: spear
9-10: club

Then let's say I want to add a warhammer table item. Rather than re-jiggering the whole table, I want to just add a row and set its range like so:

7: warhammer

And then edit the spear range appropriately:

8: spear

So what the revised table would look like before clicking to save the table: 

1-3: sword
4-5: axe
6: mace
8: spear
9-10: club
7: warhammer

And after saving it would look like this:

1-3: sword
4-5: axe
6: mace
7: warhammer
8: spear
9-10: club

So when saved the table is re-sorted by range.

Obviously in the above example redoing the whole table wouldn't be a big deal, but I already have tables that have dozens and dozens of entries, and as new items for that table occur to me, or users suggest items to add, it becomes a giant pain to add them to the end of the table and then go and re-edit all or most of the ranges for the items that were already in the table. 

Does that make sense? 


--Chris M.


----------



## Morrus

It makes sense, yep - it's an observation I've made myself.  I'll definitely add it to the list of improvements I want to make to OGRE, but it is a long list, so it may take quite some time!


----------



## Nylanfs

Could I make a request also? I REALLY think it would help to be able to import CSV (or plain-text files) of some type. I'm making a name generator from PCGen's plain text file of the 1990 US Census data, and in JUST the female given names there are 4275 lines.


----------



## Morrus

I wouldn't recommend a 4000+ entry table, Nylanfs.  You might want to split that up.  It won't perform well.


----------



## Nylanfs

Yea I was already thinking of breaking them up alphabetically.


----------



## kungfuchris99

Morrus said:


> It makes sense, yep - it's an observation I've made myself.  I'll definitely add it to the list of improvements I want to make to OGRE, but it is a long list, so it may take quite some time!




lol! Totally understand that.  

BTW, and I ask purely out of vanity, is there a way to tell what other tables or generators by other folks are using my tables or generators? It'd be a nice warm fuzzy to see where else my efforts are being put to good use. 


--Chris M.


----------



## Morrus

*O.G.R.E.*



kungfuchris99 said:


> lol! Totally understand that.
> 
> BTW, and I ask purely out of vanity, is there a way to tell what other tables or generators by other folks are using my tables or generators? It'd be a nice warm fuzzy to see where else my efforts are being put to good use.
> 
> 
> --Chris M.




Again, totally something I want myself! Eventually, I hope


----------



## Hand of Evil

Added Insanites and Phobias tables  - will be working on some character traits


----------



## Octangula

So, I've run into an interesting problem. I'm looking for a way to specify both the singular and plural form of something, without having to fork the table and worrying about them being out of sync. For most words, this will be simple, but some words just don't pluralize easily by adding one (or more) letters on the end. Any suggestions?


----------



## Morrus

*O.G.R.E.*



Octangula said:


> So, I've run into an interesting problem. I'm looking for a way to specify both the singular and plural form of something, without having to fork the table and worrying about them being out of sync. For most words, this will be simple, but some words just don't pluralize easily by adding one (or more) letters on the end. Any suggestions?




It's a tricky little puzzle that I haven't figured out yet. So far, I can only cone up with a convoluted method of having two tables (one with plurals, one with singular) and using an IF statement to reference the correct one. Which is terribly clumsy.


----------



## Octangula

Morrus said:


> It's a tricky little puzzle that I haven't figured out yet. So far, I can only cone up with a convoluted method of having two tables (one with plurals, one with singular) and using an IF statement to reference the correct one. Which is terribly clumsy.



Yes it is. What I'm thinking might work is a tag that lets you specify 2 forms, and another that grabs a plural if available.

Something like having {plural|staff|staves} in a table, and then {pl{Octangula{Example}}} returning "staves" if that line is rolled. If {pl} doesn't find a {plural} tag on its result, then it either returns what it finds or appends an "s" to that. I'll leave the exact syntax up to you, in case you want to have any particular consistent style.


----------



## Hand of Evil

Switch may offer some options, been looking at it for changing HE to SHE, HIM to HER but have not have the chance to play with it.


----------



## Octangula

Hand of Evil said:


> Switch may offer some options, been looking at it for changing HE to SHE, HIM to HER but have not have the chance to play with it.



Nor have I. I'd like to make the arguement that gendered forms and plural forms should be builtins, though, as they are going to be commonly encountered, and having a consistent method would help.

Edit: Also, where do I go with bug reports for the website?


----------



## Hand of Evil

Something I have been doing is flowing out the process, it helps me look at options.  here I am working on clues for my CSI: View attachment 57103 

I want to do scripts also but that is down the line.


----------



## Morrus

What are you using to make those flowcharts?  I need something like that!


----------



## Hand of Evil

Morrus said:


> What are you using to make those flowcharts?  I need something like that!




iThoughtsHD for the iPAD - 9$ but well worth the cost.  Easy to use and very versatile.


----------



## Hand of Evil

Now to be thinking about how best to do the flow, where to put IF statements or SWITCH: View attachment 57108  An can not believe I forgot NAME for information about person!


----------



## Morrus

The parser has been recoded - OGRE should run much, much faster now. Let me know!


----------



## Zaltys

Nylanfs said:


> Could I make a request also? I REALLY think it would help to be able to import CSV (or plain-text files) of some type. I'm making a name generator from PCGen's plain text file of the 1990 US Census data, and in JUST the female given names there are 4275 lines.



I second that request.
Many of my old TableSmith generators are thousands of lines long. It  would take ages to copy everything row by row, when a single cut and  paste would suffice. 

'course, most of my old tables use a lot of functions and datasets, so I couldn't convert them into this format anyway. 
O.G.R.E. dataset support would be extremely useful, since there's only so much one can do with simple subtables.

For instance, my random settlement generator uses datasets to modify how common certain buildings are, based on the settlement race(s) and alignment. Bakery, for example: low modifier (common) for halflings, normal for humans and high (rare) for orcs. Likely to be generated in just about every halfling village, but rarely seen in orc settlements.

It would be possible to replicate the dataset with subtables, but it'd take thousands of tables and tons of redundant entries.


----------



## Pelldom

I'm working on a customized version of a tavern creator and have an idea for how to adjust prices of menu items and rooms/services based on a quality variable. Basically, this variable becomes a modifier to all prices for that tavern (-1 being poorest quality +3 being highest quality)

I'm able to have the generate create the variable but I am unable to call the variable correctly within any other calculations for things like menu prices. I'm assuming I'm just missing something (hopefully simple) but I can't figure it out at all. I can print the variable but not call it . 

Here's what I'm trying to do:
{$qual: {1d5-2}}
Drinks:
{Pelldom(Ales)} {2d2+$qual} sp

If I'm correct, this should result in a price between 1 sp and 7 sp but what I end up with is: "{3+$qual} sp" as an output.


----------



## Pelldom

Coming across a few questions that all seem to be answerable with the same answer: is there a comprehensive example list of various scripts and functions available? Specifically math functions and built-in scripts?


----------



## Morrus

It's pretty much what's on the help page.  Expanding that is doable, but it involves hiring the developer to entend the current system and takes time/money and needs to be planned/specified comprehensively.


----------



## Pelldom

Ok, in regards to my previous issue then, is there anything wrong with the syntax of my previous issue? 

{$qual: {1d5-2}}
Drinks:
{Pelldom(Ales)} {2d2+$qual} sp. 

Also, I'm having difficulty grasping the syntax for the IF statements. Don't suppose there are any examples of that I could see to figure out the options?


----------



## Morrus

Pelldom said:


> Ok, in regards to my previous issue then, is there anything wrong with the syntax of my previous issue?
> 
> {$qual: {1d5-2}}
> Drinks:
> {Pelldom(Ales)} {2d2+$qual} sp.




Yeah, you haven't told it to do anything with that variable.  You'll need a second one, I think.  

Please excuse me - I'm doing this on my phone. So spacing/formatting might get a bit funny or be a bit wrong, but hopefully it gives the right idea

{$qual: {1d5-2}}
Drinks:
{$drinky:  {2d2+$qual}}
{Pelldom(Ales)} {print:$drinky} sp.


----------



## Morrus

This is just for reference purposes, not related to functionality requests in this thread (though if someone could compile those for me I could commission them in a future update).  This is v1.2, an update has been under development for a few weeks:



> v1.2
> v1.2 adds a small assortment of functional improvements.
> 
> USER INPUT:
> 
> Setting a variable can be accomplished via scripting language (as above) but also via user input prior to executing a generator. User-input variables should be selected via a dropdown with predefined options provided by the block creator.
> 
> If a block with a user-input requirement is called from another block or table, it should be possible to pass the variable through from the previous table/block.
> 
> OTHER ITEMS:
> 
> - "Similar Generators" and "Similar Tables" on viewblock and viewtable pages.
> - Usergroup permission - "Can moderate blocks/tables" - enables usergroup to edit and delete all blocks and tables.
> - Favorite blocks/tables.
> - Comments on blocks.
> - Rate blocks (and show Top Rated Generators).


----------



## Pelldom

Morrus said:


> Yeah, you haven't told it to do anything with that variable. You'll need a second one, I think.
> 
> Please excuse me - I'm doing this on my phone. So spacing/formatting might get a bit funny or be a bit wrong, but hopefully it gives the right idea
> 
> {$qual: {1d5-2}}
> Drinks:
> {$drinky: {2d2+$qual}}
> {Pelldom(Ales)} {print:$drinky} sp.




That actually makes total sense! Thanks.
Years ago I started doing a huge amount of work on a program called Tavern Creator and have loads and loads of data on medieval food/drink. For years I had been holding on to this data. SOOOOO glad a friend pointed this tool to me so that I can input it. I've already added several very comprehensive tables for Ales, Lagers, Wines and Meads. Going to be adding a lot more for food and such as well. 

Love Morrus's tavern menu creator but I'm running a Low Magic campaign so want to have a non-fantasy menu creating version.


----------



## Pelldom

Good news, bad news:
Bad News first: that didn't work. I still got an output that looks like the script.
Good News second: you gave me an inspiration and was able to find out how to fix it!

This is the final formula:
{$qual: {1d5}}{print: $qual} 
Drinks:
{loop: {1d3-1}} {Pelldom(Ales)} {1d4+1+{print: $qual}} sp ({Pelldom(Drink Qualities)}){/loop}

First thing that was wrong was that if the quality was -1, then it couldn't do the math function. Second thing wrong was that I had to call the PRINT as part of the price calculation. 
Now I've got a script that will generate a "Quality Modifier" that will adjust the prices of all other prices I see fit to apply it to for that instance of a Tavern! With this, the average price of an Ale is 6 sp. Bit on the pricy side but at least now I can work with it 

Thanks for the help and thanks for this AMAZING tool!


----------



## Bagpuss

Is there anyway to set up a table that doesn't get accessed by a traditional dice role?

For example I have a table I've been using that has over 1000 Japanese first names, if I want to give them equal weighting can I roll a d1092? 

Also is the only way to enter then by using that form and adding 1090 extra rows?


----------



## Pelldom

Yes you can. You can have a 1d- anything. In fact both numbers on either side of the 'd' can be whatever you want. As for the second question, unfortunately, its one line added at a time although that does bring up a feature request: move the "add line" button to the top of the list please. That way,if you need to add a lot of lines, you can just click-fest away! Also, if tabbing would take you to the next line below instead of the next field across (the remove button) that would dramatically speed up data entry.I love this tool. I have sooooo many plans for what I can do with this and if just a few changes are,made to speed up the,whole process, even better &#55357;&#56842;


----------



## Bagpuss

Can you have a table call another table?

IE: on 
1 - X happens
2-19 - Y happens
2- Roll on the really bad stuff table.


----------



## Morrus

*O.G.R.E.*

Yes, you can.


----------



## Bagpuss

The search for tables feature doesn't seem to work for example if I do a search for the word "french" in for Tables in Title or Description, category "Naming Tables" I just get returned all the Naming Tables, if I do No Category I get all the tables.


----------



## Morrus

Bagpuss said:


> The search for tables feature doesn't seem to work for example if I do a search for the word "french" in for Tables in Title or Description, category "Naming Tables" I just get returned all the Naming Tables, if I do No Category I get all the tables.




Yup, I see what you mean.  I'll tell the developers!


----------



## Bagpuss

I'm not seeing how the scripts are meant to work at all.

I was hoping you could for example do something like....



		Code:
	

His name was {name: {Bagpuss(Spanish Male First Names)}}, I said his name was {print: name}.


And you would get a result like..

*His name was Tito, I said his name was Tito.*

So you could randomly get a name and assign it to the variable "name", and then use it again and again without it being randomly set.

But at the moment that code gets.

*His name was {name: Tito} I said his name was name.*

So I've tried altering it...



		Code:
	

His name was {$name: {Bagpuss(Spanish Male First Names)}}, I said his name was {print: $name}.


*His name was I said his name was Pepe.*

Ah got it now... it wasn't clear from the Help file but when you create a variable it has to start with a "$" character.

So the code should be...



		Code:
	

{$name: {Bagpuss(Spanish Male First Names)}}
His name was  {print: $name},  I said his name was {print: $name}.


I have updated the wiki to reflect this requirement.


----------



## Bagpuss

Why are tables and generators separate? Or more to the point why can't you just execute a Table one or multiple times, and why aren't tables given the publicity of generators?

For example does this table really need a generator? {Bagpuss(Cards - Tarot Deck)}

As all a Tarot generator would do is point at the table. But without the generator it doesn't appear in the Portal so people are less likely to know it exists and use it themselves, and might duplicate the work.

The fact generators hide how they work and what tables they call (except from the creator), and that tables are generally hidden actually makes it harder for you to build on the work of others, which I thought was one of the selling points of this shared resource.


----------



## Morrus

Generators can be formatted and prettified; tables can store data.  They're separate because they can do different things.  

I agree that some very simple generators can be replicated by a single table.  My Tavern Generator can't, though, and most complex generators can't.


----------



## Bagpuss

Yes I get the need for generators, but is there a reason tables can't be just executed? Could there be a toggle to tick so that some tables stay in the background, and perhaps are harder to locate as they are now, but others are sort of promoted to "mini-generator" status, so appear on the front of the portal, and can be executed with a simple click.

An example of this is the table {Bagpuss(Cards - Tarot Deck)} I've just created. The generator to run that would literally just be a call to that table. Could that not be toggled to generator status? While {Bagpuss(Cards - Major Arcana)}, {Bagpuss(Cards - Tarot Values)} and {Bagpuss(Cards - Tarot Suits)} which it calls could stay in background hidden.

As it is I need to create a generator just to call the table, as I can't actually execute the table itself.

Just a suggestion.


----------



## Bagpuss

Notice another little bug, the Caps Control modifiers don't work with nested tables. They only effect the text of the first table called.

So for example with my Tarot Draw generator {Bagpuss[Tarot Draw]} which calls the table {Bagpuss(Cards - Tarot Deck)}

That table is 1d78 has the code...



		Code:
	

1-22 {Bagpuss(Cards - Major Arcana)}
23-78 the {Bagpuss(Cards - Tarot Values)} of {Bagpuss(Cards - Tarot Suits)}


If you make the code of the generator



		Code:
	

You draw {Bagpuss(Cards - Tarot Deck)|allcaps}


I would expect results like.

You draw THE TOWER
You draw THE PAGE OF SWORDS

but I get results

You draw The Tower
You draw THE page OF swords


----------



## Bagpuss

Another little suggestion, can the Table Reference box that gives you the code to copy be moved to the top? When you have a table with over 100 values it is a pain to scroll to the bottom just to get the reference. Better yet could the reference be next to or under the table in the browse window, it would save a click.


----------



## Hand of Evil

Bagpuss said:


> Another little suggestion, can the Table Reference box that gives you the code to copy be moved to the top? When you have a table with over 100 values it is a pain to scroll to the bottom just to get the reference. Better yet could the reference be next to or under the table in the browse window, it would save a click.




I think a spreadsheet index may be in order...yes, I am working on it but I am slow.

By the way this is what it looking like...


----------



## Morrus

Bagpuss said:


> Yes I get the need for generators, but is there a reason tables can't be just executed? Could there be a toggle to tick so that some tables stay in the background, and perhaps are harder to locate as they are now, but others are sort of promoted to "mini-generator" status, so appear on the front of the portal, and can be executed with a simple click.
> 
> An example of this is the table {Bagpuss(Cards - Tarot Deck)} I've just created. The generator to run that would literally just be a call to that table. Could that not be toggled to generator status? While {Bagpuss(Cards - Major Arcana)}, {Bagpuss(Cards - Tarot Values)} and {Bagpuss(Cards - Tarot Suits)} which it calls could stay in background hidden.
> 
> As it is I need to create a generator just to call the table, as I can't actually execute the table itself.
> 
> Just a suggestion.




Well, with luck somebody will compile all these fetaure requests and I'll ask how much the developers would charge to implement them.  At present they're working on v1.2 described above.


----------



## Hand of Evil

View attachment 57189

Here is a list of all the GENERATORS, starting to work on the table list --- okay, anyone seeing my attachments?  I am not.


----------



## Bagpuss

Nope not seeing them... Although I'm sure it is very impressive.


----------



## Hand of Evil

Bagpuss said:


> Nope not seeing them... Although I'm sure it is very impressive.




changed to INLINE, anything above my text?


----------



## Morrus

You know you can see the whole list just by clicking here:

http://www.enworld.org/forum/dnd_browse.php?type=block


----------



## Morrus

*O.G.R.E.*

Just got an email from the developer saying the search is fixed. I'm on my phone though - can anyone confirm?


----------



## Hand of Evil

Morrus said:


> You know you can see the whole list just by clicking here:
> 
> http://www.enworld.org/forum/dnd_browse.php?type=block




Yes, but wanted the reference as it is easier to grab from the spreadsheet while building.


----------



## Bagpuss

I can confirm the Search is working.


----------



## Bagpuss

Can a table be self referring? I would guess not as it might cause issues with loops? But I was wondering how you deal with "Roll twice on this table" type actions which are quite common in table design.


----------



## Morrus

I guess a controlling table which referred to the main table in this manner:

1-95) Rolls once on table A
96-99) Rolls twice on table A
00) Rolls threetimes on table A

I also use loops sometimes for something similar.


----------



## Bagpuss

You could do with a little script that checks the first character of the result of the random table called and then adds "a " or "an " in front of it. That way you could have a table that has both "church" and "abandoned building" then you could lead in with either "the" or the script I mentioned. So you won't end up with "a abandoned building".

As it is the table needs to say "a church" and "an abandoned building" which means you can't have "the" as a lead in.


----------



## Bagpuss

Can't get the if script to work in a Table... here's the code



		Code:
	

in a church {$check: {1d2}} {print: $check} {if: $check = 1} during a funeral{elseif: $check = 2} during a wedding{else} when it is empty{/if}


And even though it prints 2 as the result it always put in "when it is empty".


----------



## Morrus

Are you seeing my replies, Bagpuss?  I keep answering your questions, but you don't say anything and continue on a new subject as though I'd said nothing!  I'm starting to feel paranoid you can't see my posts!


----------



## Morrus

So on the offchance you are seeing my posts, re. your most recent question - perhaps try removing the spaces round the =.  I don't know if that will work, though.  So you're trying to save yourself creating another table by using scripts instead?


----------



## Bagpuss

Yeah when there are only a few options it seems to make more sense.

Removing the spaces has fixed it.


----------



## Morrus

*O.G.R.E.*

OGRE now has a rating system! Comments system incoming!


----------



## Bagpuss

How do you do a line or paragraph break? I can see the HR code for putting a line across but I just want to start a new line.


----------



## Morrus

In a generator? Same way as in a post. Just hit return!

Like this.


----------



## Bagpuss

It doesn't seem to work. 



		Code:
	

{Bagpuss(871A)} {Bagpuss(871B)}
2
3


Result

Iron Tower of the Hills23



		Code:
	

{loop: 4}{Bagpuss(871A)} {Bagpuss(871B)}

{/loop}


Result

Lord Guardian of the MoorsKeeper of the WastesHigh Champion of the Highland PaleLord Governor of the Isles

When you go back in the the generator has removed the returns.


----------



## Pelldom

I've seen this before myself. Are you using Internet Explorer? If so switch the compatibility mode on or off, depending what you have it set to now. I've seen this exact thing a couple times now and switching the Compatibility mode always fixes it.


----------



## Pelldom

Can I request a new category for tables and generators? Bagpuss and I have begun a project to revive the amazing (and Long out of print) resource "Central Casting: Heros of Legend" book into OGRE. It seems like a natural connection. However it will require us to create a LOT of tables and (eventually) generators. We're hoping for a new category so that we can put all this there and make our combined work a lot easier.

I'm not sure though what the most appropriate taxonomy would be though... I'm thinking *"Backgrounds/NPC/Personalities"* or could a dedicated category for this project be created? *"Heros of Legend Generator"*? That might be too specific. *"Central Casting Revival"*?


----------



## Bagpuss

Using Chrome.


----------



## Pelldom

Never used Chrome... does it have a function like compatibility mode? That might be the issue. Some sort of enhanced rendering tool or something similar?


----------



## Morrus

*O.G.R.E.*



Pelldom said:


> Can I request a new category for tables and generators? Bagpuss and I have begun a project to revive the amazing (and Long out of print) resource "Central Casting: Heros of Legend" book into OGRE. It seems like a natural connection. However it will require us to create a LOT of tables and (eventually) generators. We're hoping for a new category so that we can put all this there and make our combined work a lot easier.
> 
> I'm not sure though what the most appropriate taxonomy would be though... I'm thinking *"Backgrounds/NPC/Personalities"* or could a dedicated category for this project be created? *"Heros of Legend Generator"*? That might be too specific. *"Central Casting Revival"*?




Are you sure that's not "Heroes"? 

Yeah, sure.


----------



## Pelldom

Oops! yeah, that would be it 
Damnit Jim, I'm a gamer not an Enlighsh Teacher!


----------



## Morrus

Just a quick note - in addition to the ratings, generators can now be commented on!


----------



## Bagpuss

Can the "if" script be changed so it can do the operations <, >, <=, >=, <> please? Or at least the < and > if possible?


----------



## Morrus

Bagpuss said:


> Can the "if" script be changed so it can do the operations <, >, <=, >=, <> please? Or at least the < and > if possible?




It can, as far as I know.

If it can't - that's another upgrade feature to add to the upgrade request list to take to the developer at some point.


----------



## Pelldom

Is the list of functions available listed in the Wiki complete? For example, are there any other scripts (such as the dice script) that can be used but aren't listed anywhere?


----------



## Bagpuss

Morrus said:


> It can, as far as I know.
> 
> If it can't - that's another upgrade feature to add to the upgrade request list to take to the developer at some point.




I've tried them and they don't work.


----------



## Morrus

I've used the > and < before and they worked.  Sounds like they've broken.  I'll pass the bug report along to the developer.


----------



## Morrus

The "Favorites" system is now in place. Next up will be the user input prior to running a generator being assigned as a variable (which is a bigger deal than it sounds!)

Then it will be the mobile app API, which will take some time.

Then after all that, we can sort out a compiled feature/change list and see what it'll cost. I really would like somebody else to maintain that list for me though as I really don't have time (perhaps as a section in the wiki page).


----------



## Pelldom

Will the input values be able to be inputed from another generator or vice versa? LOVE this option.


----------



## Bagpuss

Being able to apply modifiers to the dice rolls as in input variable would be great as well.

IE: Table is 1d20+X where X either comes from the use or from another table. No value for X it assumes X=0. Probably cause a nightmare with the existing checks to make sure the table is valid though and what happens if X puts the table out of range?


----------



## Bagpuss

I've just done a self-reference table You have to saved the table at least once without it referencing to itself as otherwise it doesn't exist to call at that point. The original table I was basing it on had a last entry on a 1d10 table *10 Roll two more times on this table and combine the results in some logical manner. Reroll duplicates.*

So I tried entry 10 like so...


		Code:
	

{Bagpuss (534A)} and {Bagpuss (534A)}


Ran this sixty times with these four odd results. Bold *and*'s show breaks between results.
Bob was forced into a life of crime by threats against loved ones *and *needed money to pay debts *and *was forced into a life of crime by threats against loved ones
Bob does it for the thrill and excitement the danger brings *and *does it for the thrill and excitement the danger brings
Bob is punishing those responsible for misdeeds *and *seeks to wield power in the criminal underworld *and *was forced into a life of crime by threats against loved ones
Bob needed money to pay debts *and *has a pathological urge to do wrong *and *was forced into a life of crime by threats against loved ones

Only once did it happen to call exactly the save value twice, and three times it called result 10 again for one of the two and so ended up with three values.

So I modified the last entry of a 1d10 table is as follows.


		Code:
	

{$var1: {Bagpuss (534A)}}{$var2: {Bagpuss (534A)}} {if: $var1=$var2}{print: $var1}{else}{print: $var1} and {print: $var2}{/if}


I ran it sixty times as a test I got two odd results.

Results
Bob wants to to be rich *and *wants to to be rich *and *was forced into a life of crime by threats against loved ones
Bob needed money to pay debts *and* want to defy authority *and *needed money to pay debts *and *want to defy authority *and *succumbed to peer pressure

So no doubles except when it calls 10 again.

So good news is it doesn't break the table by calling itself, bad news is it is impossible to stop it coming up with some odd results that don't make much sense.


----------



## Morrus

The system is not designed to handle self-referencing tables. Worse, one could easily bring down the entire server, so please don't be tempted to try!


----------



## Bagpuss

I'll remove it. You might want to put a check in to stop it in future then, I've notice the checks are actually pretty good at picking up code you haven't closed and the like.


----------



## Callahan09

Hi Morrus, I was wondering if there would ever be an upgrade to the table creator so we can put in some kind of delimited text or even select a file with the text to upload?  I have some tables of names I wouldn't mind uploading, but with a couple hundred entries it would take forever to manually add them row by row...


----------



## Bagpuss

I'd love that too, I stopped most of my naming lists at around 100 entries because I was bored, the original list I had ran over 1000 entries in some cases.


----------



## Morrus

At the risk of sounding repetitive, if someone wants to compile the infinitely growing list of requests for me, I can ask the developer how much it would cost and how long it would take to do them all - I suspect we're stretching into 2014 by now.  But, as I said, the user input variables are next, followed by the mobile API, so I won't even be asking until those are done.


----------



## Callahan09

I'm a developer and DBA by trade... If you want to read my resumé and do some kind of interview and you feel at all like you trust me, then I would be more than willing to donate my time coding features that I'd personally use.  I'm not offering myself out for hire (unless you're paying well!) but I'd gladly volunteer to implement the features I'd personally be interested in seeing.  Probably not worth it to you to share your code with someone who is basically just offering to work on the projects I *feel like* working on, but if you want free help, maybe we can work something out?


----------



## Pelldom

Morrus said:


> The system is not designed to handle self-referencing tables. Worse, one could easily bring down the entire server, so please don't be tempted to try!



That's too bad... That would have been a great tool. What about, as a work-around to get the same result, if you had a second table that was identical to the first? Then the d10 result would just call the duplicate table (with possible adjustments). In fact, if there was a way to "Copy" or "Save As" a table, that would make something like that quite simple and straight-forward.


----------



## Morrus

*O.G.R.E.*



Pelldom said:


> That's too bad... That would have been a great tool. What about, as a work-around to get the same result, if you had a second table that was identical to the first? Then the d10 result would just call the duplicate table (with possible adjustments).




That's exactly what I said earlier in the thread! This subject has come up before. 



> In fact, if there was a way to "Copy" or "Save As" a table, that would make something like that quite simple and straight-forward.




I refer you to my previous posts on feature requests.


----------



## Pelldom

Oops. Must have missed that post. I take it this means no one has taken you up on compiling requests? If you have no takers by Monday I MIGHT be able to free up some time to do that. Can't commit right now, but possible.


----------



## Pelldom

Is there anything going on with the OGRE site lately? Last couple of days when I try to save a table I get a 502 error. I sometimes have to re-create the ENTIRE table 3 or 4 times before I can get it to save. In one case, I had to add a couple lines, save it, add a couple more, save it, etc. Quite the PITA...


----------



## Morrus

*O.G.R.E.*



Pelldom said:


> Is there anything going on with the OGRE site lately? Last couple of days when I try to save a table I get a 502 error. I sometimes have to re-create the ENTIRE table 3 or 4 times before I can get it to save. In one case, I had to add a couple lines, save it, add a couple more, save it, etc. Quite the PITA...




Nothing that I'm aware of! Anyone else having the same issues?


----------



## Bagpuss

Getting a load of 502 Bad Gateway errors at the moment.

I have had them occasionally before but it is virtually constant at the moment. Just trying to update a table to correct errors in it.


----------



## Morrus

When exactly does this occur?  When hitting save after editing a table?  Any other times?


----------



## Bagpuss

Only hitting a save. I tried some minor edits and sometimes they would be okay. There was a particular switch command I was trying to fix that didn't seem to take, once it did then the problem had gone. Not sure if that was related or not.


----------



## Bagpuss

Seems fine at the moment.


----------



## Pelldom

Actually, that's almost the exact behavior I've seen too. Hitting save and get the error, go back and I get ONE chance to make any corrections. If I get a 502 error a second time, it will clear all but the first two lines of the table and I have to start from scratch. And I recall making edits to switches when this happens too. I've got to the point that unless I've got a full hour or so to build a single table, I don't bother because I now expect it will take me a couple tries.


----------



## Morrus

Is it still fine?


----------



## Pelldom

I got the 502 error again. I did have a typo in a {switch} on one entry. Could it be part of the error checking to do with switches? I fixed the error and it worked fine.


----------



## Morrus

*O.G.R.E.*

I haven't seen the error myself, and I've tried editing a bunch of tables. I need to narrow down when it happens before I report it. 

So our best working theory so far is switch typos?


----------



## Pelldom

so far yes. I know that for our Central Castings tables we are creating both Bagpuss and I are using a LOT of switch commands.


----------



## Pelldom

Something else I thought of that might cause the issue is whatever the process is that runs the switch (or other functions) in order to generate the preview view of the table. Just a thought


----------



## Bagpuss

Not sure if this is a bug, but the loop function doesn't work with a variable. So you can't do something like....



		Code:
	

{$num: {1d2+1}}{print: $num} events occur.  {loop: $num}{Bagpuss(543C)|firstcap}{/loop}


As it only ever does one result.


----------



## Pelldom

that must be something new. I've used dice scripts in loops before and it worked fine. Tried to find an example but didn't get a chance...


----------



## Bagpuss

Dice scripts work okay it is the variable that doesn't.


----------



## Bagpuss

*|firstcap* command is a little faulty and can lead to lower case letters.

I tend to write my tables starting with a lowercase letter, so that if needed I can have some lead in to the sentence. Then if I don't have a lead in I use the *|firstcap* command.

Now some times the table result will be more than one sentence, in which case it is written like so.

"the first sentence starts lower case. The second with a capital but no full stop"

So I can fit it in the middle of a generator if need be. Unfortunately |firstcap does this to the sentence.

"The first sentence starts lower case. the second with a capital but no full stop"

This is a bug as |firstcap should do this *The first letter of the first word in the sentence is capitalized like this.* but all it actually does is swap the case of the first letter in every sentence.


----------



## Morrus

firstcap make the first letter of an entity (ie a table entry) uppercase and the rest lowercase. The use of 'sentence' is misleading - it doesn't know what a sentence is.

I have an update from the developer re. user inputted variables:



> I have not fully completed the user-input system; I still have to add the functionality to grab variables from generators within generators within generators, etc., but the useage of user-input variables and the setting of them is completed, so I have uploaded that part to Enworld.
> 
> To add a custom user-input variable, start creating a generator, then click the "Add A User-Input Varibale" link. This will make some forms appear.
> 
> 
> The "Name" form will change how you refer to the variable in the generator. For instance, if you entered "gender" into the name form, you would refer to the variable in the generator with "{print:$gender}" or "{if:$gender=male}" etc. The "Name" form will also be the title of the variable when it's displayed on the view_block page.
> 
> 
> Each "Option" form will change what the variable's value will be. For instance, if you made a variable named "gender" and gave it the options "male" and "female," {print:$gender} would either output "male" or "female' depending on which is selected by the user.
> 
> 
> The "Add Option" link will add another option to the variable it is in. You must have at least two options for each variable. The page won't let you submit if you don't.
> 
> 
> Clicking the "Preview" link inside each user-input variable will change the forms into a select box, so you can preview how the generator will output with the different options. After you clicked the "preview" link inside a variable, it will change into an edit link, which will let you edit the options and add/delete options again.
> 
> 
> If you don't click the preview button inside a variable, it will output as "Variable Value" when you previewing the generator.
> 
> 
> After you've submitted or edited a generator with custom user-inputs, each variable will appear as a select box for the user to choose from in the view_block page.
> 
> 
> 
> 
> Please let me know if it works correctly for you or if you have any questions about the functionality.
> 
> 
> I'll probably be done with the rest of the user-input functionality pretty soon.


----------



## Bagpuss

Morrus said:


> firstcap make the first letter of an entity (ie a table entry) uppercase and the rest lowercase. The use of 'sentence' is misleading - it doesn't know what a sentence is.




Any chance we could have a firstcap2 then that only changes the first letter to caps and leaves the rest as they are?



> I have an update from the developer re. user inputted variables:




Looks cool I will give it a go.

Edit: Spotted a little error already...

"Add A User-Input Varibale"

Varibale?


----------



## Bagpuss

Okay I've made one has Culture as the input variable with four possible options then gives a random occupation and it seems to work. 

I did have one problem with it while making it, seems there were some hidden COLOR formatting commands that ended up in the code, not visible in the editor but the code still read them so the switch command did recognise the word as matching the selection from the input. I copied the code into notepad then copied it back to remove all the formatting and then it worked fine.

*I've just edited it:*
It calls a table in which I've put a {print: $Culture} command, and it appears the variable is printed correctly. Which is nice.

Here's the code...



		Code:
	

{print: $Culture} occupation {switch: $Culture}{case: Primitive}{Pelldom(420A)} {case: Nomad}{Pelldom(421A)} {case: Barbarian}{Pelldom(422A)} {case: Civilized}{Pelldom(423A)} {case: default}Something has gone wrong.{/switch} {Bagpuss(testing)}


And the table it calls at the end.


----------



## Bagpuss

Been doing some other testing and it seems variables pass between tables at the moment. This is going to be really useful.


----------



## Bagpuss

Latest testing results....

Generator


		Code:
	

{switch: $Race}{case: Japanese}{if: $Sex=Male}{$Name: {Bagpuss[Japanese Names - Male]}}{else}{$Name: {Bagpuss[Japanese Names - Female]}}{/if}{case: Spanish}{if: $Sex=Male}{$Name: {Bagpuss[Spanish Names - Male]}}{else}{$Name: {Bagpuss[Spanish Names - Female]}}{/if}{case: default}Arse!{/switch}

{print: $Race} {print: $Sex} {print: $Name}

{Bagpuss(Test of Name string)}


*Note:* Switches need a default value otherwise it acts weird, I use it to test if the entry has gone wrong.

Test of Name string table values

1 - {print: $Name} works in a dime store. {if: $Sex=Male}He's a prick!{else}She's a bitch!{/if}
2 - I know a celebrity lawyer called {print: $Name}. {if: $Sex=Male}He's a prick!{else}She's a bitch!{/if}

Works like a charm.


----------



## Bagpuss

I've added a Bugs and Feature request to the bottom of the wiki help page.


----------



## Bagpuss

Emergency some sort of advert bot is creating generators! Daughterylee I think is the name.


----------



## Morrus

Update from the developer:



> I have completed the functionality for calling generators to grab the  input variables from the generators they call. Now when you view a  generator on the view_block page, all of the input variables from all of  the generators it uses, including itself, should be a available to you.
> 
> One note:
> If the calling generator happens to have an input variable with the same  name as one that of the generators it uses has, the options in the  calling generator will take precedence over the options in the called  generator. So, for instance if you had a generator called [my_car] with a  variable named "car" and the following options:
> 
> -Honda
> -Ford
> -Chevrolet
> 
> and [my_car] also happened to use a generator called [special_car] that a variable named "car" that had the following options:
> 
> -Ford
> -Accord
> -Dodge
> 
> you would only have the following options when viewing [my_car] on the view_block page:
> 
> -Honda
> -Ford
> -Chevrolet


----------



## Bagpuss

Another advert has appeared in the Generators. This one by beccalynnlark.


----------



## Morrus

New update!  Tags/similar generators.  These will form an important part of the process of finding generators and tables as the database gets bigger and bigger.

There is now an option to add tags when you create/edit a  generator or a table. When you view that generator or table, the system  will use its tags to look for matches with other generators or tables  depending on which type you are viewing. If you are viewing a generator,  it will look for generators with matching tags; if you are viewing a  table, it will look for tables with matching tags. Tags are the crucial  part of this system, so if a generator has no tags or if no other  generator has matching tags, no similar generators will be found.


----------



## sevenbastard

This is a great tool! Can someone point me to a resource where I can learn more about Scripts? I am creating a random character generator for my house rules. Step one was easy, roll randomly for Race and  then I want to set up a second role that takes the race value rolled and references a second table that then rolls for the class based on the race. 

I was able to make this work by having the second table referenced as the result of the first table, but I would like to put this in the generator if that possible I believe that is what scripts are for but I’m a rookie at this.


----------



## Morrus

sevenbastard said:


> This is a great tool! Can someone point me to a resource where I can learn more about Scripts?




Literally just this page/thread, I'm afraid!


----------



## Morrus

So some minor updates:

1) I'm having an INT (and roundup/roundown) function quickly added.

2) Then it will be the mobile API, so you won't see any changes here for a while.

3) Then we can look at the bugs/feature requests.


----------



## Morrus

Hey [MENTION=3987]Bagpuss[/MENTION], have you guys given up on converting that book of tables?


----------



## Pelldom

Haven't given up. Just got hit with summer stuff


----------



## Bagpuss

Summer holidays are a busy time for me I'm afraid, I intend to get back to them at some point.


----------



## Morrus

Just for reference, here's the current list of minor fixes being worked on before moving on to new functionality:

1) That generator/table list on the right to be split into  two lists - tables and generators.

2) There's some issues with the CAPS control syntax.  I can't quite work  out what it is, but it doesn't always work as expected.  What I think  is happening is that nested (through tables/generators) caps control  statements are conflicting with each other, making it impossible to  fully control the outcome. The easy fix for that issue, I think, is to  simply say that only the top layer caps control statement applies.

3) Change it so that non-registered members can execute  generators.

4) {loop: X} - While loop will currently accept the dice script to run a variable number of times, it does not currently  accept variables. For example {loop: {1d4+1}} is valid, while {loop:  $value} is not. This makes it hard to use a variable multiple times, or  print the variable for example You have X random encounters then run a loop X times.

5) Mathematical processes on numeric variables  - I've noticed that  {$age: {2d6}}{$trueage: {$age+16}} works to give a result between 18-28  for $trueage, you can even do something like {$trueage: {$trueage+10}}  and that works. However you can't do something like {$a: {2d6}} {$b:  {2d6}} {$c: {$a+$b}} {print: $c}, as it throws a wobbler when you try to  add to variables.  Variables need to be able to interact.

6) Generator category called "Testing" has been set up for  folks to play around with.  Will be set so items in that category don't show  on the front page.  Folks will need to move their generators to a more  appropriate category for it to show up there.

And here's a potential list of future functionality:

Mobile API
Allowing images as table fields
Data lookups
Repetition  prevention
Embedding generators
CMS widgets and forum sideblocks
Importing tables as comma delineated lists
Pre-populating the die roll column with a 1-x sequence of numbers


----------



## Morrus

The 6 listed items/fixes in my previous post have now been implemented.


----------



## PaleMage

Scripting Primitives
{loop: X}: in my personal experience, loop accept variables if given in the appropriate format.

My *Great Knowledge Library* generator gets form user input a variable $Quantity, and passes it to a {loop: $Quantity} without any problem... 

The current real problem is that {loop: X} has 3 BIG limitations, for scripting purpouses:
a. X cannot be greater than a _signed-integer_ (-127/+127), and SHOULD be insteal a _*long-integer*_ (there is no use of a negative loop);
b. {loop: X} has no way to control an exit condition while looping, so we need at least an *{/exitloop}* statement;
c. Best of all would be if we could get an additional *{loopfor: condition}* the same you get for an _{if: condition}_: this way you can exit loop whenever you meet that condition.

Additional features needed (Portal)
Ability to set an *Hidden Flag* for Tables/Generators. Subroutines created as _generators_ called without the proper $variables set could end up in strange behaviors... better if we can hide them form direct use by portal, having them being used only by Tables and other Generators.

Additional Field for Tables
For scripting purpouses, I've been force to add {$variables: x} to the Content Field of Tables: they are executed but not shown (correct), but this way tables are not so clean as a casual user would expect. I suggest to add an additional field (i.e. Operations) where to put {scripts, variable, and the like} not directly connected to the desired content output.
For example:
(CURRENT) Result: 1-3, Contents: {$key: MyKeyValue}MyContent, Output: MyContent
shoud become
(DESIRED) Result: 1-3, Contents: MyContents, Operations:{$key: MyKeyValue}, Output: MyContent

Adding a field to all existing Tables is not a problem, because we have only to add a Field, and the existing would not be touched in any way. Of course, the operation field has to be executed any time you get that record result, as currently happens if you put scripts or Table/Generators calls in the Contents field... the purpouse is to execute scripts that does not generates outputs, but only calculations or $variables management.

Let me know: I will do a very large use of these features, and any users with a little programming skills would agree with me.


----------



## Morrus

I don't fully understand your first item (the looping exits one) - could you explain that again for me?  Thanks!

The second - hidden tables - well, we could just have a table category for them.  They won't be hidden as in invisible, but they'd be in the "don't use these unless you know what you're doing" category.  Would that work?

The third item - additional table fields; makes sense.  I'll ask the programmer if that's easily implementable!  Just to check I'm fully grokking what you mean - that's just an aesthetic modification for clarity of use, rather than an actual functionality thing?


----------



## PaleMage

This night I added 2 new Tables.

*PaleMage(Dragon_Names_Elements)*
*PaleMage(Dragon_Names)*

Both of them are from _Dragon Names Table, by Owen K.C. Stephens, originally printed in Dragon Magazine, issue 260, on pages 56-58.
_See tables for the original link.


----------



## Morrus

Incidentally, there's new functionality currently being worked on, as requested by  @_*Mistwell*_ :

*Using variables in table rolls.* Now, this turned out to be more difficult than expected, since we hadn't designed the original setup with that in mind - and nobody thought of it until Mistwell mentioned it!  So we've had to create a workaround.  Instead of using a variable directly in the table roll field (e.g. 3d6 + $level), which we're not able to do without some _massive_ restructuring, we're adding a new way of calling a table.

This second way of calling a table (format yet to be decided) will call the table as normal, but _will not_ roll on it.  Instead, it will use a predetermined variable (which you have already defined or gathered elsewhere) and simply insert it.  So you'll make your table roll separately, then call the table and tell it to use that number.

If that number results in an invalid result (higher or lower than the table range), you get an INVALID RESULT outpout in its place in your generator.

So.  You could do this:

Input $level as a user variable
{$roll: {$level+{3d6}}}
Call table {Morrus:WildernessEncounters} and use the value of $roll instead of rolling on it 

For that third line, we've yet to implement the formatting.  We might use square brackets.

It's slightly less elegant than desired, but the amount of restructuring we'd need to do it the obvious way is quite significant.


----------



## PaleMage

Morrus said:


> I don't fully understand your first item (the looping exits one) - could you explain that again for me?  Thanks!



An example does more than thousend words.
My Library generator loops $Quantity times until it reaches the amount of books desired, BUT it has to check also if the Running $Total of books produced has been exceeded. Currently I have no way to say to the loop to stop looping, because the second condition (Running Total) could happen before I generated all the $Quantity books. If I reach a condition while looping, I need a statement like {/exitloop} (usually is {/exit}) to say to the loop to stop and let me exit from looping. Currently I'm forced to run the remaining loops times (and, more important of all, use SERVER CPU TIME) to produce books that I will never show to users. This is what's for the {/exitloop} statement: *save SERVER CPU TIME*.



Morrus said:


> The second - hidden tables - well, we could just have a table category for them.  They won't be hidden as in invisible, but they'd be in the "don't use these unless you know what you're doing" category.  Would that work?



Yes that's it. If You run the *Great Knowledge Books* generator, You get a $variable not set warning, because this generator is meant only to be called by the *Great Knowledge Library* generator, not for direct users use. You got the point, anyway.



Morrus said:


> The third item - additional table fields; makes sense.  I'll ask the programmer if that's easily implementable!  Just to check I'm fully grokking what you mean - that's just an aesthetic modification for clarity of use, rather than an actual functionality thing?



Definetely YES. Both _Contents_ field and the new _Operations_ field has to be able to run scripts, call tables and the like, but the only field that produces output will be, as currently is, *Contents*. The presence of the new *Operations* field give developers a place where to make calculation and $variables operations aside of user output, leaving all more clean and understandable.

Feel free to continue asking for clarifications. PaleMage


----------



## Morrus

That makes sense - thanks!  I'll get those on the list of things to do!  The first one seems the most important.  Might be a month or two, though.


----------



## Mistwell

Morrus said:


> Incidentally, there's new functionality currently being worked on, as requested by  @_*Mistwell*_ :
> 
> *Using variables in table rolls.* Now, this turned out to be more difficult than expected, since we hadn't designed the original setup with that in mind - and nobody thought of it until Mistwell mentioned it!  So we've had to create a workaround.  Instead of using a variable directly in the table roll field (e.g. 3d6 + $level), which we're not able to do without some _massive_ restructuring, we're adding a new way of calling a table.
> 
> This second way of calling a table (format yet to be decided) will call the table as normal, but _will not_ roll on it.  Instead, it will use a predetermined variable (which you have already defined or gathered elsewhere) and simply insert it.  So you'll make your table roll separately, then call the table and tell it to use that number.
> 
> If that number results in an invalid result (higher or lower than the table range), you get an INVALID RESULT outpout in its place in your generator.
> 
> So.  You could do this:
> 
> Input $level as a user variable
> {$roll: {$level+{3d6}}}
> Call table {Morrus:WildernessEncounters} and use the value of $roll instead of rolling on it
> 
> For that third line, we've yet to implement the formatting.  We might use square brackets.
> 
> It's slightly less elegant than desired, but the amount of restructuring we'd need to do it the obvious way is quite significant.




Cool thank you Morrus!


----------



## PaleMage

Three more management Portal function I suggest.

Import/Export Tables
Someone has already asked this, but it would be very useful if You could *import table contents via CSV* (Comma Delimited Files). Mass updating of tables would be more easy. The same way, You could have an *exported backup of your tables to CSV files*.

Sharing
Currently, everyone owns his/her exclusive sets of Tables and Generators, but this limits growth of the shared DB. It would be very useful to implement a shared view of generators code to users, so to enable others to understand how You got that things running. Currently, generators code can be seen only by the owner, and should be easy to *enable registered users to look at code read-only*. This would enhance any other users skill in coding, being able to look at how others have managed their needs via coding.

Backup Copy of Generators
Sometimes happens that we modify a generator, expecially during testing, and sometimes happens that things goes wrong in some way. An easy 'Restore previous version' button would save a lot of copy and paste work we currently are forced to do anytime we change a single statement in our code. It would suffice to have a *Generator_Name.bkp* version of the previous save, and all turns on again.

Yes, I know, to be one that in 8 years wrote only 4 post I'm a little pressing, but _"so far the service has been flawless."_ (cit.)


----------



## PaleMage

PaleMage said:


> *PaleMage(Dragon_Names_Elements)*
> *PaleMage(Dragon_Names)*




Added one more useful table
*PaleMage(Book_Shop_Names)*


----------



## PaleMage

PaleMage said:


> *PaleMage(Dragon_Names_Elements)*
> *PaleMage(Dragon_Names)*




Added one more useful table.

*PaleMage(Book_Shop_Names)*


----------



## Mistwell

Morrus said:


> That makes sense - thanks!  I'll get those on the list of things to do!  The first one seems the most important.  Might be a month or two, though.




Hey [MENTION=1]Morrus[/MENTION] is there a status on this? Was hoping to give it a test run soon


----------



## Morrus

Mistwell said:


> Hey  @_*Morrus*_  is there a status on this? Was hoping to give it a test run soon




A month or two.


----------



## Morrus

I just created a new category called "Utility".  In it, I have placed my first simple utility generator - it just converts heights in inches into feet and inches (e.g. 77 inches becomes 6' 5"). Call this after you have defined the variable $height in inches. It will output x'y". I found it very useful in my alien race generator where height is generated in inches, but I wanted to display it as feet and inches.

http://www.enworld.org/forum/dnd_view_block.php?id=1200


----------



## Morrus

And a second one which converts weight in lb to British-style stone and lb:

http://www.enworld.org/forum/dnd_view_block.php?id=1201


----------



## Bagpuss

Morrus said:


> Hey @_*Bagpuss*_, have you guys given up on converting that book of tables?




Finished off the Cyberpunk Lifepath Generator.


----------



## Morrus

Mistwell said:


> Hey  @_*Morrus*_  is there a status on this? Was hoping to give it a test run soon




Revised ETA on the passing-variables-to-tables thing:  7-10 days.  Coding is underway.


----------



## Mistwell

Morrus said:


> Revised ETA on the passing-variables-to-tables thing:  7-10 days.  Coding is underway.




Sweet! Thanks for the update....and the tool.


----------



## Morrus

Mistwell said:


> Sweet! Thanks for the update....and the tool.



  @_*Mistwell*_ . It's done! Feel free to try it out! I haven't had time to test it myself yet.  Here's the note from the developer: 

[Update - edited]



> he format for changing the roll output is as follows:
> 
> {username(tablename)[replacedroll]|capscontrol}
> 
> 
> You can either use numbers, variables, or rolls in the "replacedroll" slot.
> 
> 
> Here are some examples:
> {admin(cave_monster)[3]} which would always give the roll result of 3.
> 
> 
> {$x:7}
> {admin(cave_monster)[$x]} which would always give the result of $x, which in this case is 7.
> 
> 
> {admin(cave_monster)[{2d6}]} which would give a number between 1 and 13.
> 
> 
> 
> 
> It should also be possible to do math within the added roll number like so:
> 
> 
> {admin(cave_monster)[{2d6+9*$x}]}




Let me know if you have any problems!

(Note that dice rolls still need to be in curly brackets as normal within the square ones)


----------



## Morrus

I've just figured something out. I was trying to work out how to add text together (say if you're building a list comprised of text strings - I needed to do it for my Pathfinder background generator to show a list of available traits at the end). It can be done; you need to use the following format. This adds the variables $Class and $Alignment. The ", " (comma space) in the middle isn't part if the format; it's there because I wanted to add a comma and space between them, so the output would be: "$Class, $Alignment" rather than "$Class$Alignment".

{$p: {print: $Class}, {print: $Alignment}}{print: $p} {print: $p}


----------



## evilbob

Couple of questions, and sorry in advance if they've been answered upthread:
How far can you go on table data for specific games before you start to get into copyright issues?  Also, it seems like it is not possible to edit someone else's table, correct?

For example, if I wanted to take the Numenera cypher table and add a full description from the book (or perhaps a shorter paraphrase) for each cypher, is that either possible or advisable?  If it's not possible, would it be advisable for me to recreate the table on my own with that much detail?  Another way to put this is:  did you leave out all the description because it was a pain to type or copy/paste, or did you leave it out because that's going over the line of copyright?

Also, if I wanted to extend the cypher generator so that it included a randomized form in which the cypher took shape, it seems like I cannot modify the existing generator, correct?  So I'd have to make it again myself?  If so, is it possible to see/get the script for the existing cypher generator?

All in all, this is absolutely one of the coolest things I've seen on this site!  Great job!


----------



## Morrus

evilbob said:


> Couple of questions, and sorry in advance if they've been answered upthread:
> How far can you go on table data for specific games before you start to get into copyright issues? Also, it seems like it is not possible to edit someone else's table, correct?
> 
> For example, if I wanted to take the Numenera cypher table and add a full description from the book (or perhaps a shorter paraphrase) for each cypher, is that either possible or advisable?  If it's not possible, would it be advisable for me to recreate the table on my own with that much detail?  Another way to put this is:  did you leave out all the description because it was a pain to type or copy/paste, or did you leave it out because that's going over the line of copyright?
> 
> Also, if I wanted to extend the cypher generator so that it included a randomized form in which the cypher took shape, it seems like I cannot modify the existing generator, correct?  So I'd have to make it again myself?  If so, is it possible to see/get the script for the existing cypher generator?
> 
> All in all, this is absolutely one of the coolest things I've seen on this site!  Great job!




I left the NUMENERA stuff out because I wanted err on the side of caution. That doesn't mean that's a legally accurate interpretation, though!  I would think that Monte Cook's fan use policy is the place to check.  It prohibits:



> Game text beyond the terms described above, even if you rewrite it in your own words. The occasional quote from the text is OK, up to half a page at a time, so long as such quotes do not provide full, playable context.
> 
> **Any complete tables, charts, creature listings, or other boxed elements from our published material.




So I would personally interpret that as reproducing the tables in full as a no-no.  But, like I said, I'm no lawyer!  I don't think you can actually prevent someone from reproducing mechanics in their own words, but I'm generally inclined to not upset cool game makers!



> Also, if I wanted to extend the cypher generator so that it included a  randomized form in which the cypher took shape, it seems like I cannot  modify the existing generator, correct?  So I'd have to make it again  myself?  If so, is it possible to see/get the script for the existing  cypher generator?




That feature's coming soon.  I don't want folks to be able to wreck each others' generators, but allowing them to edit _copies_ of them seems perfectly reasonable.
​


----------



## evilbob

Excellent response, and thanks for the link!  (I should have checked that before even posting.)  I would absolutely agree with your interpretation of what is and is not allowed (also not a lawyer).  (Well, maybe a _rules _lawyer...)  

Also, great news on seeing the code from other generators so you can make your own!  I'm guessing this particular example wouldn't be too terribly difficult to reverse-engineer, but others could be.


----------



## Hedrik

*"RFE"*



Morrus said:


> Radio Free Europe?





 RFE = Request For Enhancement


----------



## Bagpuss

Loving the replace roll feature.

http://www.enworld.org/forum/dnd_view_table.php?id=1384

However I've notice that doing [1d6+2] produces an INVALID TABLE ROLL  even though the table has 10 entries.

It seems any +X on the roll gives and INVALID TABLE ROLL result.

I've worked around it for now...

{$roll: {1d6+2}}{Bagpuss(Modern Weapons)[$roll]} works
but 

{Bagpuss(Modern Weapons)[1d6+2]} doesn't

just found a quicker work around.

{Bagpuss(Modern Weapons)[{1d4+6}]} works.


----------



## Morrus

Bagpuss said:


> Loving the replace roll feature.
> 
> http://www.enworld.org/forum/dnd_view_table.php?id=1384
> 
> However I've notice that doing [1d6+2] produces an INVALID TABLE ROLL  even though the table has 10 entries.
> 
> It seems any +X on the roll gives and INVALID TABLE ROLL result.




Thanks for the feedback - I've let the coder know!  Should get it fixed ASAP!


----------



## Bagpuss

See my update above... there is an easy work around.


----------



## Morrus

Bagpuss said:


> just found a quicker work around.
> 
> {Bagpuss(Modern Weapons)[{1d4+6}]} works.




Oh, right.  That's not a workaround, that's the correct formatting.  Dice rolls are always in curly brackets.  My instructions were incorrect!

The weird part is that it worked in your first example without the curly brackets, not that it didn't later without.


----------



## Bagpuss

The formatting you gave originally didn't have the curly brackets.


----------



## Morrus

Bagpuss said:


> The formatting you gave originally didn't have the curly brackets.




Is there an echo in here?


----------



## Morrus

That said, just got a note from the developer that it should work as originally stated now.


----------



## Madmaxneo

All these online generators are fun and useful at times. Great job Morrus and to all the developers!

Is there any chance these will be available on your app for android? That would be even better as I wouldn't have to pre-generate, save, and print them out. 

Bruce


----------



## Mistwell

I've finally started on the D&D Next Beta Test Treasure Generators.

So far I've created three.  They are:

{Mistwell[Pouch Treasure Level 1]}
{Mistwell[Pouch Treasure Level 2]}
{Mistwell[Pouch Treasure Level 3]}

What I'd like to do is combine them with a user variable (level).

Something that would ask your level, and if you answer level 1, then call the level 1 pouch treasure, and else if you answer 2 the level 2 pouch treasure, else if you answer 3 the level 3 pouch treasure, etc. all the way up to level 20.

But so far when I tried to use the if/else commands, it didn't accept it.  No error, just reset back to what was there before.

Anyone know how I'd do this?

Once the pouch ones are done, I can go on to the Chest Treasure, then Hoard treasure.  No idea if I can eventually nest in specific magic item table into the treasure table, but that's down the road still.  For now, I am fine with simply "{1d4} common potions", and the DM needs to assign the potions. [*EDIT *- I was able to nest the magic items, and it works great, so that's taken care of.  I added a few more common potions to the list, as the playtest rules only list Climbing and Healing as common potions.  I made those two the most common for the table, but then added a couple uncommon ones such as poison and water breathing, and then some unlisted ones that make sense as a potion (resistance, speak with animals, feather fall, and disguise self, all of which are cantrips or first level spells.  Then I roll a 1d14, and have 4 numbers assigned to healing, 3 to climbing, 2 to resistance, and 1 to the rest).]


----------



## Morrus

Mistwell said:


> I've finally started on the D&D Next Beta Test Treasure Generators.
> 
> So far I've created three.  They are:
> 
> {Mistwell[Pouch Treasure Level 1]}
> {Mistwell[Pouch Treasure Level 2]}
> {Mistwell[Pouch Treasure Level 3]}
> 
> What I'd like to do is combine them with a user variable (level).
> 
> Something that would ask your level, and if you answer level 1, then call the level 1 pouch treasure, and else if you answer 2 the level 2 pouch treasure, else if you answer 3 the level 3 pouch treasure, etc. all the way up to level 20.
> 
> But so far when I tried to use the if/else commands, it didn't accept it.  No error, just reset back to what was there before.
> 
> Anyone know how I'd do this?




Seems pretty basic; I've done loads like that. How about this:

http://www.enworld.org/forum/dnd_view_block.php?id=1437


----------



## Mistwell

Morrus said:


> Seems pretty basic; I've done loads like that. How about this:
> 
> http://www.enworld.org/forum/dnd_view_block.php?id=1437




Awesome, thank you! Not sure what I had done wrong.
Now, is it possible to have two user variables in one generator? Choosing Level, and then Pouch or Chest or Hoard, would allow for one unified generator.


----------



## Morrus

Mistwell said:


> Awesome, thank you! Not sure what I had done wrong.
> Now, is it possible to have two user variables in one generator? Choosing Level, and then Pouch or Chest or Hoard, would allow for one unified generator.




Yup.  Check out my Pathfinder Background Generator for an example of one which uses 7 user variables.


----------



## Mistwell

Morrus said:


> Yup.  Check out my Pathfinder Background Generator for an example of one which uses 7 user variables.




OK,cool, I should be able to do the whole thing then.  Thanks for the info.


----------



## Mistwell

It would be highly useful if a user selected variable could be referenced in a table, rather than just in a generator.  So for example, instead of me creating a table for every single level for each of pouch, chest, and hoard, all I would have to do is roll 1d20+ the level selected in the generator for the pouch, the chest, and the hoard (which all use the same table).

Maybe there is a way to do this, but I am not immediately seeing how.


----------



## Morrus

It can. Was that not the very feature you asked for months ago, which I had coded for you?


----------



## Mistwell

Morrus said:


> It can. Was that not the very feature you asked for months ago, which I had coded for you?




Err...I thought it was the reverse but let me see.

"The format for changing the roll output is as follows: {username(tablename)[replacedroll]|capscontrol}"

Yeah that seems to be a generator calling to a table.  But I need the table to call to a generator, since it's the generator that has the user variable.

The next example is
"{$x:7}
{admin(cave_monster)[$x]} which would always give the result of $x, which in this case is 7."

Hmm, maybe that is a table calling to a generator's user input? Unclear to me.

So let me give you an example, and you tell me how it should read.

The generator, named "Pouch Treasure Generator", asks for "Level" which is a number from 1-20 that the user selects, as your sample post above.

The table is rolling 1d20+$Level ($Level coming from the generator).

I tried this in the table:
1d20+{Mistwell[Pouch Treasure Generator][$Level]}

And it gave me this error:

"The roll you currently have is invalid. A roll must contain the number of dice followed by a D then the number of sides each die has, eg '2D4' or '4D12'"

So what is wrong with my formatting on that?


----------



## Morrus

It's in the call. The call overrides the roll entry in the table. I'm on my phone so it's hard to demonstrate, but yeah, it does what you want it to do but you're doing it wrong. Sharon's planted herself on Facebook on the PC though, so I don't think I'll be getting on it anytime soon..


----------



## Morrus

Or {$var: {1d20+$level}} followed by:

You see a {admin(cave_monster)[$var]}.


----------



## Morrus

OK, got on the PC.

You need your generator to call the table like this:

{$x: {1d20+$Level}}
{Mistwell[tablename][$x]}

So it will go to the table called tablename and return the item corresponding to $x.


----------



## Mistwell

Morrus said:


> Or {$var: {1d20+$level}} followed by:
> 
> You see a {admin(cave_monster)[$var]}.




I am afraid I don't understand your response.


----------



## Mistwell

Morrus said:


> OK, got on the PC.
> 
> You need your generator to call the table like this:
> 
> {$x: {1d20+$Level}}
> {Mistwell[tablename][$x]}
> 
> So it will go to the table called tablename and return the item corresponding to $x.




Again, I am asking for the reverse.

I do not want the generator to call the table.  

I want the table to call the generator.

The user-selection is in the generator, and I need the table to make use of the user-selection.

Unless you're saying I have to remove the random variable entirely from the table, use the generator to generate that entirely, and just apply options in a table? If that is the case...I don't know what I'd put in the "roll" part of the table.  But wait, earlier you said "The call overrides the roll entry in the table". Ah, so that IS what you're saying.  Damn, that is kludgey, but I will give it a try.  Thanks.


----------



## Morrus

Mistwell said:


> I am afraid I don't understand your response.




I guess you've discovered my dark secret - I'm not good at writing technical instruction manuals! 

I'll try to think of another way to explain it, but my brain's drawing a blank right now.


----------



## Morrus

Mistwell said:


> The user-selection is in the generator, and I need the table to make use of the user-selection.




Yep, that's what I (badly) described.


----------



## Mistwell

OK, I think I got it now.  My generator seems to be working, and this is the code I used:

The pouch contains {Mistwell(PouchCommonCoins)[{1d20+$Level}]} and {Mistwell(PouchRareCoins)[{1d20+$Level}]} and {Mistwell(PouchGemsArt)[{1d20+$Level}]} and {Mistwell(PouchMagicItems)[{1d20+$Level}]}.

I still need new tables for nested results, which are found with Gems and Art, and Magic Items, but I think I already proved that's doable, so it just takes me entering some more tables and calling those tables from the main tables.  Cool, this is going to be very useful.  Thanks Morrus!


----------



## Mistwell

OK, the D&D Next Beta Test Random Treasure Generator is complete!

The only thing missing at this point is I didn't add all the details of the various kinds of art object you can find (I will get to that).  This does not harm any functionality, as it still includes the art in the generators, it will just say "3 Decorative Art valued at 52 gold pieces each" instead of "A Silver Ewer valued at 50 gold pieces, a carved bone statuette worth 56 gold pieces, and a cloth-of-gold vestments work 49 gold pieces".  

Other than that, it's all in there.  And let me tell you, this was way more work than I expected.  For example, every single spell in the game needed to be entered in the data behind the scenes, so it could generate random scrolls (every weapon type, and every armor type, too).   And unlike the art, I did enter all the descriptive data for gemstones, so it will tell you if they are brown-green garnets or golden yellow topaz instead of just "2 semiprecious gems valued at 50 gold pieces each".

Also, in the process of doing this I found there are definitely some gaps in the treasure information that the developers hadn't gotten to yet for the beta test.  As explained above for example, they hadn't gotten to enough common potions.  

Anyway, you can now choose the encounter level (1-20) and the treasure type (pouch, chest, or hoard) and it will draw from the appropriate table and adjust based on the level you selected.

I am very please with this, and I hope others get some use out of it as well, and tell others it exists.  I know I have many months of using the playtest rules until the final rules come out, and this will come in handy for my group when someone says "What's in the pouch on the gnoll I just killed?" Now I can just click a button and tell them, and then cut and paste it to keep track for later.

You can find it here:

D&D Next Random Treasure Generator


----------



## PaleMage

*RED ALERT: Code Interpreter Bug Found*

*RED ALERT*: Code Interpreter Bug Found

I know, I should be probably the ONLY one experimenting this behaviour, due to the arcane tasks I ask O.G.R.E. to perform for me, but try to follow me.

If You try to concatenate any $variables of type STRING (TEXT for the less techy), and the resulting word is LONGER than 50 chars, it ends broken at char 51 by a SPACE, then follows from char 52 with the remaining TEXT.

I wonder that the 50 char lenght is a limit set by the developer in charge of coding O.G.R.E., but it should have to be extended to the usual 255 chars, at least.

I need UNINTERRUPTED output, because I'm coding CODE and TAGS out of O.G.R.E. for PCGen 6.00.0, and I cannot manage random breaks at 50th char, cause PCgen doesn't support any breaks nested to TAGS: this simply breaks the PCgen code.

I'll explain my problem with an example:

I am randomly generating things out of O.G.R.E. tables, and I get sequences of TAGS, stored in TEXT $variables, used in PGgen to define objects class inclusions.

A *Dragon*, to be recognized as itself, has to be TYPEragon.Magic.Breath...

A *Weapon*, to be one of its kind, should be (i.e.) TYPE:Bludgeoning.OneHanded.Finessable.Steel.Magic...

A *Tome *(MY CASE) could be TYPE:Goods.Literature.Scholar.Advanced.ThePlanes.TransitivePlanes.EtherealPlane (far longer than 50 chars), and may contain a section ALSO about another topic, ending in addition of other TAGS like Expert.Arcana.Dragons.ChromaticDragons

The resulting tome HAS to declare ALL the Types it has relations to, then it becomes of TYPE:Goods.Literature.Scholar.Advanced.ThePlanes.TransitivePlanes.EtherealPlane.Expert.Arcana.Dragons.ChromaticDragons

All the differently coloured TAGS comes from a different part of my code, and I have no control over the lenght of the TEXT that will describe my object at the end of the processing.

I'm sure it will not exceed 255 chars, but for sure goes far over the 50th char BUILT IN limitation set by the developer of O.G.R.E. as a the maximum uninterruptable sequence of chars.

What I get currently is:
*TYPE:Goods.Literature.Scholar.Advanced.ThePlanes.T* ransitivePlanes.EtherealPlane.Expert.Arcana.Dragons.ChromaticDragons

where the BOLD part is an UNINTERRUPTED sequence of chars up to the 50th, then a SPACE, followed by the remaining part of the TEXT.

HOPE there will be a solution to this, since this was the last part of my project of coding a random Library Generator, by subject, cost and rarity, PRE-CODED (just a Copy-and-Paste-away) to be used by PCgen.

I let You see what you can get as a result... for my campaign has been a boost in RPG off-adventure.

# CVS $Revision: 0001 $ $Author: PaleMage $ -- Sat Oct 10 13:00:00 2013 -- reformated by prettylst.pl v1.38 (build 5869)
SOURCELONG:Marvelous Nightingale    SOURCESHORT:TRGMN

Blue Nymph Bookstore (The Touring through Timescape Book)    OUTPUTNAME:[NAME]    COST:30    EQMOD:UNREAD_LIT|CHARGES[1]    BONUS:SKILL|Knowledge (The Planes)|1|TYPE=Competence    SPROP:Knowledge (The Planes) +1    BONUS:SKILL|Knowledge (The Planes)|0|TYPE=Competence    SPROP:Knowledge (The Planes) +0    SPROP:The cover of this slim compilation is burnished with silver.    TYPE:Goods.Literature.Scholar.Elementary.ThePlanes.PaleMage.GKL    SOURCEPAGEaleMage_GKL

Blue Nymph Bookstore (Daniel Bell the Draconic's Forlorn Palimpsest)    OUTPUTNAME:[NAME]    COST:50    EQMOD:UNREAD_LIT|CHARGES[1]    BONUS:SKILL|Knowledge (The Planes)|2|TYPE=Competence    SPROP:Knowledge (The Planes) +2    SPROP:The pages of this bejewelled folio are lined with lavender octogons.    TYPE:Goods.Literature.Scholar.Elementary.ThePlanes.PaleMage.GKL    SOURCEPAGEaleMage_GKL

Blue Nymph Bookstore (The Noxious Coinage Guide)    OUTPUTNAME:[NAME]    COST:20    EQMOD:UNREAD_LIT|CHARGES[1]    BONUS:SKILL|Knowledge (The Planes)|1|TYPE=Competence    SPROP:Knowledge (The Planes) +1    SPROP:This embossed book is Volume 6 of a 12-part set.    TYPE:Goods.Literature.Scholar.Elementary.ThePlanes.PaleMage.GKL    SOURCEPAGEaleMage_GKL

Blue Nymph Bookstore (An Expedition to The Villainous Sea of Bones by Mirduil the White)    OUTPUTNAME:[NAME]    COST:20    EQMOD:UNREAD_LIT|CHARGES[1]    BONUS:SKILL|Knowledge (The Planes)|1|TYPE=Competence    SPROP:Knowledge (The Planes) +1    SPROP:Adamantium rivets punctuate the cover of this handwritten violet codex.    TYPE:Goods.Literature.Scholar.Elementary.ThePlanes.PaleMage.GKL    SOURCEPAGEaleMage_GKL

Blue Nymph Bookstore (The Gargantuan Book of Timescape)    OUTPUTNAME:[NAME]    COST:6500    EQMOD:UNREAD_LIT|CHARGES[1]    BONUS:SKILL|Knowledge (Plane of Shadow)|5|TYPE=Competence    SPROP:Knowledge (Plane of Shadow) +5    SPROP:The title of this bejewelled charcoal compilation is emblazoned in silver.    TYPE:Goods.Literature.Scholar.Expert.TransitivePlanes.PlaneofShadow.PaleMage.GKL    SOURCEPAGEaleMage_GKL

Blue Nymph Bookstore (The Pandemonium Encyclopedia)    OUTPUTNAME:[NAME]    COST:500    EQMOD:UNREAD_LIT|CHARGES[1]    BONUS:SKILL|Knowledge (Pandemonium)|1|TYPE=Competence    SPROP:Knowledge (Pandemonium) +1    SPROP:The pages of this well-preserved creed are lined with turqoise circles.    TYPE:Goods.Literature.Scholar.Advanced.MildlyAligned.Pandemonium.PaleMage.GKL    SOURCEPAGEaleMage_GKL

*EVERYTHING YOU SEE CAME OUT OF O.G.R.E.*... only the post-formatting is hand made, but is matter of an easy Find-Replace procedure.

This is only a brief example of what you can get from it... I only need to fix this bug, that appeared only after I tried to concatenate more than 50 chars in a single string.

*NOTE*: If You can address me directly to the developer I can drive him to test it by itself, having him see the code of the generator, if necessary.

TY in advance

*PaleMage *aka
Fabio Montanari
Modena IT


----------



## PaleMage

*AAAAAAARGGHHHH....
*
*I just seen the problem isn't of O.G.R.E. origin...
*
If you look at my POST you see also the examples I made BROKEN at 50th char.

The PROBLEM is the *Content Management System* that runs *ENWorld*... it has, somewhere, don't ask me where (I'm a poor gamer and programmer) a field where you set the maximum lenght of things.

PLEASE: look for that place and fix it to 255 chars... it currently has FOR SURE a fat 50 in place.

PLEASE, Please, please...

PaleMage


----------



## Morrus

Test.

TYPE:Goods.Literature.Scholar.Advanced.ThePlanes.TransitivePlanes.EtherealPlane.Expert.Arcana.Dragons.ChromaticDragons

[Edit; so it does.  How odd!]


----------



## PaleMage

Oddly enough the problem does'nt appear present using the Mobile interface


----------



## PaleMage

PaleMage said:


> *AAAAAAARGGHHHH....
> *
> *I just seen the problem isn't of O.G.R.E. origin...
> *
> If you look at my POST you see also the examples I made BROKEN at 50th char.
> 
> The PROBLEM is the *Content Management System* that runs *ENWorld*... it has, somewhere, don't ask me where (I'm a poor gamer and programmer) a field where you set the maximum lenght of things.
> 
> PLEASE: look for that place and fix it to 255 chars... it currently has FOR SURE a fat 50 in place.
> 
> PLEASE, Please, please...
> 
> PaleMage




OK I arranged another workaround to avoid this annoying 50 chars limitation... but please, take a look if it can be solved.


----------



## GMMichael

Morrus said:


> Test.
> 
> TYPE:Goods.Literature.Scholar.Advanced.ThePlanes.TransitivePlanes.EtherealPlane.Expert.Arcana.Dragons.ChromaticDragons
> 
> [Edit; so it does.  How odd!]




.  Experience point earned.


----------



## reesekj

PaleMage said:


> OK I arranged another workaround to avoid this annoying 50 chars limitation... but please, take a look if it can be solved.




Major props


----------



## GMMichael

Meta-OGRE problem: it's hard to find.  The discussion thread is in the General RPG forum, the forum link leads to the hub (which isn't a forum), and under the Resources drop-down menu it isn't called Online Generic Randomizer Engine, just Random Generators.

Which, I'm afraid, might be discouraging people from using it.

Which leads to my other problem (really just a complaint): I can't find a Random Dungeon Generator or Random Adventure Generator!  This is based off a search for "dungeon" and "adventure" in the title.  What's the OGRE for, if not making random dungeons or adventures!?  I'll write one, if I must.  But I'm already up to my neck in writing projects...


----------



## Morrus

DMMike said:


> Which leads to my other problem (really just a complaint): I can't find a Random Dungeon Generator or Random Adventure Generator!  This is based off a search for "dungeon" and "adventure" in the title.  What's the OGRE for, if not making random dungeons or adventures!?  I'll write one, if I must.  But I'm already up to my neck in writing projects...




No, I don't think anyone's made one of those yet!


----------



## GMMichael

From the Full Search Page, if more than one page of results occur, the site fails to keep the same filter when loading subsequent pages.

This occurred while searching Tables for keyword "treasure."

PS: I got one of these for clicking on the "My Tables" tab in Create:


> Fatal error: Cannot use object of type mysqli_result as array in /var/www/virtual/enworld/forum/dnd_my_tables.php on line 59


----------



## GMMichael

OGRE won't accept "0" (zero) as a table entry.  Which makes it difficult to produce my Number of Encounters table that produces half encounterless rooms, with the other half having 1.5 encounters on average.

http://www.enworld.org/forum/dnd_view_table.php?id=1779

I'm using the table result - 1 for now.


----------



## GMMichael

I promise that I'll assign a category to all of my tables as soon as I can get them to pop up on the My Tables tab, under the Create tab in OGRE.  Now I'm just getting a fatal error.


----------



## GMMichael

I'm back.  Weirdly, when users post comments to a generator, the hyperlink formed by their names links to a search for tables and generators with their name in it, not to the user's profile.


----------



## Maffo

Ogre is an amazing rpg help. I am so glad it exists.


----------



## CapnZapp

Color me stupid, but I can't find the answer to the following question anywhere. I've mucked about with the generator view page, I've scoured the help page, and I've searched this discussion thread. Nothing.

*Q. How do you view and copy-paste a generator's code?* (Not a reference to the generator, i.e. its name)
*A.*

Doing this for tables is trivial: the contents of tables is shown directly as soon as you browse their pages. But generators only have the two buttons "execute" and "copy generator to clipboard". And the second of those is, as far as I can see, only a strangely elaborate way of copying a reference to the generator, presumably for use in your own generators. *How do I look at the actual generator code?*

For instance, here's a generator:

http://www.enworld.org/forum/dnd_view_block.php?id=1855

How do I view the code; the actual implementation? Even if the answer is "you can't; generator source is protected; ask the creator" don't you think this should be discussed SOMEWHERE?

Exasperated regards,


----------



## Morrus

You can't; generator source is protected; ask the creator.


----------



## CapnZapp

Morrus said:


> You can't; generator source is protected; ask the creator.



PLEASE spell this out on your help pages.


----------



## Winterthorn

*I just encountered O.G.R.E. today!*

WOW!!!   I had no idea this existed.  Fantastic!!  I usually spend my time here at ENWorld looking at the home brew forums for 5E and PF and rarely look elsewhere on the site, so while I've seen tiny snippets of OGRE written here and there, without thinking I dismissed it as referring to Steve Jackson's game by that name (gawd I'm dense).  So checking out the Technobabble discussion today brought me round about into the O.G.R.E.  I am amazed that such tools are here!

Thank you Morrus!


----------



## KaceCarter

This looks nice. Thanks for the tip!.


----------



## trainerlongbeach

been waiting to try thus!


----------



## CapnZapp

I suggest all source code is released, so we can build upon each other's efforts.

At the very least, Please make it clear all source code is private rather than public.


----------



## Morrus

This should now be working again!


----------



## The Old Crow

This looks cool and I wanted to give it a shot, but when I try to go to My Tables I get this:

[FONT=&quot]Fatal error: Cannot use object of type mysqli_result as array in /var/www/virtual/enworld/forum/dnd_my_tables.php on line 59

[/FONT]Is this a known issue? Something new?


----------



## thefrickinpope

Wow, this is an awesome collection of tools!


----------



## PieAndDragon

I put up a blog post about O.G.R.E. which looks at building generators and picks a few out. 

Although if you're reading this thread you possibly already know about O.G.R.E!


----------



## Morrus

The OGRE instructions are now found here:

http://www.enworld.org/forum/showthread.php?556445-O-G-R-E-Instructions-wiki-thread

(it's a wiki thread, so anybody can edit it)


----------

