This is the place for discussion and support for LunaLua and related modifications and libraries.
Moderator: Userbase Moderators
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?
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Fri Jan 19, 2018 9:02 pm
Enjl wrote:Notxarb wrote:Do global variables save to the save file automatically? If not, how can we save variables to the save file?
https://wohlsoft.ru/pgewiki/Data_(class)
We're streamlining the system and making it easier to use with the next release, but for now, gotta use this.
It's essentially a table which you write and read from with :set and :get, using :save to save stuff to the file.
|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9887
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » Fri Jan 19, 2018 9:03 pm
Just copypaste it into your url bar?
|
|
|
|
|
|
|
|
|
-
Novarender
- Tweeter

- Posts: 145
- Joined: Sat Aug 06, 2016 6:59 pm
- Flair: Whoa
Postby Novarender » Fri Jan 19, 2018 9:17 pm
Enjl wrote:Just copypaste it into your url bar?
I suppose... but clicking on it is easier
I noticed some unnecessary folders in the data folder. What is the purpose of:
_ini_examples
gif-recordings
Oh wait, I guess that's it. Can I safely delete these?
Also, how does the LuaScriptsLib folder work?
I know it has implemented scripts that you can call on at any time, but how does this work?
What are the folders in that folder for-- just demonstrations?
Also, how does relaying variables from a LuaScript to an original script work?
I'm kind of confused here...
Last edited by Novarender on Wed May 30, 2018 5:51 pm, edited 1 time in total.
|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9887
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » Fri Jan 19, 2018 9:21 pm
ini_examples includes examples of ini files like music.ini and sounds.ini which you can copy over and modify to replace base sounds and music
gif recordings is like screenshots but animated. Press F11 in game to start/stop a recording.
Use API.load("apiname") to load a library. API.load also searches in luascriptslib. You can search in its subfolders by changing your function call to:
API.load("folder/apiname"). Don't add ".lua" to the filename.
Some scripts expose some of their variables. When loading the scripts, you can store them in variables:
local colliders = API.load("colliders")
and then call their exposed variables and functions:
colliders.Box(0,0,32,32)
|
|
|
|
|
|
|
|
|
-
Kley
- Edge

- Posts: 694
- Joined: Mon Feb 24, 2014 11:00 am
- Flair: Robot
Postby Kley » Sat Jan 20, 2018 11:13 am
Notxarb wrote:PixelPest wrote:Notxarb wrote:If I want to make a "Time's Up!" graphic and display it when the time runs out, where should I put that graphic and how can I access it in an lua script?
Also, is there no way to make music play faster?
My mistake it was 0x13E. Sorry.
To load a graphics use the Graphics.loadImage function with the argument being the file path. You can place the file in your custom graphics folder along with your lunadll.lua file and your file path will just be the name of your file. Then draw it with Graphics.drawImageWP at a priority of 5 (HUD priority). You also could possibly just use Text.printWP or textblox.lua as well depending on how complicated you want the text to be instead of loading an image file. There's no way to modify music files rn but you can just use a program outside of SMBX to change the speed of the music file and then load and play it in LunaLua
Ok thanks. Also, I suspected I'd have to do that to the music, but that means I'll have to have nearly twice as many songs, and believe me I will be having LOTS of songs in my episode.
If you think about it, do you think you could make artificial 4-players by cloning player 1 and 2 and having player 3 and 4 control those clones?
Also, will 4-players be added in Beta 4? When will Beta 4 come out?
Notxarb wrote:We all know how you can travel across any adjacent paths on the world map. Could you use lua scripts to program individual paths so that Mario can only travel across connected parts of paths?
please stop the double posting
|
|
|
|
|
|
|
|
|
-
The Dwarven Digger
- Lakitu

- Posts: 484
- Joined: Sun Oct 30, 2016 11:17 am
- Pronouns: they/them
Postby The Dwarven Digger » Sun Jan 21, 2018 9:16 am
Anyone know how I would make a monty mole? I'm going to be using them as the main enemy in one of my levels, and they'll show up in a few other levels too. I don't care which NPC they replace, and I've got a spritesheet with the SMW moles that I'm going to have to make into an NPC graphic anyway. I'm looking for both types, the one that comes out of the wall and the one that comes from the floor.
|
|
|
|
|
|
|
|
|
-
Taycamgame
- Gold Yoshi Egg

