Code: Select all
> dump(vars)
"{\
}"
> dump(mapvars)
"{\
}"
Code: Select all
> dump(vars)
"{\
}"
> dump(mapvars)
"{\
}"
Former. You Scripts/Maps/*.lua (and map events lines) will be reloaded every time the map is reloaded.tnevolin wrote:Do I need to initialize (override) map event every time map is loaded or it could be done once at game initialization?
Neither of them. Put it directly in map script main body.tnevolin wrote:Which event should I use to initialize map event: InternalBeforeLoadMap, BeforeLoadMap, BeforeLoadMapScripts, LoadMapScripts, LoadMap, AfterLoadMap?
Yes. No, it would call a function after an original event has been processed.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?
Because you haven't put anything into them? (default behavior)tnevolin wrote:Why these [vars,mapvars] tables are empty when I check them in console?
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?cthscr wrote: Neither of them. Put it directly in map script main body.
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?cthscr wrote:Yes. No, it would call a function after an original event has been processed.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?
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 in MME help work then???cthscr wrote:Because you haven't put anything into them? (default behavior)tnevolin wrote:Why these [vars,mapvars] tables are empty when I check them in console?
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.
First link in my signature contains probably the biggest example of MMExtension usage.tnevolin wrote:Thank you for response.
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?cthscr wrote:Neither of them. Put it directly in map script main body.
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: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?cthscr wrote:Yes. No, it would call a function after an original event has been processed.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?
Code: Select all
Game.MapEvtLines:RemoveEvent(100)
evt.hint[100] = "hint" -- could be something like evt.str[10]
evt.map[100] = function()...
Yes, they are user defined lua variables. MapVar0 is from Map.Vars array (from MM6 itself) rather than mapvars table (from MMExtension).tnevolin wrote: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???cthscr wrote:Because you haven't put anything into them? (default behavior)tnevolin wrote:Why these [vars,mapvars] tables are empty when I check them in console?
vars is typical lua table. So it has typical lua key-value elements which are again typical lua variables. vars is already defined in started game (it's not defined yet in, for example, party creation). So you can put something like `vars.mytable1 = {}` or `vars.newvar75 = 12` wherever you want.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?
MM6/7/8 have map (and global) events coded in *.evt files. Evt file contains encoded events in binary format. Evt commands (like evt.Cmp) have their number/id. Parameters of evt commands like evt.Cmp, evt.Add, evt.Set, evt.Subtract (like "ClassIs" etc.) also have their number/id. IIRC VarNum is for these parameters. You can use number instead of string parameter name in evt command (I used it for parameter that was decoded to `nil` by MMExtension)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?
I'd say I'm main code contributor now.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?
GrayFace has written once: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
For what purposes do you need text input? One-line input in the game can be used via Question function, other than that you can use debug console pop ups for text input - check scripts inside "Scripts\Global" folder, i don't know how exactly to do it.CATMAN wrote:... did not find the text input functionality inside the game ...
...an example of the level Hello world? I don’t understand how to write this into the script. May be needed for gameplay...Rodril wrote:For what purposes do you need text input? One-line input in the game can be used via Question function, other than that you can use debug console pop ups for text input - check scripts inside "Scripts\Global" folder, i don't know how exactly to do it.CATMAN wrote:... did not find the text input functionality inside the game ...
Code: Select all
function OnMapStart()
text = InputBox("CATMAN", 5, 1);
end
Code: Select all
gamername = Question("What is the gamer's name?", "Who are You?");
Message("Hello" gamername "!")
...Scripts\Maps\catman.oute3.lua:2: ')' expected near 'gamername'
Users browsing this forum: No registered users and 8 guests