DSLua Community
Welcome, Guest. Please login or register.
September 08, 2010, 09:07:31 PM
1371 Posts in 262 Topics by 33109 Members
Latest Member: Limewire Download
DSLua Community  |  General DS Programming Chats  |  Test Area  |  Need help in fixing bugs, « previous next »
Pages: [1]
Author Topic: Need help in fixing bugs,  (Read 4296 times)
LeightonW87
Waxing Crescent
**
Posts: 17


« on: July 19, 2006, 02:15:57 PM »

could people help me fix and find bugs in my script. Wink
If you do feel like helping me, go here to get the NDS file that has the script, the script is called menu.lua Cheesy

http://lw-game-site.sitesled.com/dslua.html

also, I know about the text on the bottom of the screen, i'll also add the script here to (sorry about the lack of comments in the code) Sad

Code:
- SCREEN ARRAYS --
SCREEN_BOTTOM = 0
LOOPON = 1
MENU = 0
MENU_OPTION = 1

-- THIS SETS THE BOTTOM SCREEN UP --
BGBotText = Screen.LoadTextBG()
Screen.Initialize( SCREEN_BOTTOM, BGBotText )

-- Sets up Mod for playback --
ModDK2      = Music.LoadMod( "dk2.mod" )
bModPlaying = true
ModDK2:Play()

-- delay n seconds
function delay( seconds )
    local initialTime = DSLua.VBlankCount()
    local actualTime = initialTime
    local ticks = seconds / 0.0167224 -- a tick is a 1 / 59.8 of a second
    while ( actualTime - initialTime ) < ticks do
        Screen.WaitForVBL()
        actualTime = DSLua.VBlankCount()
    end
end

-- INFO TEXT --

while true do
BGBotText:SetColor( 200, 0, 200, 0 )
BGBotText:PrintXY( 0, 19, "Touch the screen to continue... ")
if LOOPON == 1 and Stylus.Down() then
-- clear the text screen
BGBotText:Clear()
LOOPON = 0
MENU = 1
-- clear the text screen
BGBotText:Clear()
end
-- Open the Menu  (TEXT PART)  --

if MENU == 1 then
BGBotText:SetColor( 150, 0, 150, 0 )
BGBotText:PrintXY( 4, 1, "A Menu by" )
BGBotText:PrintXY( 0, 2, "Leighton Williams" )
end
delay( 0.1 )
if Pads.Up() then
MENU_OPTION = MENU_OPTION - 1
end
if Pads.Down() then
MENU_OPTION = MENU_OPTION + 1
end
if MENU_OPTION == 1 and MENU == 1 then
BGBotText:SetColor ( 5 )
BGBotText:PrintXY( 0, 10, "START MUSIC" )

BGBotText:SetColor ( 4 )
BGBotText:PrintXY( 0, 11, "PAUSE MUSIC" )

BGBotText:SetColor ( 4 )
BGBotText:PrintXY( 0, 12, "STOP MUSIC" )

BGBotText:SetColor ( 4 )
BGBotText:PrintXY( 0, 13, "EXIT BACK TO LUA" )
end
if MENU_OPTION == 2 and MENU == 1 then
BGBotText:SetColor ( 4 )
BGBotText:PrintXY( 0, 10, "START MUSIC" )

BGBotText:SetColor ( 5 )
BGBotText:PrintXY( 0, 11, "PAUSE MUSIC" )

BGBotText:SetColor ( 4 )
BGBotText:PrintXY( 0, 12, "STOP MUSIC" )

BGBotText:SetColor ( 4 )
BGBotText:PrintXY( 0, 13, "EXIT BACK TO LUA" )
end
if MENU_OPTION == 3 and MENU == 1 then
BGBotText:SetColor ( 4 )
BGBotText:PrintXY( 0, 10, "START MUSIC" )

BGBotText:SetColor ( 4 )
BGBotText:PrintXY( 0, 11, "PAUSE MUSIC" )

BGBotText:SetColor ( 5 )
BGBotText:PrintXY( 0, 12, "STOP MUSIC" )

BGBotText:SetColor ( 4 )
BGBotText:PrintXY( 0, 13, "EXIT BACK TO LUA" )
end
if MENU_OPTION == 4 and MENU == 1 then
BGBotText:SetColor ( 4 )
BGBotText:PrintXY( 0, 10, "START MUSIC" )

