DSLua Community
Welcome, Guest. Please login or register.
May 18, 2012, 09:15:58 PM
1371 Posts in 262 Topics by 33109 Members
Latest Member: Limewire Download
DSLua Community  |  DSLua - Best scripting language for Nintendo DS  |  Need Help?  |  Key presses help « previous next »
Pages: [1]
Author Topic: Key presses help  (Read 1529 times)
LeightonW87
Waxing Crescent
**
Posts: 17


« on: July 18, 2006, 04:51:34 PM »

Could someone give me a list of the commands for the WaitFor commands or how can I do IF a certin Key is pressed?? Cheesy

Thanks, Leighton Cheesy
Logged
LeightonW87
Waxing Crescent
**
Posts: 17


« Reply #1 on: July 18, 2006, 05:09:15 PM »

Evil IF command, DIE!!!  Angry

Anyway, why wont this work!!

Code:
SCREEN_BOTTOM = 0
SCREEN_TOP = 1
MENU_OPT = 1

-- setting backgrounds up
--
BGTOPTEXT = Screen.LoadTextBG()

-- INIT TOP SCREEN
Screen.Initialize( SCREEN_TOP, BGTOPTEXT )
-- SET DA COLOR 2 YELLAH!!!
BGTOPTEXT:SetColor( 150, 0, 150, 0 )
-- print text to screen
BGTOPTEXT:PrintXY ( 0, 1, "This is a TEST!" )
BGTOPTEXT:PrintXY ( 0, 2, "Modded by Daltonlaffs " )

loop
if MENU_OPT = 1 then
BGTOPTEXT:SetColor( 200, 0, 200, 0 )
BGTOPTEXT:PrintXY ( 0, 10, "This is a TEST!" )
return
Logged
daltonlaffs
First Quarter
***
Posts: 189


Freaking Insane


WWW
« Reply #2 on: July 18, 2006, 06:20:49 PM »

Wow, you REALLY are quick with the questions... I'm workin... workin...

OK, first off, NEVER EVER EVER use the loop command! It sucks! Use While True Do instead! Here, I fixed it again:

Code:
SCREEN_BOTTOM = 0
SCREEN_TOP = 1
LOOPON = 1

-- setting backgrounds up
--
BGTOPTEXT = Screen.LoadTextBG()

-- INIT TOP SCREEN
Screen.Initialize( SCREEN_TOP, BGTOPTEXT )
-- SET DA COLOR 2 YELLAH!!!
BGTOPTEXT:SetColor( 150, 0, 150, 0 )
-- print text to screen
BGTOPTEXT:PrintXY ( 0, 1, "This is a TEST!" )
BGTOPTEXT:PrintXY ( 0, 2, "Modded by Daltonlaffs " )

while true do
if LOOPON == 1 then
BGTOPTEXT:SetColor( 200, 0, 200, 0 )
BGTOPTEXT:PrintXY ( 0, 10, "This is a TEST!" )
end
-- and now if you press B, LOOPON equals 2!
if Pads.B() then
LOOPON = 2
end
-- Now if LOOPON = 2, end the program!
if LOOPON == 2 then
break
end
end
Logged

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



^^ That works, I SWEAR! ^^
daltonlaffs
First Quarter
***
Posts: 189


Freaking Insane


WWW
« Reply #3 on: July 18, 2006, 06:22:32 PM »

PS. Oh yeah, and if you are COMPARING NUMBERS (if value = 5) then use a DOUBLE EQUALS! (==)

But if you are CHANGING a value, use one equals. Enjoy!
Logged

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



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


« Reply #4 on: July 18, 2006, 06:48:48 PM »

Thanks, I'm just getting started with the Questions though. Cheesy
(I guess I'll need more help tomorrow Grin
Logged
Pages: [1]
« previous next »
    Jump to: