You've got your Place. You want to have different things happening for a select group. Different areas which are only accessible to the group, or some rooms which have different descriptions (the barman recognises you as you come in and starts to pour your favourite drink). The group itself could come in various forms. Your clan is the most obvious, but maybe there's several closely allied clans, oh and another few groups of friends who happen to belong to a variety of other clans, but which you've given special mementos to help mark out who they are.
This means that in every place where you have something special happening for this rather hetrogenous group, you need to use three or four different contrivances to see if they belong. You have several places where you need to test for this, and it all starts becoming a pain in the neck. If on top of this you have different things happening depending on what your guest has previously been up to, then that doesn't make it any easier.
One possible solution is to have a separate program to check if your guest is one of your special group. It can then have as many clauses and subclauses as you want. But how does this help? You write your program, and call it "Friend?" say. In your main program you call it, it runs and decides whether the guest is a special friend, and then returns back to the main program whatever it decides.
Use Thoughts! In your Friend? program use a Thought called friend (remember that Thoughts must have names that are exclusively written in lower case letters). Set this Thought to one for anybody who passes the requirements to be considered one of your special group. Then, anywhere where you want to see if your guest is a special friend, you need to ensure that this program has been run somewhere on this page load, and then just check the Thought friend.
You don't need to run the Friend program at the precise point where you're checking to see if your guest is in your group. As long as it's been run somewhere on the page beforehand. In particular, if you want to check for special group status twice (once to decide what page to show and once to decide what doors are showing or unlocked say) then you still need only run this program once.
The above describes a program which gives back a yes/no, either/or result. This is not necessary. You could have a program which can return any set of values.
For example you might have different descriptions for some of your rooms depending on the weather and time of day. But not different descriptions for every one of the forty nine possible combinations. Instead, you've grouped the different combinations into five different classes and have different descriptions for each of these classes. The nature of these classes means that it's quite awkward to work out just what class the current time/weather combination falls into, it takes a fair bit of programming.
Instead of having to build the same program in every room where you're going to have differing descriptions, give each of your classes of time/weather combinations a number and then have just one program hidden away somewhere which works out which class is currently happening and assigns its number to a Thought (called 'timeweather' say).
Now everywhere where you want to check the time/weather status, just call this program and then use the Thought timeweather. Much easier.
Proceed to next tutorial.
Return to previous tutorial.
Advanced Tutorial Contents Page.
Return to Places Overview