Homebrew [Release] Lua Player Plus 3DS (lpp-3ds) - LUA interpreter for 3DS

  • Thread starter Thread starter Rinnegatamante
  • Start date Start date
  • Views Views 187,239
  • Replies Replies 1,199
  • Likes Likes 35
Code:
bg= Screen.loadImage("/3ds/PixelDraw/Themes/bg/pixeldraw.png")
my_font=Font.load("/3ds/PixelDraw/fonts/agencyfb.ttf")

while true do

Screen.waitVblankStart()
    Screen.refresh()

    Screen.drawImage(0, 0,bg, TOP_SCREEN)

    Font.print(my_font, 0,0 , "Hello World!.I am Kartik.THis my first program using lua and ipp-3ds ", Color.new(255,0,0), TOP_SCREEN)
    Font.print( my_font,0,15,"Press the x button to clear bottom screen",Color.new(0,0,255),TOP_SCREEN)
    Font.print(my_font, 0,30,"Press the x button to change the font to pretendo ",Color.new(255,0,255),TOP_SCREEN)
    Font.print(my_font,0,45,"Press the L+R+B+DDOWN buttons to exit ",Color.new(255,0,0),TOP_SCREEN)
    Font.print( my_font,0,60,"Press the DDOWN button to change the pixel color to green ",Color.new(255,0,255),TOP_SCREEN)
    Font.print(my_font,0,75,"Press the DUP button to change the pixel color to blue ",Color.new(0,0,255),TOP_SCREEN)
    Font.print(my_font, 0,90,"Press the DLEFT button to change the pixel color to yellow ",Color.new(0,255,255),TOP_SCREEN)
    Font.print(my_font,0,105,"Press the DRIGHT button to change the pixel color to pink ",Color.new(0,0,010),TOP_SCREEN)


        Screen.flip()



    if (Controls.check(Controls.read(),KEY_START)) then

    System.exit()
     end


           pad = Controls.read()
    if (Controls.check(pad,KEY_TOUCH)) then



            Screen.waitVblankStart()
             Screen.refresh()

            x,y = Controls.readTouch()
            Screen.drawPixel(x, y, Color.new(255,0,0), BOTTOM_SCREEN)
                Screen.flip()

                end
                if (Controls.check(Controls.read(),KEY_A)) then
                Font.unload(my_font)
                end
                if (Controls.check(Controls.read(),KEY_X)) then
                Screen.clear(BOTTOM_SCREEN)
          end
           end
i am trying to excute this but when i draw the pixels on the ds they act strangely can anybody tell why and how can i solve it

What do you mean for act strangely?
 
Can you please test the program,i don't have words to define how the pixels are showing so i am writing they are acting strangely .Also my english is not very good so i cannot define it to you
There are a lot of strange things in the script, first of all, remove the flip/waitVblankStart calls after the KEY_TOUCH check and move your Screen.flip call at the end of the script.

Another pretty bad thing is the high number of CPU rendering (rememeber that atm fonts are using CPU rendering).
PRobably your script will not run at fullspeed (and this could be another cause of pixel acting "strangely" (due to desynchronization between touch detection and screen refreshing).
 
There are a lot of strange things in the script, first of all, remove the flip/waitVblankStart calls after the KEY_TOUCH check and move your Screen.flip call at the end of the script.

Another pretty bad thing is the high number of CPU rendering (rememeber that atm fonts are using CPU rendering).
PRobably your script will not run at fullspeed (and this could be another cause of pixel acting "strangely" (due to desynchronization between touch detection and screen refreshing).
Ah okay ,Thanks for your time
 
Thanks, Is it possible to 1. Tell a LUA script to load another LUA Script and 2. Is it possible to make it when you press a button a Random wav sound you loaded plays?
 
Tell a LUA script to load another LUA Script
Code:
dofile(System.currentDirectory().."/script.lua")
make it when you press a button a Random wav sound you loaded plays
Code:
songs = System.listDirectory(System.currentDirectory().."/songs")
song = songs[math.random(1, #songs)]
-- load the file and play it from here...
the above can be changed to just specific files as well, using a table.
 
Last edited by ihaveahax,
oh okay

--------------------- MERGED ---------------------------

JUst have one more thing. How do I make a select able list?
 
okay

--------------------- MERGED ---------------------------

So it would be math.random(1, 6) or math.random(1, #songs) ?

--------------------- MERGED ---------------------------

This is my code.
Code:
Lucina = System.listDirectory(System.currentDirectory().."/GameData/Sound/Lucina")
LucinaSpeak = Lucina[math.random(1, #songs)]

while true do
    Sound.init()
    Sound.play(LucinaSpeak,NO_LOOP)
end
It says Error: [string "?"]:6: bad argument #1 to 'play' (Number eexpected, got table

How do i fix this?
 
Last edited by ElyosOfTheAbyss,
It needs to be #Lucina not #lucina. The capital letter matters.

Also, I forgot a slash in these two lines:
Code:
Lucina=System.listDirectory(System.currentDirectory().."/GameData/Sound/Lucina")
soundPath =(System.currentDirectory().."/GameData/Sound/Lucina"..Lucina[math.random(1,#songs)].name)

It should have a slash at the end of Lucina.
Code:
Lucina=System.listDirectory(System.currentDirectory().."/GameData/Sound/Lucina/")
soundPath =(System.currentDirectory().."/GameData/Sound/Lucina/"..Lucina[math.random(1,#songs)].name)



It should be something like this:
(I added in a way to exit the program too.)
Code:
Sound.init()
Lucina = System.listDirectory(System.currentDirectory().."/GameData/Sound/Lucina/")
soundPath = (System.currentDirectory().."/GameData/Sound/Lucina/" .. Lucina[math.random(1,#Lucina)].name)
LucinaSpeak = Sound.openWav(soundPath, false)
Sound.play(LucinaSpeak,NO_LOOP)

while true do
if Controls.check(Controls.read(),KEY_A) then
Sound.close(LucinaSpeak)
Sound.term()
System.exit()
end
end

Sorry about that.

I made you a bare bones file selector because I saw you asked for it in an earlier post.
http://pastebin.com/gKB8SRE8
I tested it out already to make sure it works.
You'll probably need to add a way to scroll down a list of files.
Thanks so much :D
 
  • Like
Reactions: PF2M
Hi guys! Someone using my homebrew app is getting "Error: index.lua not found", but their index.lua is definitely in the app's homebrew directory, along with the appropriate .3dsx, .elf and .smdh files from 3ds-lpp. Is there any other reason this error might appear? This is a screenshot of their folder:
z6kmCEB.png
 
Hi guys! Someone using my homebrew app is getting "Error: index.lua not found", but their index.lua is definitely in the app's homebrew directory, along with the appropriate .3dsx, .elf and .smdh files from 3ds-lpp. Is there any other reason this error might appear? This is a screenshot of their folder:
z6kmCEB.png
filesystem problem? if it's clearly there then I can't think of anything else.

also, the .elf isn't needed unless you're making a .3ds/.cia version.
 
filesystem problem? if it's clearly there then I can't think of anything else.

also, the .elf isn't needed unless you're making a .3ds/.cia version.
What do you mean by filesystem problem? Would that be anything I could fix in my code or is it just an unfortunate problem with their DS or something?
 

Site & Scene News

Popular threads in this forum