Re: Need help with lua? - LunaLua General Help
Posted: Sat May 07, 2016 6:43 pm
Yes. It's in the same folder as the lunaworld.luaEnjl wrote:does "hint-coin-counter.png" exist?
Forums for SMBX
https://www.smbxgame.com/forums/
Yes. It's in the same folder as the lunaworld.luaEnjl wrote:does "hint-coin-counter.png" exist?
Code: Select all
function onKeyDown(keycode)
Code: Select all
function onInputUpdate()
Try onKeyBoardPress()MECHDRAGON777 wrote:How would you lock the player's controls on the world map? I am asking sinceandCode: Select all
function onKeyDown(keycode)
do not work in lunaoverworld.lua files...Code: Select all
function onInputUpdate()
PixelPest wrote: Try onKeyBoardPress()
Code: Select all
onKeyboardPress(vk)
You put all that code into onTick().PixelPest wrote:I'm working on a script for a HUD, however I've encountered an issue. Here's the script: https://hastebin.com/wokusecepo.lua
What I'm trying to do is make the HUD be shown for three seconds and then the main panel at the top moves up at a speed of two pixels per tick until it is off of the screen, while the bottom part moves down two pixels per tick until it is off of the screen. The HUD can be revealed by pressing the shift button and is automatically revealed when an achievement is presented to the player. My issue is that after three seconds of the HUD being shown, before it moves up it shakes up and down for about a second (looks like it's vibrating) before it moves off of the screen. I want to get rid of the shaking (I can't figure out what's causing it) and have the HUD move smoothly immediately after three seconds have passed. (It does move smoothly after it's done doing its strange shaking thing, but I want to get rid of the vibrating look.) Sorry, but I can't upload a video nor an animated gif because my school's wi-fi network blocks Imgur, YouTube, and uploading pictures (or downloading them) online
Yes. Though I recommend renaming them to "local_*apiname*.lua", to have a better distinction.Nerx wrote:Can I include APIs in an episode folder so I can distribute and episode/level without having a seperate download for APIs?
There is a file called vc_redist.x86.exe in your SMBX folder. Run that and it will install the required DLLs to your PC.mariogeek2 wrote:Hey, guys, I'm having trouble getting LunaLua to work. I downloaded LunaLua by itself (hexed and vanilla + launcher), and that didn't work. So I downloaded LunaLua Vanilla + Launcher + Complete Standalone Base Game, and I got error code "unable to find msvcp140.dll", which I found on the internet, downloaded, and put in the LunaLua + SMBX folder. It then said, "unable to find vcruntime140.dll", which I also found on the internet, downloaded, and put in the LunaLua + SMBX folder. I then got error message "The application was unable to start correctly (0xc000007b). Click OK to close the application." I then downloaded the LunaLua Hexed version + stand alone base game, and put it in the LunaLua + SMBX folder, and overwrited all files with the same name. Still got the same (0xc00007b) error message. Do you guys have any advice?
Ok, thanks. I'll try it and see if it works.S1eth wrote:There is a file called vc_redist.x86.exe in your SMBX folder. Run that and it will install the required DLLs to your PC.mariogeek2 wrote:Hey, guys, I'm having trouble getting LunaLua to work. I downloaded LunaLua by itself (hexed and vanilla + launcher), and that didn't work. So I downloaded LunaLua Vanilla + Launcher + Complete Standalone Base Game, and I got error code "unable to find msvcp140.dll", which I found on the internet, downloaded, and put in the LunaLua + SMBX folder. It then said, "unable to find vcruntime140.dll", which I also found on the internet, downloaded, and put in the LunaLua + SMBX folder. I then got error message "The application was unable to start correctly (0xc000007b). Click OK to close the application." I then downloaded the LunaLua Hexed version + stand alone base game, and put it in the LunaLua + SMBX folder, and overwrited all files with the same name. Still got the same (0xc00007b) error message. Do you guys have any advice?
Okay, thanks a ton!Enjl wrote:Yes. Though I recommend renaming them to "local_*apiname*.lua", to have a better distinction.Nerx wrote:Can I include APIs in an episode folder so I can distribute and episode/level without having a seperate download for APIs?
Do you think this will resolve the issue then?: https://hastebin.com/oqecaxejad.luaS1eth wrote:You put all that code into onTick().PixelPest wrote:I'm working on a script for a HUD, however I've encountered an issue. Here's the script: https://hastebin.com/wokusecepo.lua
What I'm trying to do is make the HUD be shown for three seconds and then the main panel at the top moves up at a speed of two pixels per tick until it is off of the screen, while the bottom part moves down two pixels per tick until it is off of the screen. The HUD can be revealed by pressing the shift button and is automatically revealed when an achievement is presented to the player. My issue is that after three seconds of the HUD being shown, before it moves up it shakes up and down for about a second (looks like it's vibrating) before it moves off of the screen. I want to get rid of the shaking (I can't figure out what's causing it) and have the HUD move smoothly immediately after three seconds have passed. (It does move smoothly after it's done doing its strange shaking thing, but I want to get rid of the vibrating look.) Sorry, but I can't upload a video nor an animated gif because my school's wi-fi network blocks Imgur, YouTube, and uploading pictures (or downloading them) online
Every single frame in which drawHUD == true, you are calling eventu.setTimer(3, endHUDDraw, false);
Then, after 3 seconds, endHUDDraw is called 65*3 times in a row.
Also, you are calling endHUDDraw twice in a single tick. Once in "if player.dropItemKeyPressing then" and then another time in "if drawHUD then"
Why are you asking me? Why don't you just try it out?PixelPest wrote:Do you think this will resolve the issue then?: https://hastebin.com/oqecaxejad.luaS1eth wrote:You put all that code into onTick().PixelPest wrote:I'm working on a script for a HUD, however I've encountered an issue. Here's the script: https://hastebin.com/wokusecepo.lua
What I'm trying to do is make the HUD be shown for three seconds and then the main panel at the top moves up at a speed of two pixels per tick until it is off of the screen, while the bottom part moves down two pixels per tick until it is off of the screen. The HUD can be revealed by pressing the shift button and is automatically revealed when an achievement is presented to the player. My issue is that after three seconds of the HUD being shown, before it moves up it shakes up and down for about a second (looks like it's vibrating) before it moves off of the screen. I want to get rid of the shaking (I can't figure out what's causing it) and have the HUD move smoothly immediately after three seconds have passed. (It does move smoothly after it's done doing its strange shaking thing, but I want to get rid of the vibrating look.) Sorry, but I can't upload a video nor an animated gif because my school's wi-fi network blocks Imgur, YouTube, and uploading pictures (or downloading them) online
Every single frame in which drawHUD == true, you are calling eventu.setTimer(3, endHUDDraw, false);
Then, after 3 seconds, endHUDDraw is called 65*3 times in a row.
Also, you are calling endHUDDraw twice in a single tick. Once in "if player.dropItemKeyPressing then" and then another time in "if drawHUD then"
I added the variable "endHUDDrawTimer" to regulate the amount of times endHUDDraw is called
I would recommend making it act like a normal jump keyReign wrote:I'm afraid I'm back already.![]()
Is there a simple way to disable spin jump so that the button does not do anything (no jump sound, no nothing). Right now I'm just using it as a "suicide button" but I would prefer to just disable the spin jump and move the suicide to some less common key like "Drop item".
function onKeyDown(keycode)
if (keycode == KEY_SPINJUMP) then
player:kill()
end
end
Reign wrote:Thanks, guys.
If you want you could also add player.jumpKeyPressing = true; between the third and fourth lines. Then instead of being a dead key, it just makes the player do a normal jumpSpoiler: show
This one works.