PDA

View Full Version : DS Lua Tutorials



Junixx
September 4th, 2006, 05:13
Hey, Jeremysr over on the DS Lua forums has started a tutorial page from what he knows about DS Lua, I've read it and its helped me so if anyone is interested take a look:

http://www.bio-gaming.com/jeremy/dslua/index.php?act=tutorials

Take note that it's not finished yet, he said (As of now) that hes working on the Background & Sprite section of it, he said it would also be a long tutorial. (but it would help me alot :) )

andysjones
September 4th, 2006, 18:24
Thanks. I might try and get into this Ds Lua stuff. Is it hard to do?

Junixx
September 4th, 2006, 18:25
It's not too hard to get into once you get the hang of it . I'm waiting for the BAckgrounds & Sprites section to get finished and maybe i can actuaully get something...i have an idea for a game but i dont know if it will work or not

RadioPunker
September 4th, 2006, 20:17
Wow, never have had so many errors in such little lines of code. And then I have to put my sd card back into the usb reader and do that process again just to test it. Totally worth it though, made my first hello world program! :D The stylus imput is way easier than I thought it would be. Here is my source code for my tiny little program that puts a message if the user presses the stylus or presses A,B,X,or Y buttons. It ends with the press of the start button. Thought it might help some confused people, maybe.


SCREEN_TOP = 1
SCREEN_BOT = 0
BGTopText = Screen.LoadTextBG()
BGBotText = Screen.LoadTextBG()
Screen.Initialize( SCREEN_TOP, BGTopText )
Screen.Initialize( SCREEN_BOT, BGBotText )
while Pads.Start() == false do
if Stylus.Down() then
BGBotText:SetColor( 6 )
BGBotText:PrintXY( 10, 12, "You used your stylus!" )
end
if Pads.A() then
BGTopText:SetColor( 5 )
BGTopText:PrintXY ( 10, 12, "A" )
end
if Pads.B() then
BGTopText:SetColor( 2 )
BGTopText:PrintXY ( 10, 12, "B" )
end
if Pads.X() then
BGTopText:SetColor( 1 )
BGTopText:PrintXY ( 10, 12, "X" )
end
if Pads.Y() then
BGTopText:SetColor( 3 )
BGTopText:PrintXY ( 10, 12, "Y" )
end
end

andysjones
September 4th, 2006, 21:34
The code looks pretty simple. I dont know if I will be able to do anything good for ages. Im just learning Java at university at the moment, going into second year now.

Jeremysr
September 4th, 2006, 23:55
Thanks for posting this CPU_Smarts! Now I know why my hidden page counters on each page were going up so fast...I'm glad I could help so many people to start using DSLua, that was my goal. :D

Junixx
September 5th, 2006, 01:07
I acctaully think the counter started going up before i posted it here, um, but i could use alittle help,

When I try to make a button using this

if stylusInBox( 80, 64, 142, 85 ) then
BGBotText:PrintXY( 10, 12, "You pressed the button!" )
end

But what happens is I'll load it up, press the button and it doesnt do anything, then I'll exit it and re-load the script it says "You Pressed the button!" without even pressing the button...

I'm quite confused about this...

brennxn
September 5th, 2006, 01:27
Heh, back when I was interested in learning Lua, there was next to no documentation; but now that I've moved on, this appears.

*sigh*

Maybe I'll whip a little something up, and post it on the DSlua forums.

Junixx
September 5th, 2006, 01:40
Heh, back when I was interested in learning Lua, there was next to no documentation; but now that I've moved on, this appears.

*sigh*

Maybe I'll whip a little something up, and post it on the DSlua forums.

Hah, same here but i got interested again when i saw some docs on it, but i just have to learn enough to pull of what i would like to do...

Jeremysr
September 5th, 2006, 05:49
I added a Sprites and Background Maps tutorial, the one I'm sure you've all being waiting for. :)

Junixx
September 6th, 2006, 00:05
Yay the sprite tut id finished....hmm....lol i might as well say i need everything (or well most) of the rest things, i took a look at the Snowball Battle lua game by Angor, turns out i think i need to use funtions to switch my screen and i couldn't figure out how they worked with that long script:confused:

:Edit:

I probably won't work on it tonight much because i've worked on it for the past 2 night almost constantly and i want to take a break so i wont get sick of it ;)

