Profile for Kelandon

Error message

Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in drupal_get_feeds() (line 394 of /var/www/pied-piper.ermarian.net/includes/common.inc).

Recent posts

Pages

AuthorRecent posts
Dialogue Problem in Blades of Avernum
Off With Their Heads
Member # 4045
Profile Homepage #1
Your states are probably the same. When you have a second character in the same town that speaks, don't use the same states that you used for the first character. So, if your first character used states 1-8, the nextstate on the first node of your second character should be 9.

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Problem with text (again) in Blades of Avernum Editor
Off With Their Heads
Member # 4045
Profile Homepage #9
What specifically is the error message that you're getting, when do you get it, etc?

And those poems won't actually show up with the line breaks and all, I'm assuming. I think you have to do poetry completely differently, using add_dialog_str.

EDIT: Okay, you're abusing quotations marks, for one. If you want quotes to show up within your message_dialog, use the _ character, not the " character. And message_dialog always requires the second set of quotes, regardless of whether there's anything in them or not, just as before.

[ Monday, July 26, 2004 10:10: Message edited by: Kelandon ]

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Problem with text (again) in Blades of Avernum
Off With Their Heads
Member # 4045
Profile Homepage #9
What specifically is the error message that you're getting, when do you get it, etc?

And those poems won't actually show up with the line breaks and all, I'm assuming. I think you have to do poetry completely differently, using add_dialog_str.

EDIT: Okay, you're abusing quotations marks, for one. If you want quotes to show up within your message_dialog, use the _ character, not the " character. And message_dialog always requires the second set of quotes, regardless of whether there's anything in them or not, just as before.

[ Monday, July 26, 2004 10:10: Message edited by: Kelandon ]

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Group Guard in Blades of Avernum Editor
Off With Their Heads
Member # 4045
Profile Homepage #2
Er, just FYI: I just remembered that this part of the article may be wrong. I'm going to have to test it and see if I see any difference between the two kinds of code.

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Group Guard in Blades of Avernum
Off With Their Heads
Member # 4045
Profile Homepage #2
Er, just FYI: I just remembered that this part of the article may be wrong. I'm going to have to test it and see if I see any difference between the two kinds of code.

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
strange building in The Exile Trilogy
Off With Their Heads
Member # 4045
Profile Homepage #1
You'll get in when it's time. If you don't know how to get in, yet, you can't get in.

EDIT: By which I mean that you shouldn't worry about it. The answer will present itself in due course.

[ Sunday, July 25, 2004 18:30: Message edited by: Kelandon ]

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Article: Basic Scripting For Complete Beginners in Blades of Avernum Editor
Off With Their Heads
Member # 4045
Profile Homepage #0
Article: Basic Scripting For Complete Beginners
by Kelandon (tomwatts@berkeley.edu)

Did you read the BoA docs and not understand a word? Are you new to programming but have a great idea for a BoA scenario, if only you could learn to script? Have you never made a scenario before and don't quite know where to start amidst those hundreds upon hundreds of calls in the Appendices? If so, this article is for you. It has some of the basic scripting techniques to get you going.

Many have lamented how hard BoA is to learn compared to Blades of Exile, the older Spiderweb scenario-design engine. I will make frequent reference to tasks in BoE and how they are now accomplished in BoA.

MESSAGE_DIALOG
The first (and simplest) thing you should learn is how to use the call message_dialog. It pops up text on the screen. A simple message_dialog looks like this:

beginstate 10;
message_dialog("This text will pop up in a dialog box.","");
break;
When state 10 is called, a dialog box will pop up showing the text in that string. Since the second string is blank (it consists of ""), it will not be displayed, but if you put something in there, it will show up, too.

beginstate 10;
message_dialog("This text will pop up in a dialog box.",
"This text will show up, too!");
break;
The second string will be separated from the first string by a double-spaced break. Try it if you want to see what it looks like!

This is how you can communicate with the player, to explain the sights, sounds, smells, and tastes that the characters are experiencing in the game. Every time state 10 is called (which usually will happen when the player steps in one of those blue rectangles in the editor, an event rectangle), this message will pop up. But what if you don't want it to show up over and over again? That's what One-Shot specials are for, covered later in this article.

SDFS
Stuff-Done Flags (SDFs) are the basic way of keeping track of whether something has been done or not. They are, as the docs describe, essentially a grid of numbers that is sized 30 by 300, with each number able to range between 0 and 255. The docs have a fairly good description of them, so I won't say more than that you should have some handle on what they are before continuing with this article.