- Posts: 1483
- Joined: Mon Jun 19, 2017 11:35 am
- Flair: Stargard
-
Contact:
Postby Taycamgame » Sun Jan 21, 2018 9:28 am
They are probably coming in beta 4, so i'd wait for that.
|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9887
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » Sun Jan 21, 2018 2:21 pm
mfw they're still WIP i should yell at pyro to finish them
|
|
|
|
|
|
|
|
|
-
Novarender
- Tweeter

- Posts: 145
- Joined: Sat Aug 06, 2016 6:59 pm
- Flair: Whoa
Postby Novarender » Sun Jan 21, 2018 6:34 pm
It doesn't work when I try to set the player's speedY value. Code: Select all function onKeyDown(keycode)
if keycode == KEY_JUMP then
if player.downKeyPressing then
Text.print("YES",64,64)
player.speedY = -30
end
end
end
EDIT: Wait, is the normal jump overriding this? When I do it in the air it works...
How can I override the normal jump?
Last edited by Novarender on Sun Jan 21, 2018 6:37 pm, edited 1 time in total.
|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Sun Jan 21, 2018 6:36 pm
Notxarb wrote:It doesn't work when I try to set the player's speedY value. Code: Select all function onKeyDown(keycode)
if keycode == KEY_JUMP then
if player.downKeyPressing then
Text.print("YES",64,64)
player.speedY = -30
end
end
end
What file do you have this in? Also btw -30 is going to shoot the player upwards
|
|
|
|
|
|
|
|
|
-
Novarender
- Tweeter

- Posts: 145
- Joined: Sat Aug 06, 2016 6:59 pm
- Flair: Whoa
Postby Novarender » Sun Jan 21, 2018 6:38 pm
PixelPest wrote:Notxarb wrote:It doesn't work when I try to set the player's speedY value. Code: Select all function onKeyDown(keycode)
if keycode == KEY_JUMP then
if player.downKeyPressing then
Text.print("YES",64,64)
player.speedY = -30
end
end
end
What file do you have this in? Also btw -30 is going to shoot the player upwards
It's .lua.
Also, I want it to shoot me upwards. This is the start of a backflip.
As I edited in my comment above, I think the normal jump is overriding it.
|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Sun Jan 21, 2018 6:40 pm
Notxarb wrote:PixelPest wrote:Notxarb wrote:It doesn't work when I try to set the player's speedY value. Code: Select all function onKeyDown(keycode)
if keycode == KEY_JUMP then
if player.downKeyPressing then
Text.print("YES",64,64)
player.speedY = -30
end
end
end
What file do you have this in? Also btw -30 is going to shoot the player upwards
It's .lua.
Also, I want it to shoot me upwards. This is the start of a backflip.
As I edited in my comment above, I think the normal jump is overriding it.
What is your file called though? And are you seeing the text printed? Also try doing it in onInputUpdate and test for player.downKeyPressing
|
|
|
|
|
|
|
|
|
-
Novarender
- Tweeter

- Posts: 145
- Joined: Sat Aug 06, 2016 6:59 pm
- Flair: Whoa
Postby Novarender » Sun Jan 21, 2018 6:44 pm
Ok, onInputUpdate worked.
My file is called lunadll (.lua) and yes I can see the printed text.
But now I have another problem:
Code: Select all function onInputUpdate()
if player.jumpKeyPressing then
if player.downKeyPressing then
if player:mem(0x146, FIELD_WORD) == 1 then
Text.print("YES",64,64)
player.speedY = -30
end
end
end
end
This sets his Y speed when both feet are touching the ground, but he leaves the ground too fast and it is not set.
Is there any way I can work around this?
|
|
|
|
|
|
|
|
|
-
An Absolute Loser
- Goomba

