LunaLua Offical Thread - SMBX Usermod Framework

This is the place for discussion and support for LunaLua and related modifications and libraries.
Forum rules
Before you make a topic/post, consider the following:
-Is there a topic for this already?
-Is your post on topic/appropriate?
-Are you posting in the right forum/following the forum rules?

Shall I steam some LunaLua live development?

Yes
191
92%
No
17
8%
 
Total votes: 208
User avatar
Hoeloe
Nipper Plant
Nipper Plant
Posts: 766
Joined: Sat Oct 03, 2015 6:18 pm
Current Project: A2XT Episode 2

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Hoeloe » Fri Jan 06, 2017 4:10 pm

MosaicMario wrote: Actually, i think i was just doing something wrong, it's working correctly now. but i want to know how to do this with regular coins
and for the value to be carried over to other stages.
If you read the wiki page just one line further, the code to do it for regular coins is literally right there.

As for getting it to save between levels, you need to use either the onExitLevel event or the coins:onCollect event. These will allow you to save the currency value either when you exit the level, or when you collect a coin.

User avatar
Mosaic
Ludwig von Koopa
Ludwig von Koopa
Posts: 2774
Joined: Fri Feb 27, 2015 8:07 pm
Current Project: The Mosaic Group's Journey and Toad's SMB Adventure, Also, The Enemy's Boss Rush(yeah sure)
Location: California
Chat Username: Mosaic
Contact:

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Mosaic » Fri Jan 06, 2017 4:20 pm

Hoeloe wrote:
MosaicMario wrote: Actually, i think i was just doing something wrong, it's working correctly now. but i want to know how to do this with regular coins
and for the value to be carried over to other stages.
If you read the wiki page just one line further, the code to do it for regular coins is literally right there.

As for getting it to save between levels, you need to use either the onExitLevel event or the coins:onCollect event. These will allow you to save the currency value either when you exit the level, or when you collect a coin.
The Counter is there, but it won't go past 100 and resets whenever it reaches 100. How do i make it go past that?
where do you insert onCollect?

I believe in Jesus Christ as my Lord and Savior. If you do, put this in your signature.

Image

My Level Thread

viewtopic.php?f=89&t=16338

My Projects

Image

It also has a discord server! -> https://discord.gg/XGwG2AK

Image

Contests: show
Contests i'm currently in
TTK's Mountain Level Contest: Level Finished
TTK's Sky Level Contest: Level Finished
Restricted Contest 2: Not Started

Contests I've previously joined
Community Contest 13: 30th Place
Water Level Contest Placed 1st
Community Contest 12 Placed 39th
Underground Level Contest Level Placed 5th
SVLC 2 Placed 7th
Snow Level Contest Level Placed 5th
and more...
[/center]
Danny wrote:Here's some constructive criticism: What the hell.
Witchking wrote:Approved!

Discord Quotes: show
Image
[/center]

User avatar
Mosaic
Ludwig von Koopa
Ludwig von Koopa
Posts: 2774
Joined: Fri Feb 27, 2015 8:07 pm
Current Project: The Mosaic Group's Journey and Toad's SMB Adventure, Also, The Enemy's Boss Rush(yeah sure)
Location: California
Chat Username: Mosaic
Contact:

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Mosaic » Fri Jan 06, 2017 7:14 pm

I actually have a question unrelated to the currency system, how can you make a hammer bro throw hammers more rapidly?
does someone know how to make a script for that?

I believe in Jesus Christ as my Lord and Savior. If you do, put this in your signature.

Image

My Level Thread

viewtopic.php?f=89&t=16338

My Projects

Image

It also has a discord server! -> https://discord.gg/XGwG2AK

Image

Contests: show
Contests i'm currently in
TTK's Mountain Level Contest: Level Finished
TTK's Sky Level Contest: Level Finished
Restricted Contest 2: Not Started

Contests I've previously joined
Community Contest 13: 30th Place
Water Level Contest Placed 1st
Community Contest 12 Placed 39th
Underground Level Contest Level Placed 5th
SVLC 2 Placed 7th
Snow Level Contest Level Placed 5th
and more...
[/center]
Danny wrote:Here's some constructive criticism: What the hell.
Witchking wrote:Approved!

Discord Quotes: show
Image
[/center]

User avatar
xXAndytubeXx
Cheep-Cheep
Cheep-Cheep
Posts: 17
Joined: Wed Aug 16, 2017 5:50 pm
Current Project: SMBX 1.4.4: Power Star Mayhem (Look in Projects to find it)
Location: Why the hell do I have to tell you?
Chat Username: xXAndytubeXx

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby xXAndytubeXx » Thu Dec 07, 2017 2:07 pm

Kevsoft wrote:I recently had the idea if I should stream some LunaLua live development. Just say if you would be interested or not.
Because I get often ask where you can download LunaLua, I make a own topic about it.