A QUICK NOTE ON CALLS
The docs make a lot more sense if you can organize the categories of calls. There are basically four kinds of calls in BoA: voids, shorts, flow controllers, and object characteristics, as well as a few formatting calls like begindefine[x] that aren't used very often. The calls in the appendices are either preceded by the word "void" or "short," depending on which they are, and these are the main calls that BoA scenarios use. A void does something. A short returns a number and also may do something. (We'll look at exactly what it means to "return a number" in a moment.) A flow controller tells BoA which calls to run. Object characteristics are for custom object scripts, and they aren't a big concern at first.

All you need to know for the purposes of starting out, though, are the above definitions of voids and shorts: a void is a call that does something and a short is a call that returns a number and also may do something.

IF-THENS
If-Then nodes were the way that BoE checked whether something was true or not. BoE only had a few (twenty-six, to be exact, but some of them didn't work). BoA has a slightly more complex format. BoA can check whether anything that can be represented as a number is true or not. And anything that is preceded in the Appendices by "short" is a number. So how do these work? Let's take a look at a basic example.

// If-Then Stuff Done Flag?
if (get_flag(0,0) == 1)
This checks if flag (0,0) is set to 1. If it is, then whatever comes after the "if" call happens. That's the "then" half of this.

// If flag (0,0) is equal to 1, pop up a message_dialog saying so.
if (get_flag(0,0) == 1)
message_dialog("Flag (0,0) is equal to 1.","");
Now if flag (0,0) is set to 1, a dialog box will show up. Let's look at the nuts and bolts of exactly how this happens. Most of the time you won't have to think about this, but it's good to know the specifics of what's going on.

Note, first of all, that TRUE is the same thing as 1 and FALSE is the same thing as 0. Basically, an "if" call checks if the next thing after it is TRUE. So, for instance,

if (TRUE)
message_dialog("True.","");
will ALWAYS pop up the dialog box saying "True." Note that the parentheses are necessary, because BoA will give you an error message without them.

So how do we get from (get_flag(0,0) == 1) to just TRUE, then? Well, (get_flag(0,0) == 1) is a true statement if flag (0,0) does in fact equal 1. You can think of it this way: BoA will simplifies expressions. It will replace get_flag(0,0) with flag (0,0)'s value, and then it will replace the resulting expression with FALSE if it is false or TRUE if it is true. The thought process looks like this:

// This is NOT REAL CODE. This is to demonstrate what simplification looks
// like.
if (get_flag(0,0) == 1)
// Now let's assume that flag (0,0) is 1. Replace get_flag(0,0) with the
// value of the flag.
if (1 == 1)
// Now, since the expression is true, replace it with TRUE.
if (TRUE)
// This will do the next call or, if you use brackets, the next set of
// calls.
Let's try this with another example, because this can be a bit confusing at first.

// This is, again, NOT REAL CODE. This is another example of simplification.
if (get_terrain(45,50) == 128)
// Now let's assume that the terrain in space (45,50) is terrain number 128.
// Replace get_terrain(45,50) with that value.
if (128 == 128)
// Now replace the true expression with TRUE.
if (TRUE)
And this will do whatever comes after it. Let's look at a different kind of example, one in which the expression is false.

// This remains NOT REAL CODE. This is more simplification.
if (get_level(0) > 50)
// Let's assume that character 0's level is 32, which is what get_level is
// checking. Replace get_level with its equivalent value.
if (32 > 50)
// Replace the false equation with FALSE.
if (FALSE)
// Thus the "if" will NOT do the next thing after it.
This suggests a small shortcut to this process. If you have a short and only care if it's zero or non-zero, like is_combat, then you can do this.

if (is_combat())
// whatever your special is
Let's do the same sort of simplification that we did before and see what happens.

// This is STILL NOT REAL CODE.
if (is_combat())
// Now let's say the party is in combat mode. Replace is_combat() with 1.
if (1)
// Now replace 1 with its equivalent, TRUE.
if (TRUE)
// which is exactly the same as before. It will do the next call.
That means that the following two statements are exactly the same.

if (is_combat() > 0)
and
if (is_combat())
BoA does this same process with any and every call that is a short, including some of the ones that don't seem like numbers (for instance, approach_waypoint -- this is one of those calls that returns a number and also does something).

As a sidenote: strictly speaking, "if" checks if the following argument (the thing in parentheses) is FALSE, and doesn't do the next code if it is. Thus, that if (2) is just as true as if (1). That means that if all you want to know is whether a flag has been set to a non-zero value but don't care what that value is, you can do this:

if (get_flag(0,0))
// your special here
That is the same as:

if (get_flag(0,0) > 0)
// your special here
Again, most of the time, you won't need to know any of these more complicated details. Most of the time a simple "if (get_flag(0,0) == 1)" will suffice. It's just handy to have a description of what's going on so that you can refer to it, and the docs have nothing (NOTHING!) on this.

ONE-SHOT SPECIALS
One-Shot specials are events that occur once and then don't happen ever again. This was an entire category of nodes in BoE, so it was easy to do. It takes a bit more thought in BoA. One basic format is this:

// One-Shot special
if (get_flag(0,0) == 0) {
set_flag(0,0,1);
// whatever your special is after this
}
This would, of course, be preceded by a beginstate and followed by a break in a real script, but as we are now talking about parts of a state rather than full states, I will omit those. Let's examine the logic of this One-Shot.

The first time this state is called, the flag won't have been set, so the "if" call will be true, and the following code in brackets will be run. The state will proceed to set the flag (0,0) to 1. Then it will do whatever follows that. So far so good.

The second time the state is called, the flag will have been set, because it was set the first time. Thus, the "if" will not be true and whatever is in brackets won't be done.

(Obviously, for each One-Shot you should use a different flag, or else once one has been called, every One-Shot that uses that flag will stop being called.)

There is an alternate way of doing One-Shots, namely:

if (get_flag(0,0) != 0)
end();
set_flag(0,0,1);
// whatever your special is after this
I do this most of the time because the other way can look ugly you want to check several things at the same time. If you only want the cut scene to run if the party has special item 4 and flag (0,4) is set to 2 and the terrain on space (10,14) is number 121, I think it's a lot easier to read

if (has_spec_item(4) < 1)
end();
if (get_flag(0,4) != 2)
end();
if (get_terrain(10,14) != 121)
end();
than it is to read

if ((has_spec_item(4) == 1) && (get_flag(0,4) == 12) && get_terrain(10,14 == 121)) Tests show that they perform equivalently even in the most extreme of circumstances, however, so you can use whichever one makes most sense to you.

DIALOGUE
Many new designers struggle with dialogue because they don't expect to have to handle much code in order to write it. While it is not as code-heavy as states in a town script, dialogue still contains code, and you have to understand a few basic commands in order to write it.

The unit of dialogue scripts is the "node," rather than the "state" that you'll find in almost every other script (except custom objects scripts, which contain "definitions"). Nodes consist of at least six things: a begin, a state, a personality, a nextstate, a question, and texts. I'll discuss each in turn, albeit somewhat out of order.

Begins are easy. Each node in each town is numbered from 1 to 99, and the first part of every node is a begintalknode call followed by the number. It looks like this:

begintalknode 1; Next come the definitions. Each node contains a series of definitions that tell what the node is. They look like this:

state = 1;
personality = 11;
nextstate = -1;
question = "Who are you?";
text1 = "_My name is Skassa._";
Personality is simple. It does very little. Basically, you give each character in your scenario a unique personality number. This is relatively easy to keep track of if you use ten personalities per town, so that town 0 contains personalities 0-9, town 1 contains 10-19, and so on. Of course, the numbers are completely up to you. Every dialogue node with that character should use the same personality number.

For the rest of this, it can be a bit confusing, so let's work through an example. Here is some sample dialogue, from Valley of the Dying Things. (It has been simplified slightly for the purposes of this example.)

begintalknode 38;
state = -1;
personality = 3;
nextstate = 31;
question = "Avizo";
text1 = "You meet a young magician, dressed in worn robes. He is clearly quite ill.";
text2 = "He doesn't look like he wants to talk with you. He coughs, and gasps slightly. _I'm Avizo. What do you want?_";

begintalknode 39;
state = 31;
personality = 3;
nextstate = 32;
question = "Are you on a mission here?";
text1 = "_No. Not anymore. I am trying to flee the Vale. What is it to you?_";

begintalknode 40;
state = 31;
personality = 3;
nextstate = -1;
question = "That cough sounds pretty bad.";
text1 = "He looks annoyed. His wheezes have a distinctly tubercular sound to them.";
The first node, number 38, is the beginning of the conversation. The party initiates conversation with Avizo, starting at state -1. Then the texts (the things labeled "text1" and "text2") are displayed. At that point, the conversation moves to what's labeled "nextstate," namely state 31. Then that node is done.

Look to the next two nodes. Both have "state = 31;" in them. That means they'll be available when the nextstate from a node is 31. Node 38 contains "nextstate = 31;" so they'll be available right now. What does that mean? That means that the parts labeled "question" in nodes 39 and 40 will show up as questions that the party can ask the character. The first possible question is "Are you on a mission here?" and the second is "That cough sounds pretty bad."

So far all the player has seen are the two texts from node 38 and the two questions from 39 and 40. The player now gets to choose to ask one of the questions. If the choice is the first one, then the text from node 39 will show up. The nextstate for node 39 is 32, meaning that whatever nodes have states of 32 will become available (so their questions will show up underneath the text), too.

If the player chooses the second choice, going to node 40, the text from node 40 will be displayed, but the nextstate is -1, so no questions will be displayed. Instead, the player will be given the choice to start the conversation over (from node 38, where it began) or end dialogue altogether.

This sounds much harder than it is. Play with it just a little bit, and you'll get the hang of it pretty quickly. There are more advanced features, like condition, action, and code, but they are for later, once you've gotten the hang of the rest of this.

CONCLUSION
These are some of the basic tasks in BoA. The call message_dialog allows you to give text to the player to read. The flow controller "if" allows you to check virtually anything in the game. One-Shots allow you to do something once and never do it again. Dialogue allows you to have conversations between the party and other characters in the scenario.

A bit of advice to the new designer: of the many kinds of scripts that you can design (town, scenario, dialogue, creature, terrain, custom objects, outdoor section), the first kind of script that you should master is the town script, and you should learn how to use the information listed above. Save trying to take on terrain or creature scripts for a bit later, as they are not really necessary at first. Town scripts, however, are important, and the information above should help to get you started scripting.

And above all, be persistent. Making scenarios is tricky, but if you keep working, you (yes, even YOU) can make that scenario you've been thinking about but weren't sure you could really create.

--------------

Look! I wrote an article! What do you think? The "code" part looks horrible in the forums, but it will look better on the SW site.

EDIT 1: Changed the bit about the One-Shots. Just remembered that I've only observed the "slowing down" effect in START_STATEs. Er, wait. Maybe I haven't. Has anyone else noticed this? I have to do some experiments now. This part may be wrong.

EDIT 2: Decided to err on the safe side for the moment.

EDIT 3: Made Isaac's correction.

EDIT 4: Corrected based on Keep's comments.

[ Friday, July 30, 2004 11:38: Message edited by: Kelandon ]

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Article: Basic Scripting For Complete Beginners in Blades of Avernum
Off With Their Heads
Member # 4045
Profile Homepage #0
Article: Basic Scripting For Complete Beginners
by Kelandon (tomwatts@berkeley.edu)

Did you read the BoA docs and not understand a word? Are you new to programming but have a great idea for a BoA scenario, if only you could learn to script? Have you never made a scenario before and don't quite know where to start amidst those hundreds upon hundreds of calls in the Appendices? If so, this article is for you. It has some of the basic scripting techniques to get you going.

Many have lamented how hard BoA is to learn compared to Blades of Exile, the older Spiderweb scenario-design engine. I will make frequent reference to tasks in BoE and how they are now accomplished in BoA.

MESSAGE_DIALOG
The first (and simplest) thing you should learn is how to use the call message_dialog. It pops up text on the screen. A simple message_dialog looks like this:

beginstate 10;
message_dialog("This text will pop up in a dialog box.","");
break;
When state 10 is called, a dialog box will pop up showing the text in that string. Since the second string is blank (it consists of ""), it will not be displayed, but if you put something in there, it will show up, too.

beginstate 10;
message_dialog("This text will pop up in a dialog box.",
"This text will show up, too!");
break;
The second string will be separated from the first string by a double-spaced break. Try it if you want to see what it looks like!

This is how you can communicate with the player, to explain the sights, sounds, smells, and tastes that the characters are experiencing in the game. Every time state 10 is called (which usually will happen when the player steps in one of those blue rectangles in the editor, an event rectangle), this message will pop up. But what if you don't want it to show up over and over again? That's what One-Shot specials are for, covered later in this article.

SDFS
Stuff-Done Flags (SDFs) are the basic way of keeping track of whether something has been done or not. They are, as the docs describe, essentially a grid of numbers that is sized 30 by 300, with each number able to range between 0 and 255. The docs have a fairly good description of them, so I won't say more than that you should have some handle on what they are before continuing with this article.

A QUICK NOTE ON CALLS
The docs make a lot more sense if you can organize the categories of calls. There are basically four kinds of calls in BoA: voids, shorts, flow controllers, and object characteristics, as well as a few formatting calls like begindefine[x] that aren't used very often. The calls in the appendices are either preceded by the word "void" or "short," depending on which they are, and these are the main calls that BoA scenarios use. A void does something. A short returns a number and also may do something. (We'll look at exactly what it means to "return a number" in a moment.) A flow controller tells BoA which calls to run. Object characteristics are for custom object scripts, and they aren't a big concern at first.

