magicc

Index Home Arana > Arana Architecture > Arana Utilities > magicc

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.

Synopsis

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.


Syntax of Magic Definition File

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).

Suffix

Time Unit

r

A game round. Typically one minute.

t

A game turn.  Typically ten minutes.

s

Seconds.

m

Minutes.

h

Hours.

d

Days. No limit.



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."

Commands

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.

Property

Description

level

The level of the person.  If a monster, then Hit Dice.

mu_level

The Magic-User ability level of the person.

fighter_level

The Fighter ability level of the person.

cleric_level

The Cleric ability level of the person.

thief_level

The Thief ability level of the person.

move_overland

The rate of speed for moving overland, e.g. 9 for 9".

move_fly

The rate of speed for flying through the air, e.g. 48 for 48".

move_swim

The rate of speed for moving through water, e.g. 48 for 48".

move_web

The rate of speed for moving across a web, e.g. 48 for 48".

move_earth

The rate of speed for moving through earth, e.g. 48 for 48".

move_climb

The rate of speed for climbing vertical surfaces, e.g. 48 for 48".

hp

Hit points.

max_hp

Maximum hit points.

AC

Armor class.

swings

Number of swings.

to_hit

Bonus (or penalty if negative) to hit when swinging at an opponent.

min_to_hit

Minimum "to hit" value that must be rolled to strike an opponent, reguardless of bonuses, strength, etc.

strength_bonus_to_hit

Bonus (or penalty if negative) to hit when swinging at an opponent due to strength.

damage

Bonus (or penalty if negative) to damage amount when successfully hitting an opponent due to strength.

intent

The intent of the person. This may be a number or keyword.

target

dunno

save.all

The value for all saving throws.

save.poison

The value for saving throws against poison.

save.paralyzation

The value for saving throws against paralyzation.

save.death_magic

The value for saving throws against death magic.

save.petrification

The value for saving throws against petrification.

save.polymorph

The value for saving throws against polymorph.

save.wand

The value for saving throws against wands.

save.rod

The value for saving throws against rods.

save.staff

The value for saving throws against staffs.

save.breath

The value for saving throws against dragon's breath.

save.spell

The value for saving throws against spells.

save.magic

The value for saving throws against magic.

save.damage_multiplier

When a saving throw fails and damage is dealt to person, that damage is first multiplied by this number (it may be a fraction) before being applied to person.

save.magic.fear

The value for saving throws against fear.

save.wand.cold

The value for saving throws against cold.

save.breath.cold

The value for saving throws against cold breath.

save.breath.fire

The value for saving throws against dragon's breath fire.

save.wand.fire

The value for saving throws against wand fire.

missile_rate

The number of missiles that can be fired in one round (may include fraction).

light

Radius of light around person.

strength

The strength ability score for the person.

strength_percent

If the strength is 18, the strength percentage above 28, from 01 to 100..

intelligence

The intelligence ability score for the person.

wisdom

The wisdom ability score for the person.

dexterity

The dexterity ability score for the person.

constitution

The constitution  ability score for the person.

charisma

The charisma ability score for the person.

age

The age of the person.

name

The name  of the person.

race

The race  of the person.

weightmax

The maximum weight that can be carried by the person, in pounds.

opendoors

The number to roll to open stuck doors by the person, from 0 to 6.

bblg

The bend bars/lift gates number to roll for the person, from 0 to 100.

magicaladj

The wisdom magical adjustment for the person, from 0 to 100.

reactionadj

The dexterity reaction adjustment for the person.

defensiveadj

The dexterity defensive adjustment for the person.

sss

The system shock survival for the person.

rs

The resurrection survivlal for the person.

hpadj

The constitution HP adjustment for the person.

maxhenchmen

The charisma maximum henchmen for the person.

loyaltybase

The charisma loyalty base for the person.

charismareaction

The charisma reaction for the person.

infravision

The distance of infravision in the dark for the person.

ultravision

The distance of ultravision in the dark for the person.

noticeSecretDoor

The chance to notice a secret door for the person, from 0 to 6 out of 6.

findSecretDoor

The chance to find a secret door for the person, from 0 to 6 out of 6.

charmResistance

The charm resistence for the person.


[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.


See Also

magic