[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4505: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3706)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4507: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3706)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4508: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3706)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4509: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3706)
SIMPLECommunity.org • View topic - Inserting variables in Resources/Files

Inserting variables in Resources/Files

Any technical questions (installation, configuration etc) should be posted here!

Inserting variables in Resources/Files

Postby lauramreid on Tue Oct 14, 2008 1:53 pm

In the scenario I'm constructing, the critical event is an email from the Senior Partner (NPC) to the Trainee Lawyer (Player/student). I was wondering if it was possible to upload a 'template' resource and have it populated automatically with the details that differ between the simulations ie name of Law Firm, the name of the Senior Partner, the client etc (all of which are variables that I have created as part of the simulation).

Thanks,

Laura
lauramreid
Active
 
Posts: 11
Joined: Thu Sep 11, 2008 10:27 am

Re: Inserting variables in Resources/Files

Postby mhughes2k on Tue Oct 21, 2008 1:53 pm

Yes you can. This a 3 step process:

1. You need to identify all of the "bits" that will change: so things like "Senior Partner name", "Player's name", etc

2. You need to then create a variable in the tools. A variable is made up of 2 bits. The first part is the label (which will should match up to the things identified in the previous step). The 2nd part is the "value". At very least this is just a piece of text that is substituted. However you can use a number of "formulas" to do some very fancy things. More later...
(as a note, when name simulations don't use punctionation! Also labels are case sensitive so "seniorPartnersName" is different from "seniorpartnersname")

3. Final step, in the resources you need to replace all incidences of (for example) the senior partner's name (e.g. Michael Hughes) with a variable tag. The variable tag takes the form of the variable's label (seniorPartnersName) surround by curly braces { }. So the tag for the senior Partner's name would be {seniorPartnersName}


"Formulas"
All formulas start with a # and are in UPPERCASE
There are a fair number of formulas that can be used. A few examples:

#SELECT(item1,item 2, item3, item 4,...,item n) - random selects one of the items in the list.
#DATE(h:m:i, 13/01/2008, 09:00:00, +1 hour) - Generates dates/time strings. This one generates a time in the format hours:mins:secs with the value of +hour later than 9am on 13 Jan 2008. Alternative values for the date and time are "today" and "now", which are useful if you want to generate a date/time relative to current date and/or time.

The "Add Variable" drop down has a few helpful "builders" to help construct more complicated variables and Appendix A of the has more detailed information about these formulas (they're referred to Variable Instructions)
Hope this helps.

M!

Application Developer, LTDU
SIMPLE Project Core Team
(w) http://personal.strath.ac.uk/michaelhughes/
(e) michaelhughes@strath.ac.uk
(twitter): http://twitter.com/mhughes2k
mhughes2k
SIMPLE Core Team
 
Posts: 130
Joined: Tue Jul 01, 2008 12:05 pm
Location: Glasgow


Return to Technical

Who is online

Users browsing this forum: No registered users and 2 guests

cron