Jeremysr
September 6th, 2006, 01:01
I dunno if some of the tutorials are very necessary, because you can read all about lua at http://www.lua.org/pil

But DSLua is still a bit different.

The Hombrew Hunter
September 6th, 2006, 01:44
Yeah, I'll wait for it ALL to be finished, and make an updated-graphic Donkey Kong or sometin.

Junixx
September 6th, 2006, 01:59
Well i made my own sprite (16 frames 4 up/down/eft/right) with my wonderful paint skillz (hah yea right) and got it loaded and moving to the right...and moving..and going...and going...and going, jsut like the energizer bunny, but i cant seem to get it animated, once i do that I'll need to add controls to it....hrm...for another day though i suppose

Jeremysr
September 6th, 2006, 03:30
Yeah, I'll wait for it ALL to be finished, and make an updated-graphic Donkey Kong or sometin.

Unfortunately the creator of DSLua, waruwaru, has been gone for months, he seems to have dissappeared. We couldn't find him active on any sites that he was a member of (at least with the name waruwaru). But DSLua still works pretty good.

brennxn
September 6th, 2006, 03:46
I personally, would like to see the file I/O tut.

Junixx
September 6th, 2006, 04:03
Unfortunately the creator of DSLua, waruwaru, has been gone for months, he seems to have dissappeared. We couldn't find him active on any sites that he was a member of (at least with the name waruwaru). But DSLua still works pretty good.

Yea i wonder where could he be? i mean he wouldn't just abandon it without saying hes not working on it anymore/releasing the sources would he?

Anyway i got my menu partially working, I'm having a problem with the stylus inputs not working when i want them to.. :S

Jeremysr
September 6th, 2006, 04:21
I personally, would like to see the file I/O tut.

I'm still trying to figure it out...but daltonlaffs at the DSLua forums knows about them it seems like. So if I can't figure them out he'll help. :) But so far I think I'm probably doing them in order. BTW there is some i/o information here: http://www.lua.org/pil/21.html and there is some information in the examples, so look in there if you don't want to wait.

Junixx
September 6th, 2006, 04:25
Hm, for some reason i can't get to the DSLua forums, so i will just ask it here:

Is there a way to go back to part of the script? such as if you have a credits screen and you need to loop back to the main menu? I think there is a command to do this but i dont know it >.< please help

Jeremysr
September 6th, 2006, 04:48
There is no "GOTO" in lua, but one way to do things is put all the majour parts of your game each in their own function then call those functions. Or put your entire game in a while loop so that when you break out of the loop it will restart to the title screen.

Junixx
September 6th, 2006, 04:51
There is no "GOTO" in lua, but one way to do things is put all the majour parts of your game each in their own function then call those functions. Or put your entire game in a while loop so that when you break out of the loop it will restart to the title screen.

Hmm....darn :( i guess since i dont know how to use functions yet I'll try the while loop thing

:Edit:

TYVM! it works pefectly now :D

Jeremysr
September 6th, 2006, 04:54
Just wait...I'm writing the functions tutorial tonight. Functions are really easy to make and use. :)

Junixx
September 6th, 2006, 05:17
Alright :) i got the menu working with the while loop thing, which was much easier than i expected, but for the actual game i will need to use funtions because you will be pressing a button to shoot a gun...

:Edit:

I see funtions tut ^.^ looking at it right away!

Hm, looks like I should re-write the script so all of my functions are first and then the game starts after all of my functions have been set up, I will work on that tomorrow, thanks for the help functions ARE pretty easy :D

:Edit 2:

Yep thats what i have to do, i just looked at the Snowball battle game again and i acctualy understood some more of it, Angor made ALOT of functions then called them to be executed at the very end of the script

:Edit 3:

Ok i re-wrote my entire sctript using functions and now its ALOT more organized and the menu still works perfectly :) now to start the actual game once i get my sprites working...

Jeremysr
September 10th, 2006, 08:03
I wrote a User Information tutorial, it tells you how to get system information like the clock, the calendar, the users username, birthday, colour, language.......

