Back

Daimonin Scripting Commands

There are three different types or groups of Daimonin Scripting Commands. They are:

Daimonin Functions, Map Methods & Object Methods

Click on one of the above topics to be taken to that subject.

Daimonin Functions: back to the top

LoadObject
------------------------------------------------------------
Daimonin.LoadObject(string)
Parameter types:
string string
Possible return types:
object
Status:
Untested

MatchString
------------------------------------------------------------
Daimonin.MatchString(firststr,secondstr)
Case insensitive string comparison. Returns 1 if the two
strings are the same, or 0 if they differ.
second string can contain regular expressions.
Parameter types:
string firststr
string secondstr
Possible return types:
integer
Status:
Stable

ReadyMap
------------------------------------------------------------
Daimonin.ReadyMap(name, unique)
Make sure the named map is loaded into memory. unique _must_ be
1 if the map is unique (f_unique = 1).
Default value for unique is 0
Parameter types:
string name
(optional) integer unique
Possible return types:
map
Status:
Stable
TODO:
Don't crash if unique is wrong

CheckMap
------------------------------------------------------------
Daimonin.CheckMap(arch, map_path, x, y)

Parameter types:
string arch
string map_path
integer x
integer y
Possible return types:
object
Status:
Unfinished!! Do Not Use!

FindPlayer
------------------------------------------------------------
Daimonin.FindPlayer(name)
Parameter types:
string name
Possible return types:
object
Status:
Tested

WhoAmI
------------------------------------------------------------
Daimonin.WhoAmI()
Get the owner of the active script (the object that has the
event handler)
Parameter types:
Possible return types:
object
Status:
Stable

WhoIsActivator
------------------------------------------------------------
Daimonin.WhoIsActivator()
Gets the object that activated the current event
Parameter types:
Possible return types:
object
Status:
Stable

WhoIsOther
------------------------------------------------------------
Daimonin.WhoIsOther()
Parameter types:
Possible return types:
object
Status:
Untested

WhatIsMessage
------------------------------------------------------------
Daimonin.WhatIsMessage()
Gets the actual message in SAY events.
Parameter types:
Possible return types:
string
Status:
Stable

