Page 6 of 10
Posted: 31 Jan 2015, 22:46
by Void
Is There A Way To Make A bully Jump Like A Koopa Para-troopa And Chase You At The Same time Like In Super Mario World With Bowser's Clown Car? if there Is, I Need A Code for Something like That. Like For Example...
If A Bully Was On The Ground, It Would Jump Up At A Y Speed Of A Koopa Para-troopa, Then Fall The Same Way As A koopa Paratroopa At A Y Speed, Then It Would Do The Same Thing Over And over, But It Would Chase You At An X Speed. I Hope that Helps.
Posted: 1 Feb 2015, 11:51
by Kevsoft
Sambo wrote:Kevsoft wrote:You should be able to access variables from lunadll.lua in lunaworld.lua and the other way round.
I tried to access functions from lunaworld.lua in lunadll.lua and got "attempt to call a nil value." Functions are a type of variable, right?
Strange... I will try later, in the meanwhile try this:
Code: Select all
_G["yourfunctionname"] = function() {
... --here your code
}
and call it with
Maybe this works
Added after 11 minutes 24 seconds:beanluv wrote:Is There A Way To Make A bully Jump Like A Koopa Para-troopa And Chase You At The Same time Like In Super Mario World With Bowser's Clown Car? if there Is, I Need A Code for Something like That.
Hopefully this helps.
Posted: 5 Feb 2015, 12:57
by Kevsoft
LunaLua 0.5.2.1 is out with just a mainV2.lua fix. No binary update!
Posted: 13 Feb 2015, 23:03
by Veudekato
how to make this with wind.lua :in first section,speed of wind is slow,in 2nd more,in 3rd fast
Posted: 13 Feb 2015, 23:08
by Kevsoft
Veudekato wrote:how to make this with wind.lua :in first section,speed of wind is slow,in 2nd more,in 3rd fast
Replace onLoop with onLoopSection1 and modify the attributes
you can then copy the code for onLoopSectoin2, onLoopSection3.... ect
LunaLua version 0.5.3.1 is out!
Changes:
* Added function getLevelName()
* Added function getLevelFilename()
* Added class Level (for overworld code)
Documentation will be updated soon!
Posted: 23 Feb 2015, 19:26
by Kevsoft
LunaLua v0.5.3.2 has been released
Changes:
- Spoiler
- * Added npc.isValid()
* Added exceptions for npcs and players if the index is invalid for better coding experience.
Posted: 24 Feb 2015, 18:55
by Kevsoft
Okay guys, the SUPER AMAZING SUPER-PATCH 0.5.4 IS OUT
(just fixing my stupid memory-leak >.>)... while fixing the memory-leak I also did:
- Spoiler
- * Added a constructor for VBStr with a string pointer (not a memory address, use mem with FIELD_STRING for memory address)!
** Added FIELD_STRING for the mem-functions! Usage:
Code: Select all
function onLoop()
printText(mem(0x00B2D764, FIELD_STRING).str, 20, 300) --Prints out the level name
end
..or if you want to save up the pointer:
Code: Select all
function onLoop()
local theLevelNameStrPointer = mem(0x00B2D764, FIELD_STRING)
end
* Added all other lua-libraries including cinematX.lua, raocoin.lua, triggers.lua, musix.lua, multipoints.lua.
Posted: 2 Mar 2015, 23:18
by Kevsoft
Oh man: Huge update!
Before all the changes to lunalua: This dll is compiled with VS 2013 (+Windows XP Support). If you use an old OS you probably need the
Visual C++ Redistributable Packages for Visual Studio 2013.
(I will link on the main Page).
Anyway with the LunaLua v0.6 release, there are following changes:
- Spoiler
- * Added a bunch of lua libraries
* Added a new event called "onTriggerEvent(eventObj, eventName)", which triggers if a SMBX Event is called.
* Added a new class called "Event" [used in onTriggerEvent(eventObj,...)] which provides fields like "eventObj.cancled = true".
Raw Event-Class Overview Code:
Code: Select all
class_<Event>("Event")
.property("eventName", &Event::eventName)
.property("cancleable", &Event::isCancleable)
.property("cancled", &Event::cancled, &Event::setCancled)
* Added a new class called "Data". This can be constructed and should be used as a new version of "userData" with lots of improvements.
Raw Data-Class Overview Code:
Code: Select all
class_<LuaProxy::Data>("Data")
.enum_("DataTypes")
[
value("DATA_LEVEL", LuaProxy::Data::DATA_LEVEL),
value("DATA_WORLD", LuaProxy::Data::DATA_WORLD),
value("DATA_GLOBAL", LuaProxy::Data::DATA_GLOBAL)
]
.def(constructor<LuaProxy::Data::DataType>())
.def(constructor<LuaProxy::Data::DataType, std::string>())
.def(constructor<LuaProxy::Data::DataType, bool>())
.def(constructor<LuaProxy::Data::DataType, std::string, bool>())
.def("set", &LuaProxy::Data::set)
.def("get", static_cast<std::string(LuaProxy::Data::*)(std::string)>(&LuaProxy::Data::get))
.def("get", static_cast<luabind::object(LuaProxy::Data::*)(lua_State*)>(&LuaProxy::Data::get))
.def("save", static_cast<void(LuaProxy::Data::*)()>(&LuaProxy::Data::save))
.def("save", static_cast<void(LuaProxy::Data::*)(std::string)>(&LuaProxy::Data::save))
.property("dataType", &LuaProxy::Data::dataType, &LuaProxy::Data::setDataType)
.property("sectionName", &LuaProxy::Data::sectionName, &LuaProxy::Data::setSectionName)
.property("useSaveSlot", &LuaProxy::Data::useSaveSlot, &LuaProxy::Data::setUseSaveSlot)
Because I am already pretty tired I will write the doc later. But I provided the "Raw ... Overview Code", some of you might understand it.
Here is a example code for the new Data-Class:
Code: Select all
local myDataFile = nil;
function onLoad()
--Use Data.DATA_LEVEL for saving in the custom level folder
--Use Data.DATA_WORLD for saving in the episode folder
--Use Data.DATA_GLOBAL for saving in the smbx/worlds folder
--The last parameter is true or false, if the data should be save-slot-local.
myDataFile = Data(Data.DATA_LEVEL, "mySection", false)
end
function onLoop()
local stars = myDataFile:get("myStarCounter")
if(stars == "")then
stars = 0
else
stars = tonumber(stars)
end
stars = stars + 1
myDataFile:set("myStarCounter", tostring(stars))
myDataFile:save()
printText("Counter: "..stars, 30, 100)
end
Posted: 6 Mar 2015, 8:54
by lighthouse64
Ok, this is probably the stupidest question, but which link is the lua 0.6 on the main post?
Posted: 6 Mar 2015, 19:24
by Kevsoft
"Download SDL Version" is the main dll.
The other files are just support files.
Posted: 6 Mar 2015, 21:54
by lighthouse64
Kevsoft wrote:"Download SDL Version" is the main dll.
The other files are just support files.
That's where Lunalua 0.6 is? THX

