More uncensored behind the scenes action

I got another evening in at Major Arcana. When I actually sat down to it, I didn’t really feel like scripting. So instead I did some much needed engine work. It turns out I’m in a programming mood at the moment.

Although the engine names each NPC for the purpose of calling their scripts, the actual scripts refer to the NPCs by number. This was getting pretty cumbersome, so I rewrote some of the commands to deal with npc names rather than numbers. I also added a few commands to group NPCs with identical names, so instead of, for example, initialising 15 doors as invisible, walkable NPCs, I can just call one command to initialise all the NPCs with the scriptname “door” the way I want them.

Essentially, the changes mean that the blocks of script like the following have changed from …

npc init{
  npcinit(0/-1/0/1/1);  #Gladius's Head;
  npcinit(1/-1/0/0/0);  #Chest;
  npcinit(2/-1/0/0/0);  #Chest;
  npcinit(3/-1/0/0/0);  #Lights;
  npcinit(4/-1/0/0/0);  #Lights;
  npcinit(5/-1/0/0/0);  #Lights;
  npcinit(6/-1/0/0/0);  #Lights;
  npcinit(7/-1/0/1/1);  #Door;
  npcinit(8/-1/0/1/1);  #Door;
  dir(up/1);
  music(0);
}

… to the considerably more manageable …

npc init{
  hide(Gladius_Head);
  npcinitall(Chest/-1/0/0/0);
  npcinitall(Lights/-1/0/0/0);
  hideall(door);
  dir(up/Gladius_Head);
  music(0);
}

This was even more ridiculous on some of Crystalus’s maps, which have about twenty “door” npcs each.

Here’s a full list of the command changes, just for fun. When I get a chance I’ll change the rest of the scripting engine to behave the same way.

npcinit(npc/appearance/movement/activation/passibility);
Previously NPCs had to be numbered relative to partysize 
(i.e. if there were four NPCs active in the party, then 
npcinit(0/x/x/x/x) would initialise the 5th NPC.
hide(npc);
This is a new shortcut for npcinit(npc/-1/0/1/1), which 
every door uses. i.e. invisible, activated when stood on, 
can walk over.
dir(direction/npc);
Now supports scriptnames as well as numbers. 
dir(left/Stella) will tell the NPC with the scriptname 
"Stella" to face left, for example.
appearance(spritenum/npc);
Like dir, alters an NPC's appearance, and now supports 
scriptnames.
scriptholder(npc);
The "scriptholder" is the currently active NPC. This would 
be redundant if I redesigned all the commands to deal 
with a given NPC instead. For now, I'm changing the 
scriptholder whenever I want to move an NPC. 
speaker(npc);
The "speaker" is the currently talking NPC, used to 
position textboxes. It's particularly useful to be able 
to just go speaker(Crystalus) rather than having
to do speaker(0) or whatever.
npcinitall(npc/appearance/movement/activation/passibility);
Like npcinit, only it deals with all NPCs with the 
given scriptname, allowing me to initialise multiple 
NPCs at once.
hideall(npc);
Like hide, only dealing with multiple NPCs. Makes it 
dead easy to initialise all doors with one fell swoop, 
as they say.

Hmm. Well, that was pointless. It makes my job a bit easier, I suppose, but it’s something that the player will never see or appreciate. The engine suffers from a lot of that, to be honest – if I’d only taken more shortcuts, I might actually have a compete game at this point… 🙁

By the way, if you came here through the frontpage (which you really should do as this is a website not a blog and if you skip the frontpage you’re going miss stuff like when I add actual content and then you’ll be sorry) you might have noticed that the whole thing’s running off wordpress now. Thanks, DeveloperX!

* 4 Comments

4 Comments so far

  1. stephen on April 12th, 2007

    Eh? Given the amount of time you’re saying that scripting’s going to take you, surely the work that you did there will speed things up overall?

  2. Terry on April 12th, 2007

    Hmm – well, I suppose you could look at it that way, yes.

  3. Verious on April 20th, 2007

    That definitely looks far more streamlined and manageable.

  4. Terry on April 20th, 2007

    It is 🙂 I suppose I was just feeling a little negative about the whole project when I posted this…

Leave a reply