RuneScript

From Old School RuneScape Wiki
Jump to: navigation, search

RuneScript is a scripting language that Jagex uses to create content for RuneScape. The game engine is not written in RuneScript, but instead Java. RuneScript was developed by Jagex Ltd. to allow their other staff that do not know Java to add and edit content for the game. The game engine reads RuneScript files and executes them accordingly. This is the structure most larger programs (such as other video games) follow.

Hmm, syntax wise it's similar to any C-style language, except variable names are prefixed with their type (eg. %varname is an integer). We also lack full array support. Other than that, it'd do pretty much anything you could do in C or Java.
 
Mod Chris E Game Engine Q&A[1]

The minor updates are usually for introducing a new map and adding new NPCs, and for these updates, a RuneScript file is added into the program. The major updates are for the source code, which is usually for making large changes such as introducing new areas in RuneScape, new skills, or for bug fixes.

Examples[edit | edit source]

Special Commands
Syntax Meaning
gosub(npc_death) Called when npc dies
npc_coord Current npc's location
find_uid(id) Returns true if finds uid
map_members 1 if member's world
General Subroutines
Name Meaning
add(a,b,c)
jump(x) Goto
random(i) Generate a random number from 0 to (i-1)
Droptable-related Commands
Name Meaning
npc_findhero Returns 1 if finds killing player
~loot_choosehero Returns UID of killing player
npc_param(death_drop) Returns npc's 100% drop item
obj_add(coordinates,item_name,quantity,ticks_before_despawning) Generate an item dropped as loot
~lootdrop(coordinates,item_name,quantity,ticks_before_despawning) Generate an item dropped as loot
~lootdrop_deathdrop(coordinates,item_name) Generates a 100% drop from a monster
~lootdrop_forbroadcast(item_name,coordinates,Bool(?),broadcast_map_chunk,Int,Int) Generate a drop broadcast at the same time as dropping loot (for boss monsters)
gosub(ultrarare) Possibly the rare drop table subroutine
gosub(kill4jewel) Possibly the gem drop table subroutine
~randomjewel Returns an item name
~randomherb Returns an item name
~dagannoth_droptalisman Returns an item name
~trail_hardcluedrop(denominator,coordinates) Checks and rolls a chance to drop a Clue scroll (hard) if appropriate
~trail_gethardclue If player is able to get a Clue scroll (hard), ?sets %namedobj to Clue scroll (hard), or else sets %namedobj to null
~trail_checkmediumdrop

References[edit | edit source]

  1. Mod Chris E. "Game Engine Answers!." 13 April 2012. RuneScape Forums.