Code: Select all
> dump(vars)
"{\
}"
> dump(mapvars)
"{\
}"
Moderator: Moderators
Code: Select all
> dump(vars)
"{\
}"
> dump(mapvars)
"{\
}"
tnevolin wrote:Do I need to initialize (override) map event every time map is loaded or it could be done once at game initialization?
tnevolin wrote:Which event should I use to initialize map event: InternalBeforeLoadMap, BeforeLoadMap, BeforeLoadMapScripts, LoadMapScripts, LoadMap, AfterLoadMap?
tnevolin wrote:Do I need to explicitly remove event I am planning to override? Would assigning a function to it just override what was there before?
tnevolin wrote:Why these [vars,mapvars] tables are empty when I check them in console?
cthscr wrote:Neither of them. Put it directly in map script main body.
cthscr wrote:tnevolin wrote:Do I need to explicitly remove event I am planning to override? Would assigning a function to it just override what was there before?
Yes. No, it would call a function after an original event has been processed.
cthscr wrote:tnevolin wrote:Why these [vars,mapvars] tables are empty when I check them in console?
Because you haven't put anything into them? (default behavior)
Code: Select all
Game.MapEvtLines:RemoveEvent(60) -- remove original event
evt.map[60] = function()
local i
if evt.Cmp("MapVar0", 4) then
evt.StatusText(5) -- "Nothing here"
else
evt.Add("MapVar0", 1)
Code: Select all
Variables in vars table. They can be accessed from anywhere and are stored in savegames.
tnevolin wrote:Thank you for response.cthscr wrote:Neither of them. Put it directly in map script main body.
I don't understand what is map script main body? I have downloaded MME2.2 and Scripts\Maps directory is empty. Should I take one of the decompiled scripts *.lua and put it there? Should I put *.txt file there as well? Do I need to modify them both?
Or I should just create custom lua script where I programmatically delete and reassign the map event?
I guess one example would worth thousands of words if you have it somewhere on a net.
tnevolin wrote:cthscr wrote:tnevolin wrote:Do I need to explicitly remove event I am planning to override? Would assigning a function to it just override what was there before?
Yes. No, it would call a function after an original event has been processed.
I tried to remove event before reassigning the new function to it. This also deleted event hint. I would like to preserve it. Is there a way?
Code: Select all
Game.MapEvtLines:RemoveEvent(100)
evt.hint[100] = "hint" -- could be something like evt.str[10]
evt.map[100] = function()...
tnevolin wrote:cthscr wrote:tnevolin wrote:Why these [vars,mapvars] tables are empty when I check them in console?
Because you haven't put anything into them? (default behavior)
You mean these are user defined variables those will be stored in saves? So I can introduce any kind of variable and persist it through saves/reloads? How these examples [with MapVar0] in MME help work then???
tnevolin wrote:I didn't understand this sentence about vars variables type. Should I declare them somehow or just put as key values in this table?
tnevolin wrote:What is the purpose of evt.VarNum constant? Isn't it suppose to describe existing variables in this table? Are they used somewhere in original code? Can I use them too?
tnevolin wrote:So you are the author of Community merge. Cool work!
You mentioned base merge branch there but I could not locate it anywhere on the net or description for it. Is community branch a de-facto standard for most users now?
tnevolin wrote:Anybody knows the text color scheme? I figured out it is 2 byte value. However, I failed to understand how bits are mapped to RGB.
MM supports coloring. Just add StrColor(R,G,B) at the beginning and StrColor(0,0,0) at the end of the string. Note that the color has to be computed inside the game, as it is dependant on whether it's in 16 or 15 bits mode. StrColor function is here: https://github.com/GrayFace/MMExtension ... ctions.lua
Users browsing this forum: No registered users and 13 guests