
Is there an ETA when you plan on releasing a build of the interpreter with fixed .wav saving?
If you posted it, maybe.Could anyone help with my code?
I did like 3 posts ago and it was ignored :/If you posted it, maybe.
-snip-
you could try 'dofile(System.currentDirectory().."/graphics_and_controls.lua")'.
pad = Controls.read()
if (Controls.check(pad,KEY_A)) then
Sound.play(audio,NO_LOOP,0x09)
What error do you get?How can I make it so that when a button is pressed a wav plays?
The code above gives me an error. I have set "audio" to = something, and playing the audio w/o a button combo works fine.Code:pad = Controls.read() if (Controls.check(pad,KEY_A)) then Sound.play(audio,NO_LOOP,0x09)
white = Color.new(255, 255, 255)
num1 = 0
num2 = 0
operation = 1
answer = 0
remainder = 0
oldpad = Controls.read()
uparrow = Screen.loadImage("/up.bmp")
downarrow = Screen.loadImage("/down.bmp")
while true do
Screen.refresh()
pad = Controls.read()
x,y = Controls.readTouch()
Screen.clear(TOP_SCREEN)
Screen.clear(BOTTOM_SCREEN)
if (Controls.check(pad,KEY_DUP)) and not (Controls.check(oldpad,KEY_DUP)) then
num1 = num1 + 1
end
if (Controls.check(pad,KEY_DDOWN)) and not (Controls.check(oldpad,KEY_DDOWN)) then
num1 = num1 - 1
end
if (Controls.check(pad,KEY_DRIGHT)) and not (Controls.check(oldpad,KEY_DRIGHT)) then
num2 = num2 + 1
end
if (Controls.check(pad,KEY_DLEFT)) and not (Controls.check(oldpad,KEY_DLEFT)) then
num2 = num2 - 1
end
if(Controls.check(pad,KEY_TOUCH)) and not (Controls.check(oldpad, KEY_TOUCH)) then
x,y = Controls.readTouch()
if(x > 19) and (x < 99) and (y > 30) and (y < 55) then
num1 = num1 + 1
elseif(x > 19) and (x < 99) and (y > 160) and (y < 185) then
num1 = num1 - 1
elseif(x > 119) and (x < 199) and (y > 30) and (y < 55) then
if operation == 5 then
operation = 1
else
operation = operation + 1
end
elseif(x > 119) and (x < 199) and (y > 160) and (y < 185) then
if operation == 1 then
operation = 5
else
operation = operation - 1
end
elseif(x > 219) and (x < 299) and (y > 30) and (y < 55) then
num2 = num2 + 1
elseif(x > 219) and (x < 299) and (y > 160) and (y < 185) then
num2 = num2 - 1
end
end
if (Controls.check(pad,KEY_A)) and not (Controls.check(oldpad,KEY_A)) then
operation = 1
answer = num1 + num2
end
if (Controls.check(pad,KEY_B)) and not (Controls.check(oldpad,KEY_B)) then
operation = 2
answer = num1 - num2
end
if (Controls.check(pad,KEY_Y)) and not (Controls.check(oldpad,KEY_Y)) then
operation = 3
if num2 > 0 then
answer = num1 // num2
remainder = num1 % num2
end
end
if (Controls.check(pad,KEY_X)) and not (Controls.check(oldpad,KEY_X)) then
operation = 4
answer = num1 * num2
end
if (Controls.check(pad,KEY_SELECT)) and not (Controls.check(oldpad,KEY_SELECT)) then
operation = 5
answer = num1 ^ num2
end
if (Controls.check(pad, KEY_START)) then
System.exit()
end
Screen.drawImage(20,31,uparrow,BOTTOM_SCREEN)
Screen.drawImage(120,31,uparrow,BOTTOM_SCREEN)
Screen.drawImage(220,31,uparrow,BOTTOM_SCREEN)
Screen.drawImage(20,161,downarrow,BOTTOM_SCREEN)
Screen.drawImage(120,161,downarrow,BOTTOM_SCREEN)
Screen.drawImage(220,161,downarrow,BOTTOM_SCREEN)
if operation == 1 then
answer = num1 + num2
Screen.debugPrint(0,30,num1 .. " + " .. num2 .. " = " .. answer,white,TOP_SCREEN)
elseif operation == 2 then
answer = num1 - num2
Screen.debugPrint(0,30,num1 .. " - " .. num2 .. " = " .. answer,white,TOP_SCREEN)
elseif operation == 3 then
if num2 ~= 0 then
answer = num1 // num2
remainder = num1 % num2
if remainder ~= 0 then
Screen.debugPrint(0,30,num1 .. " / " .. num2 .. " = " .. answer .. "r" .. remainder,white,TOP_SCREEN)
else
Screen.debugPrint(0,30,num1 .. " / " .. num2 .. " = " .. answer,white,TOP_SCREEN)
end
else
Screen.debugPrint(0,30,num1 .. " / " .. num2 .. " = UNDEFINED",white,TOP_SCREEN)
end
elseif operation == 4 then
answer = num1 * num2
Screen.debugPrint(0,30,num1 .. " x " .. num2 .. " = " .. answer,white,TOP_SCREEN)
elseif operation == 5 then
answer = num1 ^ num2
Screen.debugPrint(0,30,num1 .. "^" .. num2 .. " = " .. answer,white,TOP_SCREEN)
end
Screen.flip()
oldpad = pad
Screen.waitVblankStart()
end

