I have reached a point in my story where I want to start using ‘magic words’. They will mostly be intransitive verbs that will be ‘magic word’ commands that will enable direct travel or other actions. I would also like these verb groups to be able to handle conditional parts that use conditional things such as ‘if-if else-else’ and so forth. These will be one set
of the heavily used comands of the story. I’m looking for source code examples or other ideas on how I might go about this. Any ideas or help is more than welcome. Thanks, in advance.
The code for any given “magic word” (especially intransitive ones) is going to be more or less the same as the code for the Glow action that we’ve worked on in the past.
I’ve enclosed some VERY rough code which is my first attempt at using a ‘magic word’ My problem is that I’m not very sure as how to set up the punctuation and structure of this code. I could use some help with this.
RonG
/*******************************************************************************
* Magic Words - To create an intransitive verb (no object), you have to write *
* at leasr two sections of code. *
*******************************************************************************/
/* Melenkurion - Magic Word - Is Travel Action ******************************/
VerbRule(Melenkurion)
'Melenkurian'
: MelenkurionAction
verbPhrase = 'Melenkurion'
;
DefineIAction(Melenkurion)
execAction(){
//action code goes here
if me !in Room1
"That word, although quite powerful, won't work here. Try another
location. "
break
else
goto Room3
}
;