- Posts: 4
- Joined: Fri Jan 26, 2018 8:30 pm
Postby An Absolute Loser » Sun Jan 28, 2018 1:58 pm
I seem to have encountered something extremely odd while attempting to use the Raocoin2.lua API on SMBX2 Beta 3. I haven't done anything besides attempting to collect a singular coin and it gives me the following error message.
https://imgur.com/a/jVdOp
the only thing I have inside of lunaworld.lua (as the PGE page said to put inside).
Code: Select all local raocoin = API.load("raocoin2");
local coins = raocoin.registerMemCurrency(0x00B2C5A8,FIELD_WORD,true,false);
|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Sun Jan 28, 2018 2:49 pm
An Absolute Loser wrote:I seem to have encountered something extremely odd while attempting to use the Raocoin2.lua API on SMBX2 Beta 3. I haven't done anything besides attempting to collect a singular coin and it gives me the following error message.
https://imgur.com/a/jVdOp
the only thing I have inside of lunaworld.lua (as the PGE page said to put inside).
Code: Select all local raocoin = API.load("raocoin2");
local coins = raocoin.registerMemCurrency(0x00B2C5A8,FIELD_WORD,true,false);
I've never actually worked with raocoin2.lua before and didn't get a lot of time to figure out the inner workings of it, so I'm not completely confident in this fix. Basically the issue is that it never creates an entry within the currencyCache table and then tries to reference it on 357. I instead made it reference the memcurrencyCache table and tweaked and added a few lines to set up the table itself. I did a little bit of testing and this fix seems to work pretty well, at least with the set, get, and save methods in addition to initializing it (which is all I tested).
The modified code is here: https://hastebin.com/uzeduvivit.lua.
Copy it into a new .lua file and name the file "local_raocoin2.lua" and put it in the same directory as your lunaworld.lua file. Then instead of calling API.load("raocoin2"); just call API.load("local_raocoin2"); in your lunaworld.lua file
|
|
|
|
|
|
|
|
|
-
Chaotic Gaming
- Buster Beetle

- Posts: 99
- Joined: Mon Jan 23, 2017 7:11 pm
-
Contact:
Postby Chaotic Gaming » Mon Jan 29, 2018 1:35 am
Spinda wrote:couldnt you just set the lives (memory 0x00B2C5AC) to 99 at the start of the level?
If you set it like so:
On OnStart() which runs at the beginning of each level and beginning of the overworld, it does not work! So no.
|
|
|
|
|
|
|
|
|
-
The0x539
- Eerie

- Posts: 751
- Joined: Fri Jan 22, 2016 8:02 pm
Postby The0x539 » Mon Jan 29, 2018 3:34 am
CC_Comedic_Comentator wrote:On OnStart() which runs at the beginning of each level and beginning of the overworld, it does not work! So no.
OnStart does not. onStart does. These things are important.
|
|
|
|
|
|
|
|
|
-
The Dwarven Digger
- Lakitu

- Posts: 484
- Joined: Sun Oct 30, 2016 11:17 am
- Pronouns: they/them
Postby The Dwarven Digger » Mon Jan 29, 2018 10:36 am
The0x539 wrote:CC_Comedic_Comentator wrote:On OnStart() which runs at the beginning of each level and beginning of the overworld, it does not work! So no.
OnStart does not. onStart does. These things are important.
Ah yes, the classic programmer's error of incorrect capitalisation/format. Can be very hard to debug if you don't spot it.
|
|
|
|
|
|
|
|
|
-
Chaotic Gaming
- Buster Beetle

- Posts: 99
- Joined: Mon Jan 23, 2017 7:11 pm
-
Contact:
Postby Chaotic Gaming » Mon Jan 29, 2018 5:56 pm
The0x539 wrote:CC_Comedic_Comentator wrote:On OnStart() which runs at the beginning of each level and beginning of the overworld, it does not work! So no.
OnStart does not. onStart does. These things are important.
Correction: I forgot to edit my post last night. turns out I was saving the changes as a .lua.txt file by accident. Apparently Notepad on Windows 7 got confused which file format I had. XD
In sum, Adding mem(0x00B2C5AC, FIELD_FLOAT, 99) as suggested works to a degree. The world map shows the lost life, it is restored to 99 when you enter a level again. Can Lua edit the overworld yet? Maybe that could fix it if the code could be injected during the overworld?
|
|
|
|
|
|
|
|
|
-
The0x539
- Eerie

- Posts: 751
- Joined: Fri Jan 22, 2016 8:02 pm
Postby The0x539 » Mon Jan 29, 2018 6:05 pm
CC_Comedic_Comentator wrote:The0x539 wrote:CC_Comedic_Comentator wrote:On OnStart() which runs at the beginning of each level and beginning of the overworld, it does not work! So no.
OnStart does not. onStart does. These things are important.
Correction: I forgot to edit my post last night. turns out I was saving the changes as a .lua.txt file by accident. Apparently Notepad on Windows 7 got confused which file format I had. XD
In sum, Adding mem(0x00B2C5AC, FIELD_FLOAT, 99) as suggested works to a degree. The world map shows the lost life, it is restored to 99 when you enter a level again. Can Lua edit the overworld yet? Maybe that could fix it if the code could be injected during the overworld?
lunaoverworld.lua (map.lua in beta 4) will run on the overworld, generally using the same event names.
|
|
|
|
|
Return to “LunaLua”
Users browsing this forum: No registered users and 1 guest
|