DSLua Community

DSLua - Best scripting language for Nintendo DS => Examples/Tutorials => Topic started by: ryo@japan on January 01, 2008, 11:19:10 PM



Title: Jeremysr's "Hangman 1.0"
Post by: ryo@japan on January 01, 2008, 11:19:10 PM
Hello!  I'm posting from Japan.
Happy new years to every one!

I've been running some DSLua scripts including those made by Jeremysr, for a coupple of days.
(I'm a newbe for DSLua and NDS homebrew programming.)
My environment is:

  NDS Lite -- Ice Blue (just in case ;))
  M3DSREAL -- a Slot-1 device with 2GB microSD (SANDISK)
  Rumble RAM Pack -- which comes with M3DSREAL
  running DSLua 0.7 ;D

At the first try, I could load the script, but couldn't go on from "Press START to --" message. :'(
If I press START, nothing appears on the BOTTOM SCREEN.

So, I edited Jeremysr's scripts, a little.
I inserted

Code:
Screen.Initialize( SCREEN_BOTTOM, BGBotText )

at the begging of "Start Game" paragraph.

It worked OK.
Now, BOTTOM SCREEN displayed 26 characters and "Please select a letter." caption.

I played a little, then hit A-Button to quit.
But, the script went on, showing another quiz. ???
After playing that, I could quit the game with hitting A-Button again.

Somehow, loop didn't work properly in the game script.

So, I went back to the script, and at close to the very end, inserted a line:

Code:
DSLua.WaitForAnyKey() 

right before "if Pads.A() then" statement.

This patch solved the timing problem with the while loop.   So it seemed to me.

I played along a little more.  Quit the game and replayed it, then I encountered another problem.
The TOP SCREEN doesn't show texts. :-\

I went back to the script again.  Inserted

Code:
Screen.Initialize( SCREEN_TOP, BGTopText, BGTop8Bit )

statement right after the "while not quit do" loop (main game loop).
This fixed the TOP SCREEN problem.

I'm not sure if above are DSLua problems or hardware specific problems.
Anyway, "Hangman 1.0" works fine on my NDS now.  :)

---
btw, I thougt it a good measure to insert DSLua.WaitForAnyKey() statement into a while loop, when you are waiting for a Key press.  I guess this will save CPU usage and memory access at the same time. Seems better to ensure you catch the button-down event.

Many thanks to Jeremysr, sharing great scripts.\(^o^)/

ryo@japan