Regnus 5.5

The Random Text Scripting Language

The Regnus Parser For The Web

About

The Regnus Parser for the Web is a hosted copy of the Regnus Parser for PHP, allowing you to use Regnus scripts to generate random text, images and content on your own webpages, or in forum signatures or other places on the web where you might want to include random content, without needing access to or knowledge of PHP or your own webspace.

For example, the quoted text displayed below is randomised each time the page is refreshed:

When Tereronarus was but a young boy, his village was razed, and its people killed, by a pack of dragons serving the powerful despot Liaanilin. The sole survivor, he began a long quest to find purpose in his life. In the Marsh of Gananon, he aided the men of Bryanville in their battle against an insane ogre. When captured by the black elf Eaion, he was forced to prove himself in the arena before Eaion's howling minions. Bravely, he fought against a pack of leprechauns, which he destroyed with ease, and a pair of cockatrices, which he also defeated. His penultimate battle was against a black dragon, during which his dagger shattered, forcing him to take up the mace of a fallen foe. Having overcome this final challenge, he fought his way through the crowd to face Eaion, whom he bested, freeing the land from his tyranny. His quest finally ended when he exterminated the black lord Arionus.
Generated by the Regnus script Trash Fantasy Adventures, by Ryan J. Bury

The parser can output content generated from a Regnus script in two different formats: either as an image, or as text. The text method is more powerful, as it allows you to seamlessly transclude Regnus-generated random content into your own page, to be displayed using your own styling rules. However, if you are not familiar with the basics of server-side scripting, or you do not have access to a properly configured server-side scripting language (such as PHP), you may find that the image method is much easier to implement in your site.

The image output method also allows you to generate content in situations where the use of PHP scripts is not possible - for example in a forum signature.

Note: If you do have access to your own webspace and are comfortable with the very basics of PHP, you would be recommended to use a copy of the Regnus Parser for PHP, as this ensures that the parser will run as fast as your webpages need, especially if your scripts are also hosted on the same server. Otherwise, you are welcome to use the hosted Regnus Parser for the Web, writing its output to your own webpages. This is of course slower (as it will use further HTTP requests between servers to deliver the content), and will also rely on this server's uptime, but it does have the advantage of being very easy even if you are not experienced in PHP, or even if your server doesn't support PHP in the first place.

Note: the Regnus Parser for the Web is fully supports UTF-8 character encoding, so scripts parsed using this parser are recommended to be encoded in this format.

Using The Regnus Parser For The Web

The hosted parser will, of course, be slower than a script running on your own site's server, but using it is nevertheless very simple, and perhaps more convenient for some uses. As the parser itself is hosted here at the Regnus homepage, all you have to do is call it from your own scripts, pass it the appropriate parameters, and the generated content will appear on your pages.

Generating Image Output

In order to include an image on your site displaying random text generated using Regnus, you can simply add an image tag to your (X)HTML with its src attribute set to point to the hosted parser's location on this server.

For example, copy and paste the following code into your page, replacing the highlighted variables with your own parameters:

<img src="http://www.regnus-scripting.info/parsers/web/Regnus.php?output=image&amp;imagewidth=YourWidth&amp;script=YourScript&amp;label=YourLabel" alt="Random text generated using Regnus: www.regnus-scripting.info" />

Note: The example above assumes that your site is marked up with (X)HTML, but the method should be easy enough to convert to another markup language.

YourWidth should be replaced by the width (in pixels) of the image you want to generate. The height of the image is determined automatically by the amount of text generated. YourWidth must be at least 150px. Also, it should always be at least long enough to accomodate the longest single word appearing in the script you want to use. It is recommended that you give the image a width of at least 320px for most scripts.

YourScript should be replaced by the full path of the script which you want to use, which can be a URI (for example if you have uploaded the script you want to use to your own server).

YourLabel should be replaced by the name of the Label in your chosen script from which you would like to generate text.

Note: if your script or Label names include any spaces, you must replace these with "%20" in the URI.