Posted: 7 Mar 2015, 16:55
by Kevsoft
Updated to LunaLua v0.6.0.3 fixing a serious issue.
Events should now work again properly without problems!
Posted: 8 Mar 2015, 8:32
by Something Fawful
Okay... so first of all this thing is fantastic.
Second of all is there a place to report bugs if I find them? I was going to report one but you've already fixed it sooo....
Posted: 8 Mar 2015, 9:51
by Kevsoft
Something Fawful wrote:Okay... so first of all this thing is fantastic.
Thank you!
Something Fawful wrote:Second of all is there a place to report bugs if I find them? I was going to report one but you've already fixed it sooo....
Feel free to post bugs in this thread or open a new thread.
Posted: 10 Mar 2015, 6:06
by Sambo
Kevsoft wrote:Because I am already pretty tired I will write the doc later. But I provided the "Raw ... Overview Code", some of you might understand it.
Here is a example code for the new Data-Class:
Code: Select all
local myDataFile = nil;
function onLoad()
--Use Data.DATA_LEVEL for saving in the custom level folder
--Use Data.DATA_WORLD for saving in the episode folder
--Use Data.DATA_GLOBAL for saving in the smbx/worlds folder
--The last parameter is true or false, if the data should be save-slot-local.
myDataFile = Data(Data.DATA_LEVEL, "mySection", false)
end
function onLoop()
local stars = myDataFile:get("myStarCounter")
if(stars == "")then
stars = 0
else
stars = tonumber(stars)
end
stars = stars + 1
myDataFile:set("myStarCounter", tostring(stars))
myDataFile:save()
printText("Counter: "..stars, 30, 100)
end
What is the "section" parameter for? I think I get what everything else does.
I don't see why the variables can only be set as strings, though. Couldn't you make it possible to use strings or numbers without the need for concatenation?
(LUA works that way normally anyway, right?)
---------------------------------------------------------------------
Yay! 100th post!

Posted: 10 Mar 2015, 15:09
by Kevsoft
Section is the same as a new "file". If you don't specify the section name, you will get the default name.
The change for strings is just better to use. You can save the data way better in a string format.
Posted: 14 Mar 2015, 9:24
by Sambo
The onEvent function isn't working. I get " <name> or "..." expected near ' "exit left" ' (from the top line) when I use this code:
Code: Select all
function onEvent("exit left")
if level_cleared == 0 then
_G["saveData"]:set("DCoins", DCoins.. "")
saveData:save()
level_cleared = 1
end
end
Posted: 14 Mar 2015, 22:12
by Kevsoft
The same error, a lot of other people had.
instead of
Sambo wrote:Code: Select all
function onEvent("exit left")
if level_cleared == 0 then
_G["saveData"]:set("DCoins", DCoins.. "")
saveData:save()
level_cleared = 1
end
end
you do:
Code: Select all
function onEvent(eventName)
if eventName == "eventName" then
if level_cleared == 0 then
_G["saveData"]:set("DCoins", DCoins.. "")
saveData:save()
level_cleared = 1
end
end
end
Events are just functions with parameter, you cannot put a raw string as a parameter.
Posted: 19 Mar 2015, 19:40
by Kevsoft
LunaLua v0.6.1 is out with following changes:
- Spoiler
- * Resturctured Audio Module [Tutorial]
* New Defines Module
* Added function spawnEffect (replaces runAnimation)
* Added new fields towards the Animation Class
* Added some new function signature overloads for spawnNPC
* Optimzed the VBStr fields, they can now be assigned directly to a string.
Posted: 20 Mar 2015, 18:50
by Kevsoft
A LunaLua Hotfix (v0.6.1.1) is out which fixes NPC.direction.