LunaLua is a addition to lunadll which adds the script language lua. The problem with Autocode (the lunadll-language) is the lack of flexibility that it has (such as the way it lacks custom functions, variables,... etc). With this we don't need any hardcoded code for complex ideas anymore.

So first of all: What is lua?
Lua is an actual script language, which supports custom functions, variables and much more. The script type is something like JavaScript + Visual Basic



Download
Most recent Documentation
Source Code
LunaDLL for lua reference & example page (outdated since v0.2.7, but the examples still working)
LunaLua Tutorial
You might want to google other lua tutorials too.

How to install:
1. Check "Full Installation", check all checkboxes and download the most recent package.
2. Extract the package and profit!

How to update:
1. Check "Only Update" and replace the LuaScriptLib and lunadll.dll in your existing installation.

Example to see if LunaLua is working:
Spoiler: show

Code: Select all

function onLoop()
  printText("PLAYER x="..tostring(player.x).." y="..tostring(player.y), 30, 60)
end
Video Showcase:
Spoiler: show




Which lua-libs can I access?

Code: Select all

string.*
math.*
table.*
debug.*
os.* --Limited (only time/date works), because of security reasons
Reference to the lua libs:
string.*
math.*
table.*
debug.* (probably not needed)
os.* Note: Only os.clock, os.time and os.date works. The rest is limited due security reasons.
1. Sorry for quoting, I just wanted help with something.
2. How do I use LunaLUA in SMBX 1.4.4?
I'm just a YouTuber who happens to like Mario, Sonic, Minecraft, Terraria, ROBLOX (yes, I know, ROBLOX) and Undertale.
Find me on YouTube: https://www.youtube.com/channel/UCIFmLq ... ZA7hMTDW0Q
Find me on the SMBX Forums: https://www.supermariobrosx.org/forums/ ... le&u=14103
CHECK OUT MY GAMEJOLT PAGE!: show
Link to Power Star Mayhem on Gamejolt: Gamejolt Page
I support these:
Image ImageImage Image Image

User avatar
PixelPest
Edward
Edward
Posts: 6559
Joined: Sun Jul 12, 2015 5:38 pm
Current Project: Boom Boom Evolution
Location: Canada, Eh?
Chat Username: PixelPest
Contact:

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby PixelPest » Thu Dec 07, 2017 2:53 pm

You don't 1.4.4 isn't technically a version of SMBX and uses a very poorly-made language called Teascript-VB. LunaLua is only for 1.3.0.2 and SMBX2

User avatar
Quantumenace
Pokey
Pokey
Posts: 229
Joined: Mon Dec 28, 2015 2:17 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Quantumenace » Mon Jan 08, 2018 4:23 am

What is it about colliders.Poly that takes up so much CPU time? Do all the nested functions and vector methods contribute lots of overhead compared to the actal math? I had to make my own polygon-circle collision function to minimize chances of lag.

User avatar
Hoeloe
Nipper Plant
Nipper Plant
Posts: 766
Joined: Sat Oct 03, 2015 6:18 pm
Current Project: A2XT Episode 2

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Hoeloe » Mon Jan 08, 2018 12:22 pm

Quantumenace wrote:What is it about colliders.Poly that takes up so much CPU time? Do all the nested functions and vector methods contribute lots of overhead compared to the actal math? I had to make my own polygon-circle collision function to minimize chances of lag.
I highly doubt yours is more efficient. Either that or it's not actually working like you think it is.

The problem is that there really isn't a good solution to the problem of arbitrary polygon collision detection. There ARE reasonable solutions to the slightly more constrained problem of convex polygon collisions.

The reason colliders.Poly takes up a lot of CPU time is that it, at construction time, triangulates the polygon. This allows any arbitrary polygon (as long as its edges don't cross over) to be split into a set of convex polygons which can be used for collision detection.

The downside to this is that calling "colliders.Poly" every frame is very slow (but note that's the construction function, not the collision functions).

That's why you're not encouraged to do that.

Instead, you're encouraged to use colliders.Poly once, store the result, and then transform it by moving, rotating, scaling, etc.

The only reason you'd need to call colliders.Poly again would be if the shape were changing in real-time in a non-simple way - at which point you'd be better off either using your own function, or managing a set of triangle colliders yourself.

In short, it's very likely you're just using it wrong.

User avatar
Quantumenace
Pokey
Pokey
Posts: 229
Joined: Mon Dec 28, 2015 2:17 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Quantumenace » Mon Jan 08, 2018 6:54 pm

I should have clarified that I meant the collision algorithm rather than the definining of the collider. Weirdly the profiler lag graph seems to spike the first time the other collider gets close, and it isn't as bad afterwards, but all those tests can still take a decent amount of CPU power afterwards.

Yes, my method is limited to convex polygons, but it appears to work perfectly. It uses a variant of the line-point distance problem to check if the circle intersects an edge instead of turning both objects into triangles.


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 2 guests

Login  •  Register