So, if you wanted to generate a 400px-wide image from the "RANDOM PICK" Label of the script Something Completely Different hosted here, you could use:

<img src="http://www.regnus-scripting.info/parsers/web/Regnus.php?output=image&amp;imagewidth=400&amp;script=http://www.regnus-scripting.info/scripts/Something%20Completely%20Different.rsf&amp;label=RANDOM%20PICK" alt="Random text generated using Regnus: www.regnus-scripting.info" />

And if you wanted to generate a 600px-wide image from the "Story" Label of the script The Storyteller, you would use:

<img src="http://www.regnus-scripting.info/parsers/web/Regnus.php?output=image&amp;imagewidth=600&amp;script=http://www.regnus-scripting.info/scripts/The%20Storyteller.rsf&amp;label=Story" alt="Random text generated using Regnus: www.regnus-scripting.info" />

Note: by default, the image is output in PNG format.

Generating Text Output

Remotely generating text content using the hosted Regnus parser is possible using any scripting language which allows content to be requested via HTTP, but for simplicity, the examples given here use PHP (though of course in most cases, if you have access to a PHP installation, you would be better off uploading the Regnus Parser for PHP to your own server and using it locally!)

Assuming you are using PHP, simply copy the following code into your page wherever you want to generate random content, replacing YourScript with the name of your script, and YourLabel with the name of the Label in that script from which you'd like to generate text:

<?php
@readfile("http://www.regnus-scripting.info/parsers/web/Regnus.php?script=YourScript&label=YourLabel");
?>

The script you specify as YourScript must have a full path, which can be a URI. Assuming that, for example, you want to include text from the script Proverbs on your site, from the Label "Wise Proverb", you could use the following:

<?php
@readfile("http://www.regnus-scripting.info/parsers/web/Regnus.php?output=text&script=http://www.regnus-scripting.info/scripts/Proverbs.rsf&label=Wise%20Proverb");
?>

In fact, if you paste the above code into your page with no changes, you should hopefully see that your page now includes text generated from the Proverbs script.

Note: if your script or Label names include any spaces, you must replace these with "%20" in the URI, as shown above in the example Label "Wise Proverb"!

Additional Parameters

The Regnus Parser for the Web supports various parameters to control its behaviour, all of which can be set using command-line arguments in the URI when accessing the parser via HTTP.

The following parameters are supported:

Script
URI Parameter
script
Description
Contains the path and filename of the Regnus script from which you would like to generate text.
Label
URI Parameter
label
Description
Contains the name of the Label in the specified script from which you would like to start parsing.
Script Information
URI Parameter
information
Values
  • blurb
  • title
Description
If this parameter is set, the parser will output the chosen meta-information (either the script's Title or Blurb) instead of generating text from the specified Label.
Output Type
URI Parameter
output
Values
  • text
  • image
Description
Specifies whether the parser should output the generated text as text content or a PNG image. The default if unspecified is "text".
Image Width
URI Parameter
imagewidth
Description
This parameter sets the width (in pixels) of the image generated when outputting an image. If unspecified, the default is "150" (the minimum allowed width).
(X)HTML New Lines
URI Parameter
newlines
Values
  • br
Description
If this parameter is set to "br", the parser will replace standard new-line characters in the generated text with the (X)HTML tag "<br />", which can be useful if you are displaying the generated text directly on a web document and need to markup the newlines as such.
Escape Ampersands
URI Parameter
escapeampersands
Values
  • true
  • false
Description
If "true", this parameter replaces all ampersands within the generated content with (X)HTML entities. By default, this is "true" if outputting text, and "false" if outputting an image.
Strip Tags
URI Parameter
striptags
Values
  • true
  • false
Description
If "true", this parameter removes all (X)HTML tags from the generated content. By default, this is "true" if outputting an image, and "false" if outputting text.

Attribution

Please feel free to use the following link to let people know that your page is powered by Regnus!

<p>Random content on this page generated by the <a href="http://www.regnus-scripting.info/">Regnus</a> scripting language.</p>