Dialogue Tutorial

Appendix: Function/Variable List

 

This data is taken largely from the TESCS Help file, rearranged, with a few additions and corrections. If there are any errors, e-mail me.

There are six entries in the Function/Variable list. Each one has the following structure:

List 1
List 2
Comparator
Numeric Value

Each of these except the last is a drop-down list. These are the comparators:

Comparators
=
"equal to"
!=
"not equal to"
<
"less than"
<=
"less than or equal to"
>
"greater than"
>=
"greater than or equal to"

These are the choices in the first two lists. The contents of the second list depend on what you choose in the first, as shown in the table.

List 1 List 2 Description
Function
Function list The special dialogue functions.
Journal List of quests This returns the highest journal index that has ever been set for a particular quest.
Item List of carriable items This returns the number of any item that the player has in his or her inventory. You can test for any item in the game that can be carried. [Useful for Fedex quests.]
Dead List of NPCs and creatures This returns the number of any NPC or Creature ID that is dead. [Useful for Kill Foozle quests.]
"Not" conditions
These are the inverse of the standard conditions fields. Numerical comparisons aren't relevant for these.
NotID List of NPCs and creatures This is true if the speaker is not this particular ID.
NotFaction List of factions This is true if the speaker is not in this faction.
NotClass List of classes This is true if the speaker is not of this class.
NotRace List of races This is true if the speaker is not of this race.
Not Cell List of cells This is true if the player is not in this cell. Note that this function takes the most time to calculate and can slow the dialogue responses down if you use several of them in the same topic.
Variables
Global List of all global variables This lists all the global variables. You can test against the value of any global variable. Certain useful globals are made available by the game; see list below.
Local List of all local variables This lists all the local variables. You can test for any variable, but if the speaker does not have a script or their script does not contain the variable you specify, this will return 0.
Not Local List of all local variables This is true if the speaker does not have this local variable. Unlike most "Not" functions, this one does care what you set the variable to. Both the dialogue and the variable itself should be set to 0.
Functions
NPC State
Function Alarmed This is 1 if the speaker is currently Alarmed (has detected a crime), and 0 otherwise.
Function Attacked This is 1 if the speaker has ever been attacked, and 0 otherwise.
Function Creature Target This is 1 if the speaker is targeting a creature, and 0 otherwise.
Function Detected This is 1 if the speaker detects the player and 0 otherwise.
Function Friend Hit

For companions/followers. Value depends on whether the player has ever hit them.

0 = never been hit
1 = hit by pc 1st time
2 = hit by pc 2nd time
3 = hit by pc 3rd time
4 = hit by pc 4th time, and the npc/creature is not in combat with the pc

Function Should Attack This is 1 if the speaker wants to start combat with the player.
NPC AI
Function Alarm This returns the base value of the speaker's Alarm AI Setting.
Function Fight

This is the AI Fight Setting of the speaker. This is the base value, not the value after disposition, distance, crime level, and so on have been added.

Function Flee This returns the base value of the speaker's Flee AI Setting.
Function Hello This returns the base value of the speaker's Hello AI Setting.
NPC Stats
Function Health Percent This returns the percent health of the speaker.

Function Level This is the current level of the speaker.
Function Reputation This returns the speaker's reputation.
Relationship
Function Same Faction This is 1 if the speaker and the player are in the same faction and 0 otherwise.
Function Same Race This is 1 if the speaker and the player are of the same race and 0 otherwise.
Function Same Sex This is 1 if the speaker and the player are of the same gender and 0 otherwise.
Function Talked to PC This is 1 if the speaker has ever talked to the player and 0 otherwise. You can use this to have someone say something the first time you speak with them.
Factions
Function Faction Rank Difference This is the player's rank in the speaker's faction minus the speaker's rank. Note that the first rank in a faction is 0 and your "rank" is –1 if you do not belong to that faction. A return value of 0 is the same rank, 1 is PC is one rank higher, -2 is PC is two ranks lower.
Function Rank Requirement

This checks to see if you "qualify" for the next rank in the speaker's faction.

0: you do not have enough Faction Reputation and do not meet the skill requirements.
1: you meet the skill requirements, but do not have the Faction Reputation.
2: you have the Faction Reputation, but do not meet the skill requirements.
3: you qualify.

Function PC Expelled This returns 1 if the player is expelled from the speaker's faction and 0 otherwise.
Function Reaction High This returns the highest faction reaction between the speaker's faction and all of the player's factions.
Function Reaction Low This returns the lowest faction reaction between the speaker's faction and all of the player's factions.

Player Stats
Function PC [Health / Magicka / Fatigue] Returns the player's current health, magicka, or fatigue.
Function PC [Skill] Returns player's level in selected skill.
Function PC [Attribute] Returns player's level in selected attribute.
Function PC Reputation This is the value of the player's total reputation. This is separate from individual faction reputations and affects how everyone in the world reacts to you.
Function PC Sex This is 0 if the player is male and 1 if the player is female.
Function PC Crime Level This is the amount of gold the player has on their head, the same as the "bounty" on the character sheet.
Function PC Clothing Modifier This is the total value of all the clothing and armor the player is wearing. The value of your equipment changes the disposition of people in the game.
Player Disease
Function PC Common Disease This is 1 if the player has a common disease and 0 otherwise.
Function PC Blight Disease This is 1 if the player has a blight disease and 0 otherwise.
Function PC Corprus This is 1 if the player has corprus and 0 otherwise.
Function PC Vampire This is 1 if the player is a vampire and 0 otherwise.
Function Werewolf This is 1 if the player is a werewolf and 0 otherwise. (Check this!) Bloodmoon only.
Function Werewolf Kills Returns the number of werewolves the player has killed. (Check this!) Bloodmoon only.
World
Function Weather

This returns the current weather.

0 Clear
1 Cloudy
2 Foggy
3 Overcast
4 Rain
5 Thunder
6 Ash
7 Blight
8 Snow (Bloodmoon only)
9 Blizzard (Bloodmoon only)

Control
Function Choice

For branching dialogue.

This works with a command in the results field called "Choice." When the function "choice" appears in the results field, the game searches the current topic again, this time setting the value of "choice" to whatever number the player selected. Just like a regular search, it stops at the first response for which all conditions are true (so it may not necessarily hit the response you expect).

Globals
From GhanBuriGhan's Morrowind Scripting for Dummies. May be more with Bloodmoon.
Time
Global Float GameHour Holds the current hour of the day (0.0 - 23.99)
Global Short Day Holds the current day of the month (1-30)
Global Short Month Holds the current Month of the year (1-12)
Global Short Year (427) Holds the current year
Global Float TimeScale (30.0) Sets the ratio of real-time/game-time
Player
Global Short PCRace

Contains the player's race:

1 Argonian
2 Breton
3 Dark Elf
4 High Elf
5 Imperial
6 Khajiit
7 Nord
8 Orc
9 Redguard
10 Woodelf

Global Short PCVampire Vampire status: 0=Normal, 1=Vampire, -1= cured
Global Short VampClan If the PC becomes a vampire, this indicates his clan. 1=Aundae, 2=Berne, 3=Quarra
Other
Global Short Random100 Is randomly set between 0-90 every frame (set by main script)
Global Short NPCVoiceDistance (750) Used as a distance when Following NPCs call after you to wait for them