BGBotText:SetColor ( 4 )
BGBotText:PrintXY( 0, 11, "PAUSE MUSIC" )

BGBotText:SetColor ( 4 )
BGBotText:PrintXY( 0, 12, "STOP MUSIC" )

BGBotText:SetColor ( 5 )
BGBotText:PrintXY( 0, 13, "EXIT BACK TO LUA" )
end
if MENU_OPTION == 0 then
MENU_OPTION = 1
end
if MENU_OPTION == 5 then
MENU_OPTION = 4
end
delay ( 0.1 )
if MENU_OPTION == 1 and Pads.A() then
    bModPlaying = ( not bModPlaying )
    if bModPlaying == false then
    bModPlaying = true
      ModDK2:Play()
    end
    elseif MENU_OPTION == 2 and Pads.A() then
    bModPlaying = ( bModPlaying )
    if bModPlaying == true then
    bModPlaying = false
      ModDK2:Pause()
end
    elseif MENU_OPTION == 3 and Pads.A() then
    bModPlaying = ( bModPlaying )
    if bModPlaying == true then
    bModPlaying = false
      ModDK2:Stop()
    end
    elseif MENU_OPTION == 4 and Pads.A() then
    break
  end
if LOOPON == 2 then
break
end
Screen.WaitForVBL()
end
Logged
daltonlaffs
First Quarter
***
Posts: 189


Freaking Insane


WWW
« Reply #1 on: July 19, 2006, 04:16:45 PM »

What's wrong with it? It works when I download it!
Logged

Code:
-- Bored? Read code line below.
-- Bored? Read code line above.



^^ That works, I SWEAR! ^^
LeightonW87
Waxing Crescent
**
Posts: 17


« Reply #2 on: July 19, 2006, 05:42:26 PM »

Did you try it on a ds, I can't do that myself yet, :sigh:

I have FW 4  Cry
I need to sort out saving money up for a supercard and passme2 or M3 ( Think thats what I need )
Logged
daltonlaffs
First Quarter
***
Posts: 189


Freaking Insane


WWW
« Reply #3 on: July 19, 2006, 06:14:59 PM »

On August 9th, I'm getting a Flash Cart. And I already have WifiMe. I'll test it for you then! However, usually the emulators are pretty close to actual DS output, so it SHOULD work.
Logged

Code:
-- Bored? Read code line below.
-- Bored? Read code line above.



^^ That works, I SWEAR! ^^
brennan
Waxing Crescent
**
Posts: 41


WWW
« Reply #4 on: July 20, 2006, 03:17:53 PM »

I'm getting an .nds file...? Don't I need the .lua?
Logged
LeightonW87
Waxing Crescent
**
Posts: 17


« Reply #5 on: July 20, 2006, 03:27:16 PM »

You open that in a emulator, I use Dualis 20.3, not sure how you run it on a NDS flashcart
Logged
brennan
Waxing Crescent
**
Posts: 41


WWW
« Reply #6 on: July 20, 2006, 03:33:12 PM »

To run it on hardware, I need a .lua file. I then open the .lua in DSlua.nds .
Logged
LeightonW87
Waxing Crescent
**
Posts: 17


« Reply #7 on: July 20, 2006, 04:34:56 PM »

open that in the flashcart menu and it should work, there is a mod file so if I give just the script it may not work.
Logged
daltonlaffs
First Quarter
***
Posts: 189


Freaking Insane


WWW
« Reply #8 on: July 20, 2006, 06:50:41 PM »

You open that in a emulator, I use Dualis 20.3, not sure how you run it on a NDS flashcart
To run it on hardware, I need a .lua file. I then open the .lua in DSlua.nds .
open that in the flashcart menu and it should work, there is a mod file so if I give just the script it may not work.

Let's clarify for you all. There are different KINDS of hardware supports. GBFS was designed so that most types of hardware would work with a packed ROM. If you use a flashcart system, you should use GBFS. However, there is also the CF type. CF can access any files in the same directory, so if you put a script in the same directory as DSLua.nds, you could load the script without packing it. However, any other required files (Sprites, music, etc) must also be included in the same directory. So brendan, you are using CF, right? Right. But I am gonna use WifiMe + Flashcart, so I must use GBFS.

That's all!
Logged

Code:
-- Bored? Read code line below.
-- Bored? Read code line above.



^^ That works, I SWEAR! ^^
Pages: [1]
« previous next »
    Jump to: