StormFront "If-Then" technique 08/17/2009 02:06 PM CDT
One of the problems I mentioned in writing my fish-selling script was figuring out how to say basically "Check to see if you're in the fishmonger's hut in Langenfirth. If you are, proceed with selling, and if not, tell the user so and quit." I couldn't figure out how to handle that in StormFront, so I did what any self-respecting hack would do -- I stole the technique from someone else's script:

> # Make sure you're in the fishing shop in Langenfirth
> match start Net and Bait, Fish Market
> match wrongRoom obvious paths
> put look
> matchwait

The basic idea is that when the game is processing a MATCHWAIT in a script, it exits the matching table as soon as the first string of matcing text is encountered in the game. So for instance, with very rare exceptions, every time you type LOOK you will get a description of the room followed by a line that says "Obvious paths" like this:

> [Net and Bait, Fish Market]
> The market reeks of fish although it sells a variety of goods. Once
> nothing more than a shop for bait, it now buys the local catch and
> sells many sundries along with the fish to travelers and locals alike.
> A large barrel marked "Today's Special" sits in a corner near the door.
> Shelves of sundries line the wall and there is a selection of tackle
> along another. The sound of fish being slapped hard on wood, and the
> rending sound of a knife through scales is heard from the back. You
> also see the Halfling Lodo, a fish-weighing scale hanging from the
> ceiling on a ragged rope and a long counter with some stuff on it.
> Obvious exits: out.

So in the script above, if I am standing in the room labeled "Net and Bait, Fish Market", which is the first thing you see when you type LOOK there, the script jumps directly from that line to the "START" section of the script. It never has a chance to get to the "obvious paths" line in the game window to trigger the second MATCH.

Conversely, if I am standing in any other room in the game, the text "Net and Bait, Fish Market" will not come up before the text "obvious paths" shows, and so the script will jump to the "wrongRoom" section.

This is a workable way to do a pseudo "If-Then" sort of check, and one that will be obvious to long-time SF scripters. But it might help the next SF scripting newbie like me down the line trying to find an answer on how to do something like it.
_________________________________
The HeroMachine 3 Alpha is now open
for public testing if you want to
make a portrait of your character --
http://www.heromachine.com
Reply
Re: StormFront "If-Then" technique 08/17/2009 02:19 PM CDT
Insert obligatory genie 3 plug... no need for that stuff if you're using G3. You know where you are all the time with little to no chance of having to go to a wrongRoom section.


________________________________________

I mean, if I drop a nuke on you, "Can't hit me I'm hiding!" isn't going to really get you very far.

- GM Dartenian
Reply
Re: StormFront "If-Then" technique 08/17/2009 02:35 PM CDT
Yep, there are at least two other, much more (MUCH MUCH more) script-friendly front ends out there. But I feel like there are probably a lot of people who, like me, prefer to use the one the company puts out, whether out of laziness or familiarity or compatibility concerns or just personal preference ("It's purty!").

We still want to script some things, though, and since most of the hard-core scriptologists write for one of the more advanced FEs, we're sort of left in the lurch. Maybe some of this basic-level stuff will help one of them down the line save some aggravation, who knows.

_________________________________
The HeroMachine 3 Alpha is now open
for public testing if you want to
make a portrait of your character --
http://www.heromachine.com
Reply