Wednesday, 07 January 2009
 
  Home arrow Forum  
Main Menu
Home
News
Forum
Documentation
Download
Links
Administrator
Login Form
Welcome, Guest. Please login or register.
January 07, 2009, 03:40:06 PM
Username: Password:
Login with username, password and session length

Forgot your password?
Random and dofile?
DSLua Community
Welcome, Guest. Please login or register.
January 07, 2009, 03:40:06 PM
1724 Posts in 316 Topics by 10117 Members
Latest Member: Urgeftgek
DSLua Community  |  General DS Programming Chats  |  Code Hashing  |  Random and dofile? « previous next »
Pages: [1]
Author Topic: Random and dofile?  (Read 2214 times)
DtotheK
New Moon
*
Posts: 2


« on: February 20, 2007, 03:19:52 PM »

Idiotic? perhaps.
 anyway i'm pretty new to DSlua( not PSPlua).
I have plans for a family guy/simpson themed simple enough game, have not   started it yet as am waiting for supercard lite. anyway...
could someone answer:
Is there a dofile command in DSlua? something like

dofile "mainmenu.lua"
...?
And to generate a random integer from 1 to four inclusive , what would be the best way for this?
Thirdly: are these stupid questions? is dslua exactly the same as psp bar touchscreen and dual screen and mic??

Lastly , thankyou for your help, i'll be here again soon no doubt ,
and hopefuly you'll all be enjoying my game in the next few weeks!(i have exams these days Undecided)
Logged
Jeremysr
Waxing Gibbous
****
Posts: 254



WWW
« Reply #1 on: February 20, 2007, 05:00:05 PM »

I'm not sure what PSPLua is like so I can't compare for you right now...

DSLua includes almost all of the same functions as normal lua, almost everything tought in this page ( http://www.lua.org/pil ) will work in DSLua. Of course there are also extra functions for the DS which are found on the documentation (see the menu to the left.)

So yes there is a dofile function, I would write it like this but your way might work (I've always used parentheses):

dofile( "mainmenu.lua" )

Random numbers are also the same as normal lua ( http://www.lua.org/pil/18.html ). Except for the seed number use DSLua.VBlankCount() which is the number of V-blanks since the program started (it counts up every 1/60 of a second.) So:

math.randomseed( DSLua.VBlankCount() )
print( math.random( 4 ) )

This prints a number either 1 2 3 or 4 (you have to set up the screens first in DSLua though). If you want it to be inbetween 5 and 10 (for example) you would put this: math.random( 5, 10 ) .

And no they weren't stupid questions, they were good questions. Wink
Logged
DtotheK
New Moon
*
Posts: 2


« Reply #2 on: February 21, 2007, 09:24:29 AM »

cool thanks for the quick reply!

Another question..
Say if im doing credits in the game, the person presses on credits button and i have say 3 screens worth of thanks and so on.
I kindof worry that the game will seem very imagey and static with little animation.. so do you think it a good idea if i wanted the credits on one screen only, if i made an image the size of three ds screens on eachother, and displayed the top of the image first then waited for .1 of a second (for example) and moved the image up a line of pixels.
I mightn't be wording this the best but does it make sense? I'd prefer this sort of thing than just displaying 3 images/ pieces of text seperatly...

It was just an idea that struck me to make the game look more professional and animated!!! what do you think?
Thanks!
Logged
slashtion
New Moon
*
Posts: 2


« Reply #3 on: February 21, 2007, 11:21:38 AM »

Nice idea, should be do-able I guess.

Edit; As a matter of fact, I think I can help you with that, as in; got some code laying around somewhere on my harddrive. A "credits", "splash" or just "endscreen" query should do the job.
Logged
slashtion
New Moon
*
Posts: 2


« Reply #4 on: February 21, 2007, 12:22:06 PM »

Hmm, you probably know the sentence; If you can't find it, rewrite it? No? Well, that doesn't matter here.

First time No$GBA AND Dualis gave me an error after loading a .lua file. Probably some wrong coding from my side, but still, normally it gives my a regular black screen or a selfwritten error message. Odd.

Guess I can't help you, maybe JeremySR/Sypherce or Daltonlaffs could post an example?

Logged
Jeremysr
Waxing Gibbous
****
Posts: 254



WWW
« Reply #5 on: February 21, 2007, 01:38:03 PM »

cool thanks for the quick reply!

Another question..
Say if im doing credits in the game, the person presses on credits button and i have say 3 screens worth of thanks and so on.
I kindof worry that the game will seem very imagey and static with little animation.. so do you think it a good idea if i wanted the credits on one screen only, if i made an image the size of three ds screens on eachother, and displayed the top of the image first then waited for .1 of a second (for example) and moved the image up a line of pixels.
I mightn't be wording this the best but does it make sense? I'd prefer this sort of thing than just displaying 3 images/ pieces of text seperatly...

It was just an idea that struck me to make the game look more professional and animated!!! what do you think?
Thanks!

Yeah I used that in my Skip-Bo game for the menus. I made a tiled map of the three screens and scrolled them up when choosing menus. You can see it in the Projects forum.
Logged
Jeremysr
Waxing Gibbous
****
Posts: 254



WWW
« Reply #6 on: February 21, 2007, 04:30:30 PM »

Hmm, you probably know the sentence; If you can't find it, rewrite it? No? Well, that doesn't matter here.

First time No$GBA AND Dualis gave me an error after loading a .lua file. Probably some wrong coding from my side, but still, normally it gives my a regular black screen or a selfwritten error message. Odd.

Guess I can't help you, maybe JeremySR/Sypherce or Daltonlaffs could post an example?

There's special instructions for getting DSLua 0.6 running in Dualis here, in the 2nd paragraph -> http://www.bio-gaming.com/jeremy/dslua/index.php?act=helloworld
Logged
jester
First Quarter
***
Posts: 123


Jester Corp DS Logo


WWW
« Reply #7 on: March 20, 2007, 12:45:11 PM »

Is saving present in DSLua 0.5?

Logged

CURRENT PROJECT:

JesterCorp DS- 2D FIGHTING GAME!!! Due out August 19th 2007!!!Having Sprite Issues but Toast is helping me ALOT
Jeremysr
Waxing Gibbous
****
Posts: 254



WWW
« Reply #8 on: March 20, 2007, 02:43:01 PM »

Yeah
Logged
Pages: [1]
« previous next »
    Jump to:  



    (C) 2009 DSLua

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