Thursday, 08 January 2009
 
  Home arrow Forum  
Main Menu
Home
News
Forum
Documentation
Download
Links
Administrator
Login Form
Welcome, Guest. Please login or register.
January 08, 2009, 02:48:19 PM
Username: Password:
Login with username, password and session length

Forgot your password?
got a problem with my code
DSLua Community
Welcome, Guest. Please login or register.
January 08, 2009, 02:48:19 PM
1724 Posts in 316 Topics by 10304 Members
Latest Member: Optopsity
DSLua Community  |  DSLua - Best scripting language for Nintendo DS  |  Need Help?  |  got a problem with my code « previous next »
Pages: [1]
Author Topic: got a problem with my code  (Read 791 times)
sllide
New Moon
*
Posts: 5


« on: June 08, 2008, 02:44:54 PM »

i dowloaded dslua 0.7 this morning
and i'm bussy all day to get this code to work

SCREEN_BOTTOM = 1
BGBot8Bit = Screen.Load8BitBG()
BGBotText = Screen.LoadTextBG()
Screen.Initialize(SCREEN_BOTTOM,BGBotText,BGBot8Bit)

x = 0
y = 0
BGTopText:PrintXY(0,0,"generating")
while x ~= 31 and y ~= 23
   BGBot8Bit:Plot(x,y,random(0,1,2,3,4,5,6,7,8,9))
   
   if x == 31
      y + 1
      x = 0
   else
      x + 1
   end
end
BGbottext:clear()
DSLua.WaitForAnyKey()

what did i do wrong?
Logged
Jeremysr
Waxing Gibbous
****
Posts: 254



WWW
« Reply #1 on: June 08, 2008, 05:52:35 PM »

The second-last line is the problem. BGbottext:clear() should be BGBotText:Clear().

Also, the "y + 1" and "x + 1" lines won't do anything, I think you want to put "y = y + 1" and "x = x + 1".
Logged
sllide
New Moon
*
Posts: 5


« Reply #2 on: June 09, 2008, 03:05:17 PM »

ok did what u say but still isnt working

and i changed the code a bit i thought this maiby worked -.-

BGBot8Bit = Screen.Load8BitBG()
Screen.Initialize( SCREEN_BOTTOM, BGBot8Bit)

BGBot8Bit:SetPaletteColor( CA, 31, 0, 0 )
BGBot8Bit:SetPaletteColor( CB, 0, 31, 0 )
BGBot8Bit:SetPaletteColor( CC, 0, 0, 31 )
BGBot8Bit:SetPaletteColor( CD, 31, 15, 0 )
BGBot8Bit:SetPaletteColor( CE, 31, 31, 0 )
BGBot8Bit:SetPaletteColor( CF, 15, 15, 15 )
BGBot8Bit:SetPaletteColor( CG, 31, 31, 31 )

X = 0
Y = 0
while X ~= 31 and Y ~= 23
   BGBot8Bit:Plot( X, Y, Random(CA,CB,CC,CD,CE,CF,CG))
   
   if X == 31
      Y = Y + 1
      X = 0
   else
      X = X + 1
   end
end
DSLua.WaitForAnyKey()
« Last Edit: June 09, 2008, 04:46:19 PM by sllide » Logged
Jeremysr
Waxing Gibbous
****
Posts: 254



WWW
« Reply #3 on: June 09, 2008, 05:31:36 PM »

All you need, I think, for that code to work is to give all your colours values like this:

CA = 0
CB = 1
CC = 2
CD = 3
CE = 4
CF = 5
CG = 6
Logged
sllide
New Moon
*
Posts: 5


« Reply #4 on: June 10, 2008, 09:46:30 AM »

DAMN still doesnt work

BGBot8Bit = Screen.Load8BitBG()
Screen.Initialize( SCREEN_BOTTOM, BGBot8Bit)

BGBot8Bit:SetPaletteColor( 0, 31, 0, 0 )
BGBot8Bit:SetPaletteColor( 1, 0, 31, 0 )
BGBot8Bit:SetPaletteColor( 2, 0, 0, 31 )
BGBot8Bit:SetPaletteColor( 3, 31, 15, 0 )
BGBot8Bit:SetPaletteColor( 4, 31, 31, 0 )
BGBot8Bit:SetPaletteColor( 5, 15, 15, 15 )
BGBot8Bit:SetPaletteColor( 6, 31, 31, 31 )

X = 0
Y = 0
while X ~= 31 and Y ~= 23
   BGBot8Bit:Plot( X, Y, Random( 0, 1, 2, 3, 4, 5, 6))
   
   if X == 31
      Y = Y + 1
      X = 0
   else
      X = X + 1
   end
end
DSLua.WaitForAnyKey()

u try it
maiby what kind of flash-card u have matters

and is there something similar to dslua but with a in-game editor?
« Last Edit: June 10, 2008, 12:51:06 PM by sllide » Logged
Pages: [1]
« previous next »
    Jump to:  



    (C) 2009 DSLua

    DSLua - Best scripting language for Nintendo DS home-brew!