DSLua Community
Welcome, Guest. Please login or register.
May 21, 2012, 08:55:13 PM
1371 Posts in 262 Topics by 33109 Members
Latest Member: Limewire Download
DSLua Community  |  DSLua - Best scripting language for Nintendo DS  |  Need Help?  |  Bit of help « previous next »
Pages: [1]
Author Topic: Bit of help  (Read 2260 times)
Hass
New Moon
*
Posts: 3


« on: August 28, 2007, 05:15:21 PM »

Ok, so I'm pretty much a newbie at this, and was taking some time to try and get things working. I've coded with BASIC before, and a lot of the ideas were obviously familiar to me. However, I got my program working on my DS, managing to load the background, and using the touch screen functions. However, when i added something, it caused me to get only a black screen and nothing else. When I tried the backup copy I'd save before I made any adjustments, I also got the black screen. Any help? The code is below, and I'm using a CycloDS Evolution card. If there is simply an error in the code, that'd be nice to know too. As I say, all I get is a black screen, although it was previously working fine.

Quote
SCREEN_BOTTOM = 0
SCREEN_TOP = 1
BGTopText = Screen.LoadTextBG() Screen.Initialize( SCREEN_TOP, BGTopText )
BGBotMap = Screen.LoadTileBG()
BGBotMap:LoadPalette( "background.pal" )
BGBotMap:LoadTiles( "background.raw", 256 ) -- 256 colours
BGBotMap:LoadMap( "background.map", (256 / 8 ), ( 192 / 8 ) )
Screen.Initialize( SCREEN_BOTTOM, BGBotMap )

BGTopText:PrintXY( 10, 10, "Crime Scene Alpha" )

-- Main code below


while Pads.Start() == false do
if Stylus.Down() then
          touchscreenpressed = true
          stylusx = Stylus.X()
          stylusy = Stylus.Y()
          styluslifted = false
else
          if touchscreenpressed then
                    styluslifted = true
          end
          touchscreenpressed = false
end

if styluslifted then
   if stylusx >= 193 and stylusx <= 215 and stylusy <= 101 and stylusy >= 60 then
        BGTopText:PrintXY( 1, 1, "Hmm, a bottle." )
       
end
Logged
Jryvn
New Moon
*
Posts: 3


« Reply #1 on: August 28, 2007, 05:44:05 PM »

This may help.

1.  line 3 should be split up into two lines, between LoadTextBG() and Screen.Initialize

2. you need end statements for every  if/then/else statement and the while loop even if it just contains one statement in between.
Logged
Jeremysr
First Quarter
***
Posts: 215



WWW
« Reply #2 on: August 28, 2007, 10:40:51 PM »

I don't see any problem other than the missing end statements like Jryvn said. It should probably show an error if that's wrong (I'm not 100% sure it's wrong, but I'm.. pretty sure). Maybe try it in different versions of DSLua (0.6 and 0.7) to see if it's a problem with DSLua. DSLua 0.7 has quite a few bugs actually. (The next version should be much better by the way.)

Quote from: Jryvn
1.  line 3 should be split up into two lines, between LoadTextBG() and Screen.Initialize

Line breaks don't do anything in DSLua, you could have an entire program written on one line with just spaces seperating the "lines" of code. Tongue That's why I use lines like "while not Pads.A() do end".
Logged
daltonlaffs
First Quarter
***
Posts: 189


Freaking Insane


WWW
« Reply #3 on: August 29, 2007, 03:42:01 PM »

That's something I'm having trouble figuring out. There's normally an error report system, but in 0.7, I think there was a compiling mistake. It shows a black screen instead of the error. That'll be fixed in the next version.
Logged

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



^^ That works, I SWEAR! ^^
Hass
New Moon
*
Posts: 3


« Reply #4 on: August 29, 2007, 06:48:55 PM »

Ok, so its just a problem with 0.7? Or a problem with my code? If I add the end statements it should, hypothetically, work?
Logged
Jeremysr
First Quarter
***
Posts: 215



WWW
« Reply #5 on: August 29, 2007, 09:19:33 PM »

It's a problem with both I think, according to daltonlaffs. 0.7 displays black screens instead of errors, and you not "end"ing your if statements is causing the "error screen". So yeah, it should work if you add end statements to all your while/if statements.
Logged
Hass
New Moon
*
Posts: 3


« Reply #6 on: August 30, 2007, 08:04:23 PM »

Aight, go it working. Next problem  Wink

using this:

Background16Bit = Screen.Load16BitBG()  (i imagine next would go...)
Screen.Initialize( 1, Background16Bit ) (alright, but how do i then load the actual BMP image into the program?)
Logged
Jeremysr
First Quarter
***
Posts: 215



WWW
« Reply #7 on: August 30, 2007, 08:59:03 PM »

First use the I/O library and load the image file into a string. Use the binary mode ("rb"). Then use one of the Image functions to copy the stored image onto the screen. By the way I think one of the image-loading functions doesn't work, but I don't remember which one. Tongue
Logged
daltonlaffs
First Quarter
***
Posts: 189


Freaking Insane


WWW
« Reply #8 on: August 31, 2007, 06:29:44 AM »

They all work, but they freeze for no reason sometimes. I have no idea...  Huh
Logged

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



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