ModDotaLib
A Flash library for Dota 2 custom gamemodes
Install / Use
/learn @ModDota/ModDotaLibREADME
ModDotaLib
A Flash library for Dota 2 custom gamemodes
LocalStorage
A Flash, Lua and optionally Panorama Library to give gamemodes the ability to have Local Storage in a flat Key Value system, much like Cookies found in Web Browsers.
Installation
-
Drag and drop the
assets/resource/flash3/folder to yourgame/resource/folder (if it exists) and you might need to merge with any existingcustom_ui.txt. -
Drag and drop the
assets/scripts/custom_events.txttogame/scripts/and merge if it already exists. -
Drag and drop the
assets/scripts/vscripts/ModDotaLib/folder togame/scripts/vscripts/ -
in
addon_game_mode.luaaddlocal storage = require("ModDotaLib.LocalStorage"), and anywhere else in server-side Lua that wants access to client key/values. -
Create the folder
toolsinscripts/for this to work in tools mode. This is to protect you from accidently shipping data to the end user via a VPK, which will override any read you attempt to do. -
(Optional) Drag and drop the
assets/panorama/scripts/ModDotafolder tocontent/panorama/scripts/ -
(Optional) Merge
assets/panorama/layout/custom_game/custom_ui_manifest.xmlwith your existingcustom_ui_manifest.xml(adding our JS to your scripts tag BEFORE any of your existing code that relies on LocalStorage)
Examples
Lua Example is available at addon_game_mode.lua
- Using this example, you gain a command called
storage_test key value. If value isn't specified, assumes a Get request rather than a set. - Writes to
testing.kv
Panorama Example is available at example.js
- Using this example, you gain a command called
storage_testpanorama key value. If value isn't specified, assumes a Get request rather than a set. - Writes to
testing2.kv
API
Lua
local storage = require("ModDotaLib.LocalStorage")
-- playerID: number, fileName: string, key: string, value: string, callback: function
function getCallback(sequenceNumber, success, value)
--success of 0 means it worked, and value will exist as a variable, otherwise value is nil.
end
local sequenceNumber = storage:getKey(playerID, fileName, key, getCallback)
function setCallback(sequenceNumber, success)
--success of 0 means it worked.
end
local sequenceNumber = storage:getKey(playerID, fileName, key, value, setCallback)
Panorama
//success of 0 means it worked.
function SetCallback(sequenceNumber, success) {};
var sequenceNumber = GameEvents.SetKey(filename, key, value, SetCallback);
//success of 0 means it worked, and value will be defined, otherwise value is undefined.
function GetCallback(sequenceNumber, success, value) {};
var sequenceNumber = GameEvents.GetKey(filename, key, GetCallback);
Related Skills
node-connect
340.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
84.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
340.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
84.2kCommit, push, and open a PR