All you need to know for the purposes of starting out, though, are the above definitions of voids and shorts: a void is a call that does something and a short is a call that returns a number and also may do something.

IF-THENS
If-Then nodes were the way that BoE checked whether something was true or not. BoE only had a few (twenty-six, to be exact, but some of them didn't work). BoA has a slightly more complex format. BoA can check whether anything that can be represented as a number is true or not. And anything that is preceded in the Appendices by "short" is a number. So how do these work? Let's take a look at a basic example.

// If-Then Stuff Done Flag?
if (get_flag(0,0) == 1)
This checks if flag (0,0) is set to 1. If it is, then whatever comes after the "if" call happens. That's the "then" half of this.

// If flag (0,0) is equal to 1, pop up a message_dialog saying so.
if (get_flag(0,0) == 1)
message_dialog("Flag (0,0) is equal to 1.","");
Now if flag (0,0) is set to 1, a dialog box will show up. Let's look at the nuts and bolts of exactly how this happens. Most of the time you won't have to think about this, but it's good to know the specifics of what's going on.

Note, first of all, that TRUE is the same thing as 1 and FALSE is the same thing as 0. Basically, an "if" call checks if the next thing after it is TRUE. So, for instance,

if (TRUE)
message_dialog("True.","");
will ALWAYS pop up the dialog box saying "True." Note that the parentheses are necessary, because BoA will give you an error message without them.

So how do we get from (get_flag(0,0) == 1) to just TRUE, then? Well, (get_flag(0,0) == 1) is a true statement if flag (0,0) does in fact equal 1. You can think of it this way: BoA will simplifies expressions. It will replace get_flag(0,0) with flag (0,0)'s value, and then it will replace the resulting expression with FALSE if it is false or TRUE if it is true. The thought process looks like this:

// This is NOT REAL CODE. This is to demonstrate what simplification looks
// like.
if (get_flag(0,0) == 1)
// Now let's assume that flag (0,0) is 1. Replace get_flag(0,0) with the
// value of the flag.
if (1 == 1)
// Now, since the expression is true, replace it with TRUE.
if (TRUE)
// This will do the next call or, if you use brackets, the next set of
// calls.
Let's try this with another example, because this can be a bit confusing at first.

// This is, again, NOT REAL CODE. This is another example of simplification.
if (get_terrain(45,50) == 128)
// Now let's assume that the terrain in space (45,50) is terrain number 128.
// Replace get_terrain(45,50) with that value.
if (128 == 128)
// Now replace the true expression with TRUE.
if (TRUE)
And this will do whatever comes after it. Let's look at a different kind of example, one in which the expression is false.

// This remains NOT REAL CODE. This is more simplification.
if (get_level(0) > 50)
// Let's assume that character 0's level is 32, which is what get_level is
// checking. Replace get_level with its equivalent value.
if (32 > 50)
// Replace the false equation with FALSE.
if (FALSE)
// Thus the "if" will NOT do the next thing after it.
This suggests a small shortcut to this process. If you have a short and only care if it's zero or non-zero, like is_combat, then you can do this.

if (is_combat())
// whatever your special is
Let's do the same sort of simplification that we did before and see what happens.

// This is STILL NOT REAL CODE.
if (is_combat())
// Now let's say the party is in combat mode. Replace is_combat() with 1.
if (1)
// Now replace 1 with its equivalent, TRUE.
if (TRUE)
// which is exactly the same as before. It will do the next call.
That means that the following two statements are exactly the same.

if (is_combat() > 0)
and
if (is_combat())
BoA does this same process with any and every call that is a short, including some of the ones that don't seem like numbers (for instance, approach_waypoint -- this is one of those calls that returns a number and also does something).

As a sidenote: strictly speaking, "if" checks if the following argument (the thing in parentheses) is FALSE, and doesn't do the next code if it is. Thus, that if (2) is just as true as if (1). That means that if all you want to know is whether a flag has been set to a non-zero value but don't care what that value is, you can do this:

if (get_flag(0,0))
// your special here
That is the same as:

if (get_flag(0,0) > 0)
// your special here
Again, most of the time, you won't need to know any of these more complicated details. Most of the time a simple "if (get_flag(0,0) == 1)" will suffice. It's just handy to have a description of what's going on so that you can refer to it, and the docs have nothing (NOTHING!) on this.

ONE-SHOT SPECIALS
One-Shot specials are events that occur once and then don't happen ever again. This was an entire category of nodes in BoE, so it was easy to do. It takes a bit more thought in BoA. One basic format is this:

// One-Shot special
if (get_flag(0,0) == 0) {
set_flag(0,0,1);
// whatever your special is after this
}
This would, of course, be preceded by a beginstate and followed by a break in a real script, but as we are now talking about parts of a state rather than full states, I will omit those. Let's examine the logic of this One-Shot.

The first time this state is called, the flag won't have been set, so the "if" call will be true, and the following code in brackets will be run. The state will proceed to set the flag (0,0) to 1. Then it will do whatever follows that. So far so good.

The second time the state is called, the flag will have been set, because it was set the first time. Thus, the "if" will not be true and whatever is in brackets won't be done.

(Obviously, for each One-Shot you should use a different flag, or else once one has been called, every One-Shot that uses that flag will stop being called.)

There is an alternate way of doing One-Shots, namely:

if (get_flag(0,0) != 0)
end();
set_flag(0,0,1);
// whatever your special is after this
I do this most of the time because the other way can look ugly you want to check several things at the same time. If you only want the cut scene to run if the party has special item 4 and flag (0,4) is set to 2 and the terrain on space (10,14) is number 121, I think it's a lot easier to read

if (has_spec_item(4) < 1)
end();
if (get_flag(0,4) != 2)
end();
if (get_terrain(10,14) != 121)
end();
than it is to read

if ((has_spec_item(4) == 1) && (get_flag(0,4) == 12) && get_terrain(10,14 == 121)) Tests show that they perform equivalently even in the most extreme of circumstances, however, so you can use whichever one makes most sense to you.

DIALOGUE
Many new designers struggle with dialogue because they don't expect to have to handle much code in order to write it. While it is not as code-heavy as states in a town script, dialogue still contains code, and you have to understand a few basic commands in order to write it.

The unit of dialogue scripts is the "node," rather than the "state" that you'll find in almost every other script (except custom objects scripts, which contain "definitions"). Nodes consist of at least six things: a begin, a state, a personality, a nextstate, a question, and texts. I'll discuss each in turn, albeit somewhat out of order.

Begins are easy. Each node in each town is numbered from 1 to 99, and the first part of every node is a begintalknode call followed by the number. It looks like this:

begintalknode 1; Next come the definitions. Each node contains a series of definitions that tell what the node is. They look like this:

state = 1;
personality = 11;
nextstate = -1;
question = "Who are you?";
text1 = "_My name is Skassa._";
Personality is simple. It does very little. Basically, you give each character in your scenario a unique personality number. This is relatively easy to keep track of if you use ten personalities per town, so that town 0 contains personalities 0-9, town 1 contains 10-19, and so on. Of course, the numbers are completely up to you. Every dialogue node with that character should use the same personality number.

For the rest of this, it can be a bit confusing, so let's work through an example. Here is some sample dialogue, from Valley of the Dying Things. (It has been simplified slightly for the purposes of this example.)

begintalknode 38;
state = -1;
personality = 3;
nextstate = 31;
question = "Avizo";
text1 = "You meet a young magician, dressed in worn robes. He is clearly quite ill.";
text2 = "He doesn't look like he wants to talk with you. He coughs, and gasps slightly. _I'm Avizo. What do you want?_";

begintalknode 39;
state = 31;
personality = 3;
nextstate = 32;
question = "Are you on a mission here?";
text1 = "_No. Not anymore. I am trying to flee the Vale. What is it to you?_";

begintalknode 40;
state = 31;
personality = 3;
nextstate = -1;
question = "That cough sounds pretty bad.";
text1 = "He looks annoyed. His wheezes have a distinctly tubercular sound to them.";
The first node, number 38, is the beginning of the conversation. The party initiates conversation with Avizo, starting at state -1. Then the texts (the things labeled "text1" and "text2") are displayed. At that point, the conversation moves to what's labeled "nextstate," namely state 31. Then that node is done.

Look to the next two nodes. Both have "state = 31;" in them. That means they'll be available when the nextstate from a node is 31. Node 38 contains "nextstate = 31;" so they'll be available right now. What does that mean? That means that the parts labeled "question" in nodes 39 and 40 will show up as questions that the party can ask the character. The first possible question is "Are you on a mission here?" and the second is "That cough sounds pretty bad."

So far all the player has seen are the two texts from node 38 and the two questions from 39 and 40. The player now gets to choose to ask one of the questions. If the choice is the first one, then the text from node 39 will show up. The nextstate for node 39 is 32, meaning that whatever nodes have states of 32 will become available (so their questions will show up underneath the text), too.

If the player chooses the second choice, going to node 40, the text from node 40 will be displayed, but the nextstate is -1, so no questions will be displayed. Instead, the player will be given the choice to start the conversation over (from node 38, where it began) or end dialogue altogether.

This sounds much harder than it is. Play with it just a little bit, and you'll get the hang of it pretty quickly. There are more advanced features, like condition, action, and code, but they are for later, once you've gotten the hang of the rest of this.

CONCLUSION
These are some of the basic tasks in BoA. The call message_dialog allows you to give text to the player to read. The flow controller "if" allows you to check virtually anything in the game. One-Shots allow you to do something once and never do it again. Dialogue allows you to have conversations between the party and other characters in the scenario.

A bit of advice to the new designer: of the many kinds of scripts that you can design (town, scenario, dialogue, creature, terrain, custom objects, outdoor section), the first kind of script that you should master is the town script, and you should learn how to use the information listed above. Save trying to take on terrain or creature scripts for a bit later, as they are not really necessary at first. Town scripts, however, are important, and the information above should help to get you started scripting.

And above all, be persistent. Making scenarios is tricky, but if you keep working, you (yes, even YOU) can make that scenario you've been thinking about but weren't sure you could really create.

--------------

Look! I wrote an article! What do you think? The "code" part looks horrible in the forums, but it will look better on the SW site.

EDIT 1: Changed the bit about the One-Shots. Just remembered that I've only observed the "slowing down" effect in START_STATEs. Er, wait. Maybe I haven't. Has anyone else noticed this? I have to do some experiments now. This part may be wrong.

EDIT 2: Decided to err on the safe side for the moment.

EDIT 3: Made Isaac's correction.

EDIT 4: Corrected based on Keep's comments.

[ Friday, July 30, 2004 11:38: Message edited by: Kelandon ]

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
The Scenario Ranking Contest Has Begun! in Blades of Exile
Off With Their Heads
Member # 4045
Profile Homepage #4
Also possibly because many scenarios are "rated R."

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
What TERRAIN NUMBER is it for the Surface Water? in Blades of Avernum Editor
Off With Their Heads
Member # 4045
Profile Homepage #3
EDIT: Thought better about this post. Sigh.

[ Sunday, July 25, 2004 14:28: Message edited by: Kelandon ]

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
What TERRAIN NUMBER is it for the Surface Water? in Blades of Avernum
Off With Their Heads
Member # 4045
Profile Homepage #3
EDIT: Thought better about this post. Sigh.

[ Sunday, July 25, 2004 14:28: Message edited by: Kelandon ]

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Blades of Avernum Center in General
Off With Their Heads
Member # 4045
Profile Homepage #2
You're missing one: find it completely and totally unnecessary.

It's not a good sign when fully one quarter of your members can't even spell their own names. :P

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
What TERRAIN NUMBER is it for the Surface Water? in Blades of Avernum Editor
Off With Their Heads
Member # 4045
Profile Homepage #1
Water is floor 23, but I hope that's not what you're asking, because if so, you had better literally be blind if you can't see this yourself.

EDIT: And floor 57 for the surface.

[ Sunday, July 25, 2004 14:15: Message edited by: Kelandon ]

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
What TERRAIN NUMBER is it for the Surface Water? in Blades of Avernum
Off With Their Heads
Member # 4045
Profile Homepage #1
Water is floor 23, but I hope that's not what you're asking, because if so, you had better literally be blind if you can't see this yourself.

EDIT: And floor 57 for the surface.

[ Sunday, July 25, 2004 14:15: Message edited by: Kelandon ]

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Blades of Avernum Center : Official Annoucement in Blades of Avernum
Off With Their Heads
Member # 4045
Profile Homepage #17
From the man himself. The first post is the important one.

EDIT: Also note that the Lyceum is hosting a BoA contest as we speak.

EDIT 2: Besides, even if the Lyceum didn't exist, the Louvre would still be a graphics archive and UA would still have a script archive.

[ Sunday, July 25, 2004 12:20: Message edited by: Kelandon ]

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Erika's old quarters.... in Blades of Avernum
Off With Their Heads
Member # 4045
Profile Homepage #5
Although I have yet to see a source for that. I can't tell if that's something that one of the various plotlines made up (the Arena, the *i/Drakey/TM thing, etc) or if it's actually in the games.

[ Sunday, July 25, 2004 11:42: Message edited by: Kelandon ]

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
new board? in General
Off With Their Heads
Member # 4045
Profile Homepage #9
Hey! Lost Souls is okay. Remotely. Much better than Galactic Core, anyway. I'm actually tempted to buy Lost Souls sometimes, at least right before I smack myself repeatedly..

I do think there should be a board for the non-Jeff Vogel Spiderweb games. Take Galactic Core and just stuff Homeland, Oceanbound, and Lost Souls in there too. Subterra can have its own board because people actually play that game from time to time.

Actually, if anyone wanted to talk about any of those three games in the GC board, Alorael might not mind.

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
CUT SCENES in Blades of Avernum Editor
Off With Their Heads
Member # 4045
Profile Homepage #3
As a quick warning, they look much harder than they are. You basically can just cut and paste code to make them.

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
CUT SCENES in Blades of Avernum
Off With Their Heads
Member # 4045
Profile Homepage #3
As a quick warning, they look much harder than they are. You basically can just cut and paste code to make them.

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
New scenarios in progress in Blades of Exile
Off With Their Heads
Member # 4045
Profile Homepage #13
It was submitted to Spiderweb a little while ago. I'm surprised it's not up on the tables yet. Presumably it will end up here when it does go up. Also, CaputMortuum from the Lyceum just made a new scenario. I think BoE is going to be fine, even with the existence of BoA.

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Blades of Avernum Center : Official Annoucement in Blades of Avernum
Off With Their Heads
Member # 4045
Profile Homepage #12
There was an attempt to do this for BoE. It was called the Megasite. It, er, died. Alcritas has some fun rants about this over in the oldest threads in the Lyceum, circa summer/fall '01.

The problem with duplicating services (a graphics archive, a script archive, a scenario review area) is that doing so decentralizes those services. If there are two graphics archives, then everyone who makes BoA graphics will have to know about and submit to two different places, as well as (often) hosting them on their own web site. Having two places to which to submit graphics makes the likelihood that ALL graphics will end up in both archives decrease. Yes, many people will submit to both, but some will not. Why? For any of a thousand reasons. But it should be obvious that the possibility that a graphic will end up in one archive and not another increases as the number of graphics archives increase.

The same holds true for scripts. The same holds true for virtually anything. And the situation with scripts is worse: UA has had a script archive running virtually since BoA came out, and the Lyceum just started up another one. I didn't argue against starting one at the Lyceum because it gets much more traffic than UA, and it's been the Blades center for six years. It started as Alcritas's personal web site, but it is much more than that now. But yet another script archive going online would increase the possibility that scripts would be split: some would be in UA's archive, some in the Lyceum, some at the "BoA Center." And if you like going to one place for all your scripting needs, this would be VERY irritating. You will have to comb through three different archives just to make sure that you've seen all the scripts in existence.

There are two major caveats to this: first, Spiderweb's services don't count. BoE-ers remember that Spiderweb dropped BoE completely after a few years, and most of us don't count on Spiderweb to continue doing anything that it is currently doing. If it does, great. If it does not, we'll be ready. That's why CSR exists: it duplicates the rating service at Spiderweb, but it does it better, and it does it independently.

Second, personal web sites to host one's own material are fine. I have a web site that hosts my own scripts and scenarios independent of any central databases. TM has the same, and so do many other community members.

Overwhelming, if you don't want your site to be viewed as a competing site, stop setting up competing services. We don't need another script archive. We don't need another graphics archive. Heck, we don't even really need another set of scenario reviews: CSR is pretty good about that. Even "community news" isn't really needed, because message boards take care of that, and we have these and the independent Lyceum boards. There are things that the community could use that we don't already have, and your time would be better spent setting them up.

Like what? Well, we don't have a comprehensive links list. TM's BoE links list is outstanding, probably the best in existence. I know that if a BoE site exists, TM will link to it. You could provide the same sort of thing for BoA. If you want to help out newbies, have slightly longer blurbs, and separate the databases from the personal pages. Newbs should know that the Louvre is a database and the Lyceum is a big, important site and that my page is a personal page. Paragraph descriptions (rather than sentence descriptions) would be a good thing.

We also don't have an independent BoA scenario database, like Alexandria for BoE. Brett Bixler said he'll set one up as soon as we have a few more scenarios, but you could do it instead. Brett is a busy man, and it would be one less thing to worry about.

Or you could turn this into your own personal web site, where you host your *own* scripts and your *own* scenarios and your *own* graphics, much like my page, or TM's, or any of dozens of other Blades pages.

I appreciate the amount of time and energy that you're putting into this, as I'm sure we all do. But I'd just like to see that energy go to something useful.

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
fun on ZKR in Blades of Avernum
Off With Their Heads
Member # 4045
Profile Homepage #6
The "Special" species (number 12) is immune to Simulacrum, according to the docs.

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
new board? in General
Off With Their Heads
Member # 4045
Profile Homepage #1
No. No. No. It would be worse than the Galactic Core board.

Although it would be kind of nifty to have a Lost Souls board. That's a decent game. Kind of.

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Avernum 3- another sad story about the character editor... in Tech Support
Off With Their Heads
Member # 4045
Profile Homepage #1
Contacting Spiderweb is relatively easy. E-mail Jeff at spidweb@spidweb.com.

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Erika's old quarters.... in Blades of Avernum
Off With Their Heads
Member # 4045
Profile Homepage #1
The creator of VoDT. Jeff is one person.

And there is some debate as to whether that is actually Erika Redmark's old office. It was a rather long time ago.

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00

Pages