DSLua Community
Welcome, Guest. Please login or register.
May 18, 2012, 10:04:01 PM
1371 Posts in 262 Topics by 33109 Members
Latest Member: Limewire Download
DSLua Community  |  DSLua - Best scripting language for Nintendo DS  |  Need Help?  |  getting errors. « previous next »
Pages: [1]
Author Topic: getting errors.  (Read 1425 times)
brennan
Waxing Crescent
**
Posts: 41


WWW
« on: January 04, 2007, 09:28:54 PM »

I'm getting an error:

Quote
"then" expected near Character

Code:
SCREEN_TOP = 1
SCREEN_BOTTOM = 0
Screen.Initialize( SCREEN_TOP, BGTopText )
Sprite.LoadPalette( SCREEN_TOP, PALETTE_GAIM, "sprite.pal" )

Character = PALLETE_GAIM

Character = { X = 0, Y = 0 }
function Character.MoveLeft()
     Character.X = Character.X - 1
end

Character = { X = 0, Y = 0 }
function Character.MoveRight()
     Character.X = Character.X + 1
end

Character = { X = 0, Y = 0 }
function Character.MoveUp()
     Character.Y = Character.Y + 1
end

Character = { X = 0, Y = 0 }
function Character.MoveDown()
     Character.Y = Character.Y - 1
end

while true do
if Pads.Left() then
Character.MoveLeft()
end

if Pads.Right() then
Character.MoveRight()
end

if Pads.Up() then
Character.MoveUp()
end

if Pads.Down()
Character.MoveDown()
end

if Pads.Start() then
break
end
end

I'm just throwing this together to get the hang of moving a sprite around, but all the errors that I've gotten so far have had nothing to do with moving the sprite, just general coding errors. I'm kinda getting disappointed :/
Logged
Jeremysr
First Quarter
***
Posts: 215



WWW
« Reply #1 on: January 04, 2007, 10:05:45 PM »

Near the bottom you have "if Pads.Down()" instead of "if Pads.Down() then". Remember to use the line number in the error (appears as "blahblah:103:blahblah" where the line number is inbetween :'s) and then look around that line number for mistakes.

And unless that's only part of your program you'll get other errors because you didn't put values into PALLETE_GAIM anywhere, or BGTopText.
Logged
brennan
Waxing Crescent
**
Posts: 41


WWW
« Reply #2 on: January 05, 2007, 06:19:02 PM »

Yeah, I've added all that stuff since posting this. Thanks, I never noticed that number was the line number >_>
Logged
Pages: [1]
« previous next »
    Jump to: