magicc
Use this command to compile magic definitions for spell casting, magical devices, monster natural magic, phenomanon, and other automation within the Arana ecosystem that falls under magic.
magicc [-c] [-s] [-sql] [-db] [-o scofile] [-magic id] filename
Where
Option |
Description |
-c |
Compile the specified source filename. |
-s |
Compile the specified source filename and output the p-codes. |
-sql |
Compile the specified source filename and output as SQL INSERT statements to a file. The file will be filename, but with a .sql extension. |
-db |
Compile the specified source filename and output to the MagicLibrary database table. |
-o scofile |
Compile the specified source filename and output to the specified scofile. |
-magic id |
Compile the specified source filename and use id as its assigned magic id (MagicLibrary table index), overriding any in the source file. |
filename |
The source magic definition file, e.g. myfile.sc. See file syntax below. |
A magic definition file has a .sc file extension by convention.
Inside the file, any line begining with # is a comment line and ignored.
Each magic definition starts with a line with the magic definition id (id from MagicLibrary database table) inside square brackets, e.g. 301000015. A single file may contain multiple definitions.
It is followed by optional metavariable assignments; these metavariables specify name, category, and other attributes of the magic.
Metavariable |
Description |
Name |
A name to display to DM that describes the nature of the magic, e.g. Red Dragon Breath. |
Category |
The category of magic, e.g. spell, device, phenomanom, beast. |
Class |
For spell, the character class that casts the spell. |
Level |
For spell, the spell level. |
Code for a magic definition is written in trigger blocks. Code is only executed when triggered to do so. There are a number of trigger states: init, done, cast, possess, dispossess, attach, detach, time offset, and more. These triggers are variously used among the different types of magic that occur - casting a spell, using a magical device, natural body magic, a trap, or a phenomanom; not all triggers apply to each manifestation.
Trigger |
Description | ||||||||||||||
init |
When a manifestation is created, the very first trigger runs the init block of code. Use this section to initialize any state that the manifestation requires over the duration of the manifestation. | ||||||||||||||
done |
When a manifestation completes, the very last trigger runs the done block of code. This is a good place to clean-up or undo any property changes that do not persist beyond the manifestation. | ||||||||||||||
cast |
When a caster completes a invoking a spell, the cast trigger code is run. | ||||||||||||||
possess |
For a magical device, when a person takes ownership of a device, the possess trigger code is run. Possession does not require touching. | ||||||||||||||
dispossess |
For a magical device, when a person gives away a device, the discposses code is run. | ||||||||||||||
attach |
For a magical device, the attach trigger code is run when the owner/caster wields the device. For a sword, this is putting it in the hand; for a ring, this is putting it on a finger; etc. For body magic, the attach trigger code is run when the creature is created. | ||||||||||||||
on |
A phenomanon or magical device may have an on and off mode, whether triggered explicitly with a switch or some other mechanism. When switched to the on mode, the on trigger code is run. | ||||||||||||||
off |
A phenomanon or magical device may have an on and off mode, whether triggered explicitly with a switch or some other mechanism. When switched to the on mode, the off trigger code is run. | ||||||||||||||
save |
If a target gets a saving throw and that throw is successful, then the save trigger code is run. | ||||||||||||||
interruption |
A magic spell may be interrupted. When it is interrupted, this trigger code is run. | ||||||||||||||
active |
|||||||||||||||
idle |
|||||||||||||||
app-trigger |
|||||||||||||||
time-trigger |
When in a trigger state, not all code needs to run immediatley. Some code may delay a few seconds, minutes, hours, or more. A delay begins with +. It is followed by a time expression. Time terms are a number followed by a time unit, e.g. +4s is 4 seconds, +4m is 4 minutes, etc. Instead of a number, a numerical expression may appear inside parenthesis, e.g. +(caster.level)t for one turn per caster level (or hit dice).
|
An instance of a magic definition running is called a manifestation. The id for a manifestation correlates to the MagicThread database table, where a manifestation's state is maintained.
A manifestation must have a caster. The caster may be the person who owns or initiated the magic, or the caster may be a place (in which case it is a phenomanom); see caster below. A manifestation also has a target, which may be the caster, a specific other, or a target area.
In a manifestation, typically the target's properties are altered. A property may be hit points, bonus to hit, bonus damage, age, and so forth. It is important to remember to reverse any property changes that are temporary due to the manifestation.
Although magic is bounded only by one's imagination, a manifestation is bounded by the limited number of properties on the target. When magic goes beyond the target's properties, the magic definition typically outputs a comment to the caster, such as "Your blurry vision has been restored."
The language syntax is similar to other programming languages, but not as rich or flexible. Statements are not line bound; they may span multiple lines or multiple statements may appear on one line. Statements are separated by semi-colons. A statement may be a single command or a series of commands inside curly brackets, e.g. { }.
Statement |
Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
uses Item.keyword[(expression)] |
When this magic is performed, it consumes an item as specified by keyword. See the Item database table. The amount of expression determines how many of the item is consumed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
create Item.keyword create Monster.keyword |
Create an item or a monster. The keyword is used to search the Item or Mosnter database table. This is actually a function; it returns information back to the creation. A created item becomes possessed by the caster. A created monster becomes controlled by the caster. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
at is(keyword) at isnot(keyword) at affected(expression) at area(area-params) |
Specify the target of the spell. Multiple at parameters can be specified, separated by commas. Only one at command should be present. The is() term may be: ally, undead, opponent, evil, good, cleric, ally. The isnot() term is the opposite of is(). The affected() clause determines now many (expression) targets are included. The area() term specifies an area. Area types are (point), (sphere,(distance)'), (box,(distance)',(distance)'), (cone,(distance)',(distance)'), (cylinder,(distance)',(distance)'), or (wall,(distance)',(distance)'). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
object person |
Specify the recipient of the magic, which may be caster, user or target. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
var=[person.]query question [using dice|text|yn|int] |
Ask a question of the person (caster, user, or target). The question is a double quoted string. The answer can be restricted through the using clause, which is a dice amount, a text answer, a yes/no answer, or an integer answer. The answer to the question is stored in the variable. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
revert [(person.]property)] |
Revert a changed property back to its value before the magic was applied. The person may be optionally specified. See the list of properties below. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
save [(person.]property)] |
Remember a property value before the magic is applied. The person may be optionally specified. See the list of properties below. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
requires |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
rollsave |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
settrigger |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
becomes |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
remove |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
comment |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
for (assign; condition; update) statement |
Loop over the statement repeatedly. Before the first execution of statement, evaluate the express assign, which is typically a variable assignment. Before each execution of statement, the condition is evaluated; as long as it resolves to try (non-zero), statement will be executed. After each execution of statement, update is evaluated. A common use of for() is to assign a starting value to a looping variable (assign), specify the stopping criteria in condition and update the looping variable in update. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (expression) statement; [else statement;] |
Evaluate the expression and execute statement if expression is true (non-zero). If an else keyword follows the statement, then execute its statement if expression is false (0). In side a for() loop, the statement may be replaced with @trigger to redirect execution to the named trigger code. Code execution does not return to following the if() statement in this case. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
while (expression) statement; |
Repeatedly perform statement while expression remains true (non-zero). The expression is evaluated before each execution of statement. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
do statement while (expression) |
Perform statement repeatedly until expression if false (0). The statement is executed at least once since the evaluation of expression follows each execution of statement. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
stop |
Stop execution of this manifestation immediately. The @done trigger is not executed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
abort string |
Stop execution of this manifestation immediately with an error message. The @done trigger is not executed. The error message is recorded in the commhub.log log file and the DM console. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
wait |
Wait the specified amount of game time. This may be used alternatively to the delay triggers. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
change_opponent(params) |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[person.]property <op > expression |
Change a property about a person. person may be caster, user, or target. And depending upon the person, different properties may apply. If person is not specified, then the caster/possessor is assumed.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[person.]intent= intent |
person may be caster, user, or target. The value of intent may be: nothing, dead, immobile, submissive, attack-close, attack-far, attack-standby, backstab, subdue, parry, cast, use-device, attack-special, move, change-weapon, push, sneak, carry-comrad, exit, and switch-team. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
var=expresion |
Calculate a value in expression and assign it to your variable. Note that variables are not typed and do not need to be initially declared. |