Scripting

From 4Dimensions
Revision as of 15:45, 3 February 2017 by Rynald (talk | contribs)

Jump to: navigation, search

There's a good scripting reference at TBA, but there are differences with 4D's scripting commands. These pages aim to give an overview of these commands. One notable difference is crafting, for which several new commands and fields have been added.

To give an example of the terms used in these pages, consider this line:

   nop %actor.exp(1000)%

Here nop is the command, actor is the variable, exp is the field and 1000 is the subfield.

In scripts, a uid is the character '}' followed by a number. The number is the id of a mob, player, object or room. A uid is used to manipulate what it points to, from any script.

To make it easier to debug scripts, a scripting debugger is available. It can set breakpoints, view or change variables, step through a trigger, and show the result of any scripting expression.

All commands, fields and variables are grouped alphabetically:

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z


A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z


The aff_ fields are used to get or change the stats of an object.

aff_ac

   %object.aff_ac%

Returns the AC an object gives.

   nop %object.aff_ac(-5)%

Sets the AC of an object to -5.


aff_age

   %object.aff_age%

Returns the age an object gives.

   nop %object.aff_age(125)%

Sets the age of an object to 125.


aff_breath_def

   %object.aff_breath_def%

Returns the breath defense an object gives.

   nop %object.aff_breath_def(50)%

Sets the breath defense of an object to 50.


aff_cha

   %object.aff_cha%

Returns the charisma an object gives.

   nop %object.aff_cha(2)%

Sets the charisma of an object to 2.


aff_con

   %object.aff_con%

Returns the constitution an object gives.

   nop %object.aff_con(-3)%

Sets the constitution of an object to -3.


aff_coolness

   %object.aff_coolness%

Returns the coolness an object gives.

   nop %object.aff_coolness(5)%

Sets the coolness of an object to 5.


aff_damroll

   %object.aff_damroll%

Returns the damroll an object gives.

   nop %object.aff_damroll(3)%

Sets the damroll of an object to 3.


aff_dex

   %object.aff_dex%

Returns the dexterity an object gives.

   nop %object.aff_dex(1)%

Sets the dexterity of an object to 1.


aff_hitroll

   %object.aff_hitroll%

Returns the hitroll an object gives.

   nop %object.aff_hitroll(2)%

Sets the hitroll of an object to 2.


aff_int

   %object.aff_int%

Returns the intelligence an object gives.

   nop %object.aff_int(3)%

Sets the intelligence of an object to 3.


aff_maxhit

   %object.aff_maxhit%

Returns the maximum hitpoints an object gives.

   nop %object.aff_maxhit(700)%

Sets the maximum hitpoints of an object to 700.


aff_maxmana

   %object.aff_mana%

Returns the maximum mana an object gives.

   nop %object.aff_maxmana(2000)%

Sets the maximum mana of an object to 2000.


aff_maxmove

   %object.aff_maxmove%

Returns the maximum moves an object gives.

   nop %object.aff_maxmove(500)%

Sets the maximum moves of an object to 500.


aff_mine_bonus

   %object.aff_mine_bonus%

Returns the mine bonus an object gives.

   nop %object.aff_mine_bonus(10)%

Sets the mine bonus of an object to 10.


aff_mine_protection

   %object.aff_mine_protection%

Returns the mine protection an object gives.

   nop %object.aff_mine_protection(25)%

Sets the mine protection of an object to 25.


aff_mine_speed

   %object.aff_mine_speed%

Returns the mine speed an object gives.

   nop %object.aff_mine_speed(30)%

Sets the mine speed of an object to 30.


aff_mine_stealth

   %object.aff_mine_stealth%

Returns the mine stealth an object gives.

   nop %object.aff_mine_stealth(10)%

Sets the mine stealth of an object to 10.


aff_paralyze_def

   %object.aff_paralyze_def%

Returns the paralyze defense an object gives.

   nop %object.aff_paralyze_def(5)%

Sets the paralyze defense of an object to 5.


aff_petrify_def

   %object.aff_petrify_def%

Returns the petrify defense an object gives.

   nop %object.aff_petrify_def(3)%

Sets the petrify defense of an object to 3.


aff_rod_def

   %object.aff_rod_def%

Returns the rod defense an object gives.

   nop %object.aff_rod_def(-2)%

Sets the rod defense of an object to -2.


aff_regen_hit

   %object.aff_regen_hit%

Returns the hitpoint regeneration an object gives.

   nop %object.aff_regen_hit(10)%

Sets the hitpoint regeneration of an object to 10.


aff_regen_mana

   %object.aff_regen_mana%

Returns the mana regeneration an object gives.

   nop %object.aff_regen_mana(5)%

Sets the mana regeneration of an object to 5.


aff_regen_move

   %object.aff_regen_move%

Returns the move regeneration an object gives.

   nop %object.aff_regen_move(10)%

Sets the move regeneration of an object to 10.


aff_speed

   %object.aff_speed%

Returns the speed an object gives.

   nop %object.aff_speed(50)%

Sets the speed of an object to 50.


aff_spell_def

   %object.aff_spell_def%

Returns the spell defense an object gives.

   nop %object.aff_spell_def(10)%

Sets the spell defense of an object to 10.


aff_str

   %object.aff_str%

Returns the strength an object gives.

   nop %object.aff_str(2)%

Sets the strength of an object to 2.


aff_wis

   %object.aff_wis%

Returns the wisdom an object gives.

   nop %object.aff_wis(-1)%

Sets the wisdom of an object to -1.


assemble

   nop %actor.assemble(123)%

If the inventory of actor holds the ingredients of the assembly, then they are replaced by object 123.


assemblycheck

   %actor.assemblycheck(123)%

Returns 1 if actor has the ingredients to assemble object 123.


body

   %actor.body%

Returns all extra body positions.

   nop %player.body(crest)%

Toggles the extra body position crest.


bodycheck

   %player.bodycheck(wield)

Returns 1 if player has the body position wield.

   %player.bodycheck(crest)

Returns 1 if player has the extra body position crest (mobs have all body positions).