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

Rinnegatamante

Well-Known Member
OP
Member
Joined
Nov 24, 2014
Messages
3,162
Trophies
2
Age
29
Location
Bologna
Website
rinnegatamante.it
XP
4,857
Country
Italy
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?
 

Rinnegatamante

Well-Known Member
OP
Member
Joined
Nov 24, 2014
Messages
3,162
Trophies
2
Age
29
Location
Bologna
Website
rinnegatamante.it
XP
4,857
Country
Italy
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).
 

Kartik

Well-Known Member
Member
Joined
Jun 6, 2015
Messages
653
Trophies
0
Location
github
XP
2,747
Country
India
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
 

ElyosOfTheAbyss

Well-Known Member
Member
Joined
Aug 20, 2015
Messages
2,225
Trophies
1
XP
1,911
Country
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?
 

ihaveahax

Well-Known Member
Member
Joined
Apr 20, 2015
Messages
6,070
Trophies
2
XP
7,835
Country
United States
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,

ElyosOfTheAbyss

Well-Known Member
Member
Joined
Aug 20, 2015
Messages
2,225
Trophies
1
XP
1,911
Country
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,

ElyosOfTheAbyss

Well-Known Member
Member
Joined
Aug 20, 2015
Messages
2,225
Trophies
1
XP
1,911
Country
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

HeyItsJono

Breath of Fresh Heir
Member
Joined
Mar 26, 2011
Messages
213
Trophies
1
XP
285
Country
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
 

ihaveahax

Well-Known Member
Member
Joined
Apr 20, 2015
Messages
6,070
Trophies
2
XP
7,835
Country
United States
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.
 

HeyItsJono

Breath of Fresh Heir
Member
Joined
Mar 26, 2011
Messages
213
Trophies
1
XP
285
Country
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?
 

ihaveahax

Well-Known Member
Member
Joined
Apr 20, 2015
Messages
6,070
Trophies
2
XP
7,835
Country
United States

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Psionic Roshambo @ Psionic Roshambo: https://www.youtube.com/watch?v=COua5q4CByg