Skip to content

Latest commit

 

History

History
49 lines (46 loc) · 11.9 KB

Plugin.md

File metadata and controls

49 lines (46 loc) · 11.9 KB

Plugin system document

Programming Language

  • The plugin system is designed to be written in lua language

User Types

name fields/methods description
Config show show in [ui] section of D2RMH.ini
scale scale in [ui] section of D2RMH.ini
Player act Current ACT (0=>ACT I, ... 4=>ACT V)
seed Map generation seed
difficulty Difficulty, 0=>Normal 1=>Nightmare 2=>Hell
map Current map level id
pos_x Position X
pos_y Position Y
name Player Name
stats Player Stats in array with subindex:
1 =>Strength
2 =>Energy
3 =>Dexterity
4 =>Vitality
5 =>Statpts
6 =>Newskills
7 =>Hitpoints
8 =>Maxhp
9 =>Mana
10 =>Maxmana
11 =>Stamina
12 =>Maxstamina
13 =>Level
14 =>Experience
15 =>Gold
16 =>Goldbank
Skill level Skill level
quantity Skill Quantity (Throw weapon/Scrolls/etc.)
TextList x Position X, should be in [0.0,1.0], the size rate relative to D2R window width
y Position Y, should be in [0.0,1.0], the size rate relative to D2R window height
align Text align: 0=>left 1=>center 2->right
valign Text verticle align: 0=>top 1=>bottom
add(str, duration, fontSize) add a string to TextList, duplicated strings will be merged.
duraion: in milliseconds
fontSize: 0 for default message font size, -1 for move string to end of text list
clear() clear whole TextList

Functions

name returns description
register_plugin(interval, func) Register a plugin, runs func in interval(in milliseconds)
register_plugin(hotkey, on, interval, func, toggle_func) Register a plugin, runs func in interval(in milliseconds)
Use hotkey to toggle
on is the default enabled status
toggle_func is called when toggle using hotkey
register_hotkey(hotkey, func) Register a hotkey. When the key is pressed, run func
kill_process() Kill D2R process
message_box(str,type) int Popup a message box, with str and type(check uType and return value on MSDN)
flush_overlay() Flush the drawing overlay
reload_config() Reload config file
get_config() Config Get current config
get_player() Player Get current player
get_skill(skill_id) Skill Find skill data
create_text_list(name) TextList Create a text list, or get existing one if there is already a text list with name=name
remove_text_list(name) Remove a text list
key_press(key) press a key
mouse_move(x, y) Move mouse cursor to (x, y) in D2R window
mouse_click(which) Mouse button click, which: (0=LeftButton 1=RightButton 2=MiddleButton
delay(ms) Delay for ms milliseconds