Also, you might wanna look at the tutorials page ( http://www.bio-gaming.com/jeremy/dslua/index.php?act=tutorials ) and see what tutorial 8 is called. :)

Junixx
September 10th, 2006, 16:28
W00t Wi-Fi!

k_man316
September 16th, 2006, 03:25
Quick question, I've done Lua Development on the PSP before (check out Air Warriors if you can! :) ) and was wondering if DS Lua is essentially the same (as far as functionality?

If so, I'd love to port over my Air Warriors game and dev some other DS stuff.

Also, the DSLUA site is down, anyone know where else I can get the DS Lua progs from?

Thanks in advance!

yaustar
September 16th, 2006, 04:06
No it isn't. The core language is the same but the API/functionality is different.

Like with all programs, you need to understand the hardware that you are developing for. The DS hardware is rather unqiue similar to the GBA and therefore will seem extremely odd to people who are used to PSP's LuaPlayer.

DSLua uses the hardware of the DS, so you need to understand how the DS hardware works at least in principle to use DSLua.

The Hombrew Hunter
September 16th, 2006, 04:35
....Hauh?

I'll try coding, eventually. I'm in mutual pain.

brennxn
September 16th, 2006, 05:06
http://brennan.amidal.com/lua/DSLua%200.5.zip

This is the latest version of DSLua. It contains a few extras, like Jeremysr's keyboard, and part of the game I am coding (heh, just displays "adventure game" right now, the real file was on my card at the time I uploaded that).

Jeremysr
September 16th, 2006, 08:36
Whoa, looks like a really old version of keyboard. There's a way better one at http://www.bio-gaming.com/jeremy/dslua/index.php?act=keyboard

It will only use the bottom screen, so you are free to use the top screen whenever you want.

Also, here is the GBFS version if anyone wants it. (brennxn uploaded the CF version)

http://www.bio-gaming.com/jeremy/dslua/downloads/dslua-0.5-gbfs.zip

k_man316
September 16th, 2006, 15:54
Thanks for the responses!

I downloaded DS Lua and am reading through the examples and the great tutorial site! I see the differences.

I think I'm gonna start coding today, something simple to get the feel for the dual screen and additional functionality of the DS (like touchscreen!).

Thanks for your help, I'll post back once I finish something work posting.

brennxn
September 16th, 2006, 20:39
Whoa, looks like a really old version of keyboard. There's a way better one at http://www.bio-gaming.com/jeremy/dslua/index.php?act=keyboard

It will only use the bottom screen, so you are free to use the top screen whenever you want.


Wow, okay thanks. No wonder I was having trouble using it. (I'm the one who asked you about it over MSN)

EDIT: The download link for 0.1 and 1.0 link to the same keyboard, that's why I have the really old one.

(Most likely)

brennxn
September 16th, 2006, 21:04
Anyone looking for the latest keyboard, it here:

http://www.bio-gaming.com/jeremy/dslua/downloads/keyboard1.0.zip

He linked to 0.1 instead of 1.0 on the page, but I just typed in 1.0 just in case, and sure enough, it was there.

Jeremysr
September 16th, 2006, 21:39
Oh, you got 0.1? That one only lets you use the number keys! :P Thanks for showing me the mistake, I probably never would have noticed...

Jeremysr
September 17th, 2006, 01:26
Whoa! DSLua.com is back! It says I'm banned for 30 days... ?

Edit: He banned me because I gave out his phone number I guess. Did someone phone him? I hope not.

Junixx
September 17th, 2006, 01:45
Lmao, no i didn't phone him lol

Jeremysr
September 17th, 2006, 07:49
Now he banned my second account for 5 days. I guess it wouldn't be a good idea to make another account. :P

brennxn
September 17th, 2006, 18:19
Yeah, probably shouldn't do that.

monaug5
September 18th, 2006, 20:08
Jeremysr how will you do the WiFI tutorial do u have any ideas?

Jeremysr
September 18th, 2006, 20:34
DSLua 0.6 isn't released yet so I don't know anything about it. I've never done any online stuff in any other programming languages either. So I have no idea how it'll work. When DSLua 0.6 is released and I figure out the wifi I'll write the tutorial.

The Hombrew Hunter
September 18th, 2006, 21:29
Wifi In Dslua 0.6?! That's Better Than Psp! W00000t!

Jeremysr
October 5th, 2006, 06:48
I've finally written another tutorial. It explains "advanced touch screen input." It's very important to read if you are using buttons/menus in your DSLua game.

Tomorrow I'll hopefully finish an 8-bit background tutorial. 8 Bit backgrounds let you draw lines and pixels on the screen using a colour palette.

Edit: Whoops, forgot the link: Advanced Touch Screen Input (http://www.bio-gaming.com/jeremy/dslua/index.php?act=advancedtouchscreeninput)