Enquirer Home Page | Twitter | Back to Improbable Island
 

Programming Tutorial III - SuperGrem

I accidentally SUPERGREM'ed the whole place!

Right. So you want a hold a top secret meeting in a room in your Place. The thing is, you don't want to have to keep the door to that room locked for a week or longer, as that's how long your chat posts persist without GREM or the owner of the Place manually deleting it. That is... until now. Now we have the ability to write programs and we have two very helpful components that have replaced the soundproofing that we used to have. Introducing: The Clear Story and Clear Banter Contrivances.

What this program will do is to watch out for the use of a command, /supergrem. If you or a guest use this command, in either the story or banter channel (if you have one), then all comments in either channel will be erased. Note: As far as the banter channel goes, then this will work if you have local banter or place-wide banter, but not global banter. You only get control over the banter that's in your Place, not over the banter for the entire Island.

In Places we now have three options for Chat Boxes in Rooms: no Chat Box, Single Channel and Dual Channel. In the first case there is no need for any kind of SUPERGREM as there is no Chat Box. In the second case the channel is treated as a Story Channel, so the Clear Story Contraption is needed. The third case, Dual Channel, gives a Room both the Story and the Banter Channel, so for the SUPERGREM to be effective, both a Clear Story Contraption and a Clear Banter Contraption are needed. Below are examples of both programs.

Single Channel SUPERGREM

  • The First Row: The 'Exact Match Commentary Command' Contrivance (With the parameter set to 'SUPERGREM')
  • The Second Row: The 'Clear Story Contraption'
  • The Third Row: Nothing

 Clearing Story

Dual Channel SUPERGREM

  • The First Row: 'The Exact Match Commentary Command' Contrivance (With the parameter set to 'SUPERGREM')
  • The Second Row: The 'Clear Story' Contraption and the 'Clear Banter' Contraption
  • The Third Row: Nothing

 Clearing Story and Banter


Wahay, you've used your first Contrivance!

The Exact Match Commentary Command looks out for a command typed into either chat channel, and then compares it with the text that you set as its parameter. If the two match up exactly (case insensitive) then the Contrivance passes. Otherwise it fails. A command is distinguished by starting with a '/' and will not be shown in the general chat.

Note for budding programmers

Remember: "Contraptions are used to do things while Contrivances are used to ask questions." In this case the Contrivance is asking if a player has typed SUPERGREM in the chat box. It's only when this has happened that the program moves on to the second line and the Contraption(s) there are triggered. This is how you build things into your Place that only work in certain circumstances. Doors that are only unlocked to members of a particular clan, backdrops of rain drops that only appear when the weather is raining and so forth.

Note that the Contraptions are on a new line. What a program will do is to look along the first line. If it finds a Contrivance it checks to see whether it 'passes' or not; in this case whether the user has entered the command SUPERGREM. If it does, then the program procedes to the next line, otherwise it stops. If the program finds a Contraption, then this counts as an automatic pass. For this reason, try to keep Contraptions and Contrivances on separate lines. If for example, you want a room with a trees background and also a Supergrem, then put the Trees Contraption (and the brightness Contraption) on the first line, the Exact Match Commentry Contraption on the second, and the Clear Commentary/Banter Contraptions on the third.

The next tutorial will be another example of this, but this time spread over multiple rooms, showing again how it's important to consider not just the programming but how it fits in with the whole structure of the house. As a metaphor, think of a place as like a body. The rooms and pages are the skeleton. The writing is the skin and hair. Programs provide muscles. They make your place dynamic. But they don't exist in isolation, they're attached to the various bones to make it act.

Alternatively, you can take a brief detour to find out about the debugging tool, a rather useful tool that can be very helpful if when you make mistakes.


Go to next tutorial.
Return to previous tutorial.
Introduction to the Debugging Tool
Tutorial Contents Page
Return to Introduction to Programming.
Return to Places Overview

 
Logged in as: Guest (Guest)
places/progtutiii.txt · Last modified: 2018/05/27 21:42 by Hairy Mary