GetOptions
-------------------------------------------------------------
Gets the script options (as passed in the event's slaying field)
Parameter types: None
Return types: String
Status: Stable

GetReturnValue
------------------------------------------------------------
Daimonin.GetReturnValue()
Parameter types:
Possible return types:
integer
Status:
Untested

SetReturnValue
------------------------------------------------------------
Daimonin.SetReturnValue(value)
Parameter types:
integer value
Possible return types:
None
Status:
Untested

GetSpellNr
------------------------------------------------------------
Daimonin.GetSpellNr(name)
Gets the number of the named spell. -1 if no such spell exists
Parameter types:
string name
Possible return types:
integer
Status:
Tested

GetSkillNr
------------------------------------------------------------
Daimonin.GetSkillNr(name)
Gets the number of the named skill. -1 if no such skill exists
Parameter types:
string name
Possible return types:
integer
Status:
Tested

RegisterCommand
------------------------------------------------------------
Daimonin.RegisterCommand(cmdname,scriptname,speed)
Parameter types:
string cmdname
string scriptname
integer speed
Possible return types:
None
Status:
Untested
pretty untested...

 

Map Methods back to the top

GetFirstObjectOnSquare
------------------------------------------------------------
map.GetFirstObjectOnSquare(x,y)
Gets the bottom object on the tile. Use obj.above to browse objects
Parameter types:
integer x
integer y
Possible return types:
object
Status:
Stable

MapTileAt
------------------------------------------------------------
map.MapTileAt(x,y)
Parameter types:
integer x
integer y
Possible return types:
map
Status:
untested
TODO:
do something about the new modified coordinates too?

PlaySound
------------------------------------------------------------
map.PlaySound(x, y, soundnumber, soundtype)
Parameter types:
integer x
integer y
integer soundnumber
integer soundtype
Possible return types:
None
Status:
Tested
TODO:
supply constants for the sounds

Message
------------------------------------------------------------
map.Message(message, color)
Writes a message to all players on a map
default color is NDI_BLUE|NDI_UNIQUE
Parameter types:
string message
(optional) integer color
Possible return types:
None
Status:
Tested
TODO:
Add constants for colors

CreateObject
------------------------------------------------------------
map.CreateObject(arch_name, x, y)

Parameter types:
string arch_name
integer x
integer y
Possible return types:
object
Status:
Untested

Object Methods back to the top

GetSkill
------------------------------------------------------------
object.GetSkill(type, id)
This function will fetch a skill or the exp of the skill
Parameter types:
integer skill
integer type
Possible return types:
integer
Status:
Stable

SetSkill
------------------------------------------------------------
object.SetSkill(skillid,value)
Sets object's experience in the skill skillid as close to value
as permitted. There is currently a limit of 1/4 of a level.
There's no limit on exp reduction
FIXME overall experience is not changed (should it be?)
Parameter types:
integer skillid
integer value
Possible return types:
None
Status:
Tested

ActivateRune
------------------------------------------------------------
object.ActivateRune(what)
Parameter types:
object what
Possible return types:
None
Status:
Untested

CheckTrigger
------------------------------------------------------------
object.CheckTrigger(what)
Parameter types:
object what
Possible return types:
None
Status:
Unfinished
MUST DO THE HOOK HERE !

GetGod
------------------------------------------------------------
object.GetGod()
Parameter types:
Possible return types:
string
Status:
Stable

SetGod
------------------------------------------------------------
object.SetGod(godname)
Parameter types:
string godname
Possible return types:
None
Status:
Unfinished!

TeleportTo
------------------------------------------------------------
object.TeleportTo(map, x, y, unique)
Teleports object to the given position of map.
Parameter types:
string map
integer x
integer y
(optional) integer unique
Possible return types:
None
Status:
Tested

InsertInside
------------------------------------------------------------
object.InsertInside(where)
Inserts object into where.
Parameter types:
object where
Possible return types:
None
Status:
Stable

Apply
------------------------------------------------------------
object.Apply(what, flags)
forces object to apply what.
flags should be a reasonable combination of the following:
Daimonin.APPLY_TOGGLE - normal apply (toggle)
Daimonin.APPLY_ALWAYS - always apply (never unapply)
Daimonin.UNAPPLY_ALWAYS - always unapply (never apply)
Daimonin.UNAPPLY_NOMERGE - don't merge unapplied items
Daimonin.UNAPPLY_IGNORE_CURSE - unapply cursed items
returns: 0 - object cannot apply objects of that type.
1 - object was applied, or not...
2 - object must be in inventory to be applied
Parameter types:
object what
integer flags
Possible return types:
integer
Status:
Tested

PickUp
------------------------------------------------------------
object.PickUp(what)
Parameter types:
object what
Possible return types:
None
Status:
Tested

Drop
------------------------------------------------------------
object.Drop(what)
Equivalent to the player command "drop" (name is an object name,
"all", "unpaid", "cursed", "unlocked" or a count + object name :
"<nnn> <object name>", or a base name, or a short name...)
Parameter types:
string what
Possible return types:
None
Status:
Tested

Take
------------------------------------------------------------
object.Take(name)
Parameter types:
string name
Possible return types:
None
Status:
Temporary disabled (see commands.c)

Communicate
------------------------------------------------------------
object.Communicate(message)
object says message to everybody on its map
but instead of CFSay it is parsed for other npc or magic mouth
Parameter types:
string message
Possible return types:
None
Status:
Stable

Say
------------------------------------------------------------
object.Say(message)
object says message to everybody on its map
Parameter types:
string message
Possible return types:
None
Status:
Stable

SayTo
------------------------------------------------------------
object.SayTo(target, message)
NPC talks only to player but map get a "xx talks to" msg too.
Parameter types:
object target
string message
Possible return types:
None
Status:
Stable

Write
------------------------------------------------------------
who.Write(message , color)
Writes a message to a specific player.
Parameter types:
string message
(optional) integer color
Possible return types:
None
Status:
Tested

SetGender
------------------------------------------------------------
object.SetGender(gender)
Changes the gender of object. gender_string should be one of
Daimonin.NEUTER, Daimonin.MALE, Daimonin.GENDER_FEMALE or
Daimonin.HERMAPHRODITE
Parameter types:
integer gender
Possible return types:
None
Status:
Stable

SetRank
------------------------------------------------------------
object.SetRank(rank_string)
Set the rank of an object to rank_string
Rank string 'Mr' is special for no rank
Parameter types:
string rank_string
Possible return types:
object
None
Status:
Stable

SetAlignment
------------------------------------------------------------
object.SetAlignment(alignment_string)
Parameter types:
string alignment_string
Possible return types:
object
None
Status:
Stable

GetAlignmentForce
------------------------------------------------------------
object.GetAlignmentForce()
This gets the alignment_force from a inventory (should be player?)
Parameter types:
Possible return types:
object
None
Status:
Stable

SetGuildForce
------------------------------------------------------------
object.SetGuildForce(rank_string)
Sets the current rank of object to rank_string. Returns
the guild_force object that was modified.
Parameter types:
string rank_string
Possible return types:
object
None
Warning:
This set only the title. The guild tag is in <slaying>
For test of a special guild, you must use GetGuild()
For settings inside a guild script, you can use this function
Because it returns the guild_force obj after setting the title
Status:
Stable

GetGuildForce
------------------------------------------------------------
object.GetGuildForce()
This gets the guild_force from a inventory (should be player?)
Parameter types:
Possible return types:
object
None
Status:
Stable

Fix
------------------------------------------------------------
object.Fix()
Recalculates a player's or monster's stats depending on
equipment, forces, skills etc.
Parameter types:
Possible return types:
None
Status:
Untested

Kill
------------------------------------------------------------
object.Kill(what, how)
Parameter types:
object what
integer how
Possible return types:
None
Status:
Untested
add hooks before use!

CastAbility
------------------------------------------------------------
caster.CastAbility(target,spellno,mode,direction,option)
caster casts the ability numbered spellno on target.
mode = Daimonin.CAST_NORMAL or Daimonin.CAST_POTION
direction is the direction to cast the ability in
option is additional string option(s)
FIXME: only allows for directional abilities?
Abilities are can be cast in magic-blocking areas, and do not
use magic attack.
Parameter types:
object target
integer spellno
integer mode
integer direction
string option
Possible return types:
None
Status:
Stable

CastSpell
------------------------------------------------------------
caster.CastSpell(target,spell,mode,direction,option)
caster casts the spell numbered spellno on target.
mode = Daimonin.CAST_NORMAL or Daimonin.CAST_POTION
direction is the direction to cast the spell in
option is additional string option(s)
NPCs can cast spells even in no-spell areas.
FIXME: only allows for directional spells
FIXME: is direction/position relative to target? (0 = self)
Parameter types:
object target
integer spell
integer mode
integer direction
string option
Possible return types:
None
Status:
Untested

DoKnowSpell
------------------------------------------------------------
object.DoKnowSpell(spell)
1 if the spell is known by object, 0 if it isn't
Parameter types:
integer spell
Possible return types:
integer
Status:
Tested

AcquireSpell
------------------------------------------------------------
object.AcquireSpell(spell, mode)
object will learn or unlearn spell.
mode: Daimonin.LEARN or Daimonin.UNLEARN
Parameter types:
integer spell
integer mode
Possible return types:
None
Status:
Tested

DoKnowSkill
------------------------------------------------------------
object.DoKnowSkill(skill)
1 if the skill is known by object, 0 if it isn't
Parameter types:
integer skill
Possible return types:
integer
Status:
Tested

AcquireSkill
------------------------------------------------------------
object.AcquireSkill(skillno, mode)
object will learn or unlearn skill.
mode: Daimonin.LEARN or Daimonin.UNLEARN
Get skill number with Daimonin.GetSkillNr()
Parameter types:
integer skillno
integer mode
Possible return types:
None
Status:
Tested

FindMarkedObject
------------------------------------------------------------
object.FindMarkedObject()
Returns the marked object in object's inventory, or None if no
object is marked.
Parameter types:
Possible return types:
object
Status:
Stable

CheckInvisibleInside
------------------------------------------------------------
object.CheckInvisibleInside(id)
Parameter types:
string id
Possible return types:
object
Status:
Untested

CreatePlayerForce
------------------------------------------------------------
object.CreatePlayerForce(force_name, time)
Creates and inserts a player force named force_name in object.
The values of a player force will effect the player.
If time is given and > 0, the force will be removed again after
time/0.02 ticks.
Parameter types:
string force_name
(optional) integer time
Possible return types:
object
Status:
Stable.

CreatePlayerInfo
------------------------------------------------------------
object.CreatePlayerInfo(name)
Creates a player_info object of specified name in object's
inventory
The Values of a player_info object will NOT effect the player.
Returns the created object
Parameter types:
string name
Possible return types:
object
Status:
Stable

GetPlayerInfo
------------------------------------------------------------
object.GetPlayerInfo(name)
get first player_info with the specified name in who's inventory
Parameter types:
string name
Possible return types:
object
None
Status:
Stable

GetNextPlayerInfo
------------------------------------------------------------
object.GetNextPlayerInfo(player_info)
get next player_info in who's inventory with same name as
player_info
Parameter types:
object player_info
Possible return types:
object
None
Status:
Stable

CreateInvisibleInside
------------------------------------------------------------
object.CreateInvisibleInside(id)
Parameter types:
string id
Possible return types:
object
Status:
Untested

CreateObjectInside
------------------------------------------------------------
object.CreateObjectInside(archetype_name, identified, value)
Creates an object from archetype_name and inserts into object.
identified is either Daimonin.IDENTIFIED or Daimonin.UNIDENTIFIED
If value is >= 0 it will be used as the new object's value,
otherwise the value will be taken from the arch.
Parameter types:
string archetype_name
integer identified
integer value
Possible return types:
object
Status:
Stable
i must change this a bit - only REAL arch names - not object names

CheckArchInventory
------------------------------------------------------------
object.CheckArchInventory(arch_name)
Search for an arch_name in object's inventory
Parameter types:
string arch_name
Possible return types:
object
None
Status:
Stable

CheckInventory
------------------------------------------------------------
object.CheckInventory(name)
returns the first found object with the specified name if found
in object's inventory, or None if it wasn't found.
Parameter types:
string name
Possible return types:
object
None
Status:
Tested

SetSaveBed
------------------------------------------------------------
object.SetSaveBed(map, x, y)
Sets the current savebed position for object to the specified
coordinates on the map.
Parameter types:
map map
integer x
integer y
Possible return types:
None
Status:
Stable

Remove
------------------------------------------------------------
object.Remove()
Permanently removes object from the game.
Parameter types:
Possible return types:
None
Status:
Tested
Gecko : This function is DANGEROUS. Added limitations on what can be
removed to avoid some of the problems
hm, this should be named delete or free object...

SetPosition
------------------------------------------------------------
object.SetPosition(x, y)
Cannot be used to move objects out of containers. (Use Drop() or
TeleportTo() for that)
Parameter types:
integer x
integer y
Possible return types:
None
Status:
Tested

IdentifyItem
------------------------------------------------------------
caster.IdentifyItem(target, marked, mode)
caster identifies object(s) in target's inventory.
mode: Daimonin.IDENTIFY_NORMAL, Daimonin.IDENTIFY_ALL or
Daimonin.IDENTIFY_MARKED
marked must be None for IDENTIFY_NORMAL and IDENTIFY_ALL
Parameter types:
object target
special marked
integer mode
Possible return types:
None
Status:
Tested

IsOfType
------------------------------------------------------------
object.IsOfType(type)
returns 1 if object is of the specified type, or 0 otherwise.
(e.g. Daimonin.TYPE_MONSTER for monster/NPC, or
Daimonin.TYPE_PLAYER for players)
Parameter types:
integer type
Possible return types:
integer
Status:
Tested

Save
------------------------------------------------------------
object.Save()
Parameter types:
Possible return types:
string
Status:
Untested

GetIP
------------------------------------------------------------
object.GetIP()
Parameter types:
Possible return types:
string
None
Status:
Tested

GetArchName
------------------------------------------------------------
object.GetArchName()

Parameter types:
Possible return types:
string
Status:
Tested

GetItemCost
------------------------------------------------------------
buyer.GetItemCost(object,type)
type is one of Daimonin.COST_TRUE, COST_BUY or COST_SELL
Parameter types:
object object
integer type
Possible return types:
integer
Status:
Untested

GetMoney
------------------------------------------------------------
buyer.GetMoney()
Parameter types:
Possible return types:
integer
Status:
Untested

PayForItem
------------------------------------------------------------
buyer.PayForItem(object)
Parameter types:
object object
Possible return types:
integer
Status:
Untested

PayAmount
------------------------------------------------------------
buyer.PayAmount(value)
If buyer has enough money, value copper will be deducted from
buyer, and 1 will be returned. Otherwise returns 0
Parameter types:
integer value
Possible return types:
integer
Status:
Stable

SendCustomCommand
------------------------------------------------------------
object.SendCustomCommand(custom_command)
Parameter types:
string custom_command
Possible return types:
None
Status:
Untested

Clone
------------------------------------------------------------
object.Clone(mode)
mode = Daimonin.CLONE_WITH_INVENTORY (default) or
Daimonin.CLONE_WITHOUT_INVENTORY
You _MUST_ do something with the clone (TeleportTo() or
InsertInside() are useful functions for this)
Parameter types:
(optional) integer mode
Possible return types:
object
Status:
Tested

GetUnmodifiedAttribute
------------------------------------------------------------
object.GetUnmodifiedAttribute(attribute_id)
Parameter types:
integer attribute_id
Possible return types:
Status:
UNFINISHED <- fields not available...