|
Title: Random and dofile? Post by: DtotheK 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 :-\) Title: Re: Random and dofile? Post by: Jeremysr 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. ;) Title: Re: Random and dofile? Post by: DtotheK 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! Title: Re: Random and dofile? Post by: slashtion 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. Title: Re: Random and dofile? Post by: slashtion 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? Title: Re: Random and dofile? Post by: Jeremysr 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. Title: Re: Random and dofile? Post by: Jeremysr 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 Title: Re: Random and dofile? Post by: jester on March 20, 2007, 12:45:11 PM Is saving present in DSLua 0.5?
Title: Re: Random and dofile? Post by: Jeremysr on March 20, 2007, 02:43:01 PM Yeah
|