Alright so I wrote up this program as a simple calculator, and it works perfectly fine on citra (other than the pictures appearing as a glitch for some reason) but when I run it on my 3ds it's a black screen on both the top and bottom screens...
Code:white = Color.new(255, 255, 255) num1 = 0 num2 = 0 operation = 1 answer = 0 remainder = 0 oldpad = Controls.read() uparrow = Screen.loadImage("/up.bmp") downarrow = Screen.loadImage("/down.bmp") while true do Screen.refresh() pad = Controls.read() x,y = Controls.readTouch() Screen.clear(TOP_SCREEN) Screen.clear(BOTTOM_SCREEN) if (Controls.check(pad,KEY_DUP)) and not (Controls.check(oldpad,KEY_DUP)) then num1 = num1 + 1 end if (Controls.check(pad,KEY_DDOWN)) and not (Controls.check(oldpad,KEY_DDOWN)) then num1 = num1 - 1 end if (Controls.check(pad,KEY_DRIGHT)) and not (Controls.check(oldpad,KEY_DRIGHT)) then num2 = num2 + 1 end if (Controls.check(pad,KEY_DLEFT)) and not (Controls.check(oldpad,KEY_DLEFT)) then num2 = num2 - 1 end if(Controls.check(pad,KEY_TOUCH)) and not (Controls.check(oldpad, KEY_TOUCH)) then x,y = Controls.readTouch() if(x > 19) and (x < 99) and (y > 30) and (y < 55) then num1 = num1 + 1 elseif(x > 19) and (x < 99) and (y > 160) and (y < 185) then num1 = num1 - 1 elseif(x > 119) and (x < 199) and (y > 30) and (y < 55) then if operation == 5 then operation = 1 else operation = operation + 1 end elseif(x > 119) and (x < 199) and (y > 160) and (y < 185) then if operation == 1 then operation = 5 else operation = operation - 1 end elseif(x > 219) and (x < 299) and (y > 30) and (y < 55) then num2 = num2 + 1 elseif(x > 219) and (x < 299) and (y > 160) and (y < 185) then num2 = num2 - 1 end end if (Controls.check(pad,KEY_A)) and not (Controls.check(oldpad,KEY_A)) then operation = 1 answer = num1 + num2 end if (Controls.check(pad,KEY_B)) and not (Controls.check(oldpad,KEY_B)) then operation = 2 answer = num1 - num2 end if (Controls.check(pad,KEY_Y)) and not (Controls.check(oldpad,KEY_Y)) then operation = 3 if num2 > 0 then answer = num1 // num2 remainder = num1 % num2 end end if (Controls.check(pad,KEY_X)) and not (Controls.check(oldpad,KEY_X)) then operation = 4 answer = num1 * num2 end if (Controls.check(pad,KEY_SELECT)) and not (Controls.check(oldpad,KEY_SELECT)) then operation = 5 answer = num1 ^ num2 end if (Controls.check(pad, KEY_START)) then System.exit() end Screen.drawImage(20,31,uparrow,BOTTOM_SCREEN) Screen.drawImage(120,31,uparrow,BOTTOM_SCREEN) Screen.drawImage(220,31,uparrow,BOTTOM_SCREEN) Screen.drawImage(20,161,downarrow,BOTTOM_SCREEN) Screen.drawImage(120,161,downarrow,BOTTOM_SCREEN) Screen.drawImage(220,161,downarrow,BOTTOM_SCREEN) if operation == 1 then answer = num1 + num2 Screen.debugPrint(0,30,num1 .. " + " .. num2 .. " = " .. answer,white,TOP_SCREEN) elseif operation == 2 then answer = num1 - num2 Screen.debugPrint(0,30,num1 .. " - " .. num2 .. " = " .. answer,white,TOP_SCREEN) elseif operation == 3 then if num2 ~= 0 then answer = num1 // num2 remainder = num1 % num2 if remainder ~= 0 then Screen.debugPrint(0,30,num1 .. " / " .. num2 .. " = " .. answer .. "r" .. remainder,white,TOP_SCREEN) else Screen.debugPrint(0,30,num1 .. " / " .. num2 .. " = " .. answer,white,TOP_SCREEN) end else Screen.debugPrint(0,30,num1 .. " / " .. num2 .. " = UNDEFINED",white,TOP_SCREEN) end elseif operation == 4 then answer = num1 * num2 Screen.debugPrint(0,30,num1 .. " x " .. num2 .. " = " .. answer,white,TOP_SCREEN) elseif operation == 5 then answer = num1 ^ num2 Screen.debugPrint(0,30,num1 .. "^" .. num2 .. " = " .. answer,white,TOP_SCREEN) end Screen.flip() oldpad = pad Screen.waitVblankStart() end
Here's up.bmp and down.bmp: http://imgur.com/a/syCtr
EDIT: The touch screen part does work just fine, it's just the image is glitched
This is trying to load the images from the root of the SD card, which is probably not where they are when you use a .3dsx. Try this:Code:uparrow = Screen.loadImage("/up.bmp") downarrow = Screen.loadImage("/down.bmp")
uparrow = Screen.loadImage(System.currentDirectory().."/up.bmp")
downarrow = Screen.loadImage(System.currentDirectory().."/down.bmp")
Fixed it. My ends were all messed up.What error do you get?
I changed from bmp to png and it's still a black screen on my 3ds but now works 100% fine on citraTry to use JPG / PNG images and check if paths are fine.
what is exactly lua player plus and how install?
root/3ds/example/example.3dsx
white = Color.new(255, 255, 255)
num1 = 0
num2 = 0
operation = 1
answer = 0
remainder = 0
oldpad = Controls.read()
uparrow = Screen.loadImage("/up.png")
downarrow = Screen.loadImage("/down.png")
while true do
Screen.refresh()
pad = Controls.read()
x,y = Controls.readTouch()
Screen.clear(TOP_SCREEN)
Screen.clear(BOTTOM_SCREEN)
if (Controls.check(pad,KEY_DUP)) and not (Controls.check(oldpad,KEY_DUP)) then
num1 = num1 + 1
end
if (Controls.check(pad,KEY_DDOWN)) and not (Controls.check(oldpad,KEY_DDOWN)) then
num1 = num1 - 1
end
if (Controls.check(pad,KEY_DRIGHT)) and not (Controls.check(oldpad,KEY_DRIGHT)) then
num2 = num2 + 1
end
if (Controls.check(pad,KEY_DLEFT)) and not (Controls.check(oldpad,KEY_DLEFT)) then
num2 = num2 - 1
end
if(Controls.check(pad,KEY_TOUCH)) and not (Controls.check(oldpad, KEY_TOUCH)) then
x,y = Controls.readTouch()
if(x > 19) and (x < 99) and (y > 30) and (y < 55) then
num1 = num1 + 1
elseif(x > 19) and (x < 99) and (y > 160) and (y < 185) then
num1 = num1 - 1
elseif(x > 119) and (x < 199) and (y > 30) and (y < 55) then
if operation == 5 then
operation = 1
else
operation = operation + 1
end
elseif(x > 119) and (x < 199) and (y > 160) and (y < 185) then
if operation == 1 then
operation = 5
else
operation = operation - 1
end
elseif(x > 219) and (x < 299) and (y > 30) and (y < 55) then
num2 = num2 + 1
elseif(x > 219) and (x < 299) and (y > 160) and (y < 185) then
num2 = num2 - 1
end
end
if (Controls.check(pad,KEY_A)) and not (Controls.check(oldpad,KEY_A)) then
operation = 1
answer = num1 + num2
end
if (Controls.check(pad,KEY_B)) and not (Controls.check(oldpad,KEY_B)) then
operation = 2
answer = num1 - num2
end
if (Controls.check(pad,KEY_Y)) and not (Controls.check(oldpad,KEY_Y)) then
operation = 3
if num2 > 0 then
answer = num1 // num2
remainder = num1 % num2
end
end
if (Controls.check(pad,KEY_X)) and not (Controls.check(oldpad,KEY_X)) then
operation = 4
answer = num1 * num2
end
if (Controls.check(pad,KEY_SELECT)) and not (Controls.check(oldpad,KEY_SELECT)) then
operation = 5
answer = num1 ^ num2
end
if (Controls.check(pad, KEY_START)) then
System.exit()
end
if(Controls.check(pad,KEY_TOUCH)) then
x,y = Controls.readTouch()
if(x > 19) and (x < 99) and (y > 30) and (y < 55) then
Screen.drawImage(20,33,uparrow,BOTTOM_SCREEN)
Screen.drawImage(120,31,uparrow,BOTTOM_SCREEN)
Screen.drawImage(220,31,uparrow,BOTTOM_SCREEN)
Screen.drawImage(20,161,downarrow,BOTTOM_SCREEN)
Screen.drawImage(120,161,downarrow,BOTTOM_SCREEN)
Screen.drawImage(220,161,downarrow,BOTTOM_SCREEN)
elseif(x > 19) and (x < 99) and (y > 160) and (y < 185) then
Screen.drawImage(20,163,downarrow,BOTTOM_SCREEN)
Screen.drawImage(20,31,uparrow,BOTTOM_SCREEN)
Screen.drawImage(120,31,uparrow,BOTTOM_SCREEN)
Screen.drawImage(220,31,uparrow,BOTTOM_SCREEN)
Screen.drawImage(120,161,downarrow,BOTTOM_SCREEN)
Screen.drawImage(220,161,downarrow,BOTTOM_SCREEN)
elseif(x > 119) and (x < 199) and (y > 30) and (y < 55) then
Screen.drawImage(120,33,uparrow,BOTTOM_SCREEN)
Screen.drawImage(20,31,uparrow,BOTTOM_SCREEN)
Screen.drawImage(220,31,uparrow,BOTTOM_SCREEN)
Screen.drawImage(20,161,downarrow,BOTTOM_SCREEN)
Screen.drawImage(120,161,downarrow,BOTTOM_SCREEN)
Screen.drawImage(220,161,downarrow,BOTTOM_SCREEN)
elseif(x > 119) and (x < 199) and (y > 160) and (y < 185) then
Screen.drawImage(120,163,downarrow,BOTTOM_SCREEN)
Screen.drawImage(20,31,uparrow,BOTTOM_SCREEN)
Screen.drawImage(120,31,uparrow,BOTTOM_SCREEN)
Screen.drawImage(220,31,uparrow,BOTTOM_SCREEN)
Screen.drawImage(20,161,downarrow,BOTTOM_SCREEN)
Screen.drawImage(220,161,downarrow,BOTTOM_SCREEN)
elseif(x > 219) and (x < 299) and (y > 30) and (y < 55) then
Screen.drawImage(220,33,uparrow,BOTTOM_SCREEN)
Screen.drawImage(20,31,uparrow,BOTTOM_SCREEN)
Screen.drawImage(120,31,uparrow,BOTTOM_SCREEN)
Screen.drawImage(20,161,downarrow,BOTTOM_SCREEN)
Screen.drawImage(120,161,downarrow,BOTTOM_SCREEN)
Screen.drawImage(220,161,downarrow,BOTTOM_SCREEN)
elseif(x > 219) and (x < 299) and (y > 160) and (y < 185) then
Screen.drawImage(220,163,downarrow,BOTTOM_SCREEN)
Screen.drawImage(20,31,uparrow,BOTTOM_SCREEN)
Screen.drawImage(120,31,uparrow,BOTTOM_SCREEN)
Screen.drawImage(220,31,uparrow,BOTTOM_SCREEN)
Screen.drawImage(20,161,downarrow,BOTTOM_SCREEN)
Screen.drawImage(120,161,downarrow,BOTTOM_SCREEN)
else
Screen.drawImage(20,31,uparrow,BOTTOM_SCREEN)
Screen.drawImage(120,31,uparrow,BOTTOM_SCREEN)
Screen.drawImage(220,31,uparrow,BOTTOM_SCREEN)
Screen.drawImage(20,161,downarrow,BOTTOM_SCREEN)
Screen.drawImage(120,161,downarrow,BOTTOM_SCREEN)
Screen.drawImage(220,161,downarrow,BOTTOM_SCREEN)
end
else
Screen.drawImage(20,31,uparrow,BOTTOM_SCREEN)
Screen.drawImage(120,31,uparrow,BOTTOM_SCREEN)
Screen.drawImage(220,31,uparrow,BOTTOM_SCREEN)
Screen.drawImage(20,161,downarrow,BOTTOM_SCREEN)
Screen.drawImage(120,161,downarrow,BOTTOM_SCREEN)
Screen.drawImage(220,161,downarrow,BOTTOM_SCREEN)
end
if operation == 1 then
answer = num1 + num2
Screen.debugPrint(0,30,num1 .. " + " .. num2 .. " = " .. answer,white,TOP_SCREEN)
elseif operation == 2 then
answer = num1 - num2
Screen.debugPrint(0,30,num1 .. " - " .. num2 .. " = " .. answer,white,TOP_SCREEN)
elseif operation == 3 then
if num2 ~= 0 then
answer = num1 // num2
remainder = num1 % num2
if remainder ~= 0 then
Screen.debugPrint(0,30,num1 .. " / " .. num2 .. " = " .. answer .. "r" .. remainder,white,TOP_SCREEN)
else
Screen.debugPrint(0,30,num1 .. " / " .. num2 .. " = " .. answer,white,TOP_SCREEN)
end
else
Screen.debugPrint(0,30,num1 .. " / " .. num2 .. " = UNDEFINED",white,TOP_SCREEN)
end
elseif operation == 4 then
answer = num1 * num2
Screen.debugPrint(0,30,num1 .. " x " .. num2 .. " = " .. answer,white,TOP_SCREEN)
elseif operation == 5 then
answer = num1 ^ num2
Screen.debugPrint(0,30,num1 .. "^" .. num2 .. " = " .. answer,white,TOP_SCREEN)
end
Screen.flip()
oldpad = pad
Screen.waitVblankStart()
end
So I changed the bmp to png and added some new code and it works fine on citra but still just shows a black screen on my 3DS...
-snip-
Here's up.ong and down.png if you need it: http://imgur.com/a/syCtr
-snip-
I had the same problem. You need to use the absolute path for files.
you could try 'dofile(System.currentDirectory().."/graphics_and_controls.lua")'.
From page 15 of this thread.
Try to use JPG / PNG images and check if paths are fine.
This is trying to load the images from the root of the SD card, which is probably not where they are when you use a .3dsx. Try this:
Code:uparrow = Screen.loadImage(System.currentDirectory().."/up.bmp") downarrow = Screen.loadImage(System.currentDirectory().."/down.bmp")
I'm scrolling back in the post and I can't see a single one of those posts :/You've been responded to multiple times with solutions to your issue:
I'm scrolling back in the post and I can't see a single one of those posts :/
Either way thanks!


