What is a mod?
A mod is important part of the gnurpgm ecosystem.
It enables every user to ease his game creation by combining often used functions
into a little amount of mods.
You can pack anything into a mod.
For example you can create a new single mod wich starts your very own fight system.
Also, mods that have been developed by more advanced users, can be published into
ressource repositories to help less advanced users archiving their goals more comfortable.
A mod consists of two parts:
For a bigger mind map click here.
Remember this window? This is a mod's HTML interface.
To be precise, this is the "HTML interface" of the "Add Gold Mod".
(That thing within the red border)
But why is it's tab labeld with "CMD Parameter Editor"?
Well, the "Add Gold Mod" is designed to increase a matrix value during the game.
But how much gold shall the player receive?
The interpreter script -formaly know as "the mod" - which we'll have a closer look at later on, does not know anything about this amount by itself.
That's why we have to give the mod one or more so called "parameters".
Let's pretend we want to give the player 120 gold pieces. So we fill in into the HTML interface the amount 120 gold pieces
and hit the "validate and submit" button.
Afterwards, we open the "CMD DOM View" tab so we can see what information gnurpgm will use during your game's runtime.
By the way, the "CMD DOM View" represents the execution stack of an event. It shows which mods
are going to be called in what order and with what parameters.
If you take a closer look to the highlighted line which begins with "add_gold" you will notice the syntax
of those so called "CMD"s and the way they want to tell the mod that we want to add 120 gold pieces.
It goes like this (ignore the whitespaces between the words):
MOD_NAME ( PARAMETER_NAME='PARAMETER_VALUE' );
Multiple parameters are comma seperated, like this:
MOD_NAME(PARAM1_NAME='PARAM1_VALUE',PARAM2_NAME='PARAM_2VALUE');
Before we continue we gonna get our vocabuary straight:
So why am I bothering you with all those dirty details?
Because you might want to check on those things once you encounter any trouble or possible bugs.
So, the HTML interface is basicaly a simple HTML file, but there are some things you must keep in mind, so let's checkout the Add Gold Mod's HTML file:
<!DOCTYPE html> <html> <head><meta name="gnurpgm_icon" content="img/add_gold.png" /> <meta name="gnurpgm_author" content="Alexander Hochreiter" /> <meta name="gnurpgm_email" content="axed @ sourceforge.net" /> <meta name="gnurpgm_homepage" content="gnurpgm.sf.net" /> <meta name="gnurpgm_add_description" content="Increase Player's Gold" /> <meta name="gnurpgm_description" content="Increase Player's Gold by %amount " /> <meta name="gnurpgm_type" content="classic,click_n_point,loba3d" /> <meta name="gnurpgm_std_args" content="amount='20'" /><script type="text/javascript"> function check_user_input() { if ( isNaN(document.add_gold.amount.value) ) { alert('Ooops! Please enter a NUMBER!'); } else document.forms["add_gold"].submit(); } </script></head> <body style="background-image: url( img/website_bg.png ); background-repeat: repeat-x;" align="center"> How much gold do you fancy to give to the player?<br><form name="add_gold" method="GET" action="" > <input name="amount" type="text" /> <input type="button" value="validate & submit" onClick="check_user_input()" /> </form></body> </html>
Is not much for a website, ain't it?
However I highlighted the 4 important areas of this html interface:
param1='hi',param2='200'
TODO.
>