DSLua Community
Welcome, Guest. Please login or register.
May 18, 2012, 08:57:26 PM
1371 Posts in 262 Topics by 33109 Members
Latest Member: Limewire Download
DSLua Community  |  DSLua - Best scripting language for Nintendo DS  |  Bugs & Suggestions  |  Time function does not work on emulator and some suggestions « previous next »
Pages: [1]
Author Topic: Time function does not work on emulator and some suggestions  (Read 2608 times)
sunicdavy
New Moon
*
Posts: 2


« on: May 17, 2006, 06:52:11 AM »

DSLua is great.
I write a demo use DSLua.It's easy to use.
Finally I write  a FPS counter to test the real speed in the game.Use DSLua.Sec().But it can not work on emulator.Maybe it's a bug.Without a time function and a ramdom function we can not wrote a good game.

suggestions:
1. a ramdom function
2. a total second like timeGetTime() or GetTickCount() on windows platform.
3.Can DSLua support a load mode like: directly start lua programme after loading rom?
   You can add a logo before the lua begin.I think that's my need.Thanks!!
 Wink Cool Tongue
« Last Edit: May 17, 2006, 06:58:49 AM by sunicdavy » Logged
daltonlaffs
First Quarter
***
Posts: 189


Freaking Insane


WWW
« Reply #1 on: May 17, 2006, 07:34:03 AM »

Wow. A lots of complaints here.  Shocked Anyway, you can't use that function in emu's. They don't work like DSes do. However, you could use a Framecount or something. 600 frames = 30 seconds. On average.
Logged

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



^^ That works, I SWEAR! ^^
Zhen
Waxing Crescent
**
Posts: 45


WWW
« Reply #2 on: May 17, 2006, 12:36:21 PM »

Hi, I'll try to answer your questions:

1 - There are random functions in Lua itself. There is no need for now to add in the DSLua library. I have used it in my zhentris.

  math.random( .. )

  http://www.dslua.com/component/option,com_smf/Itemid,19/topic,44.0

2 - You can use the VBlankCount for the most accurate timer in DS. e.g: I use the next bit of code in my current project, to check if I do too much in the game update, and to get the time elapsed.
Code:
local actualTick = DSLua.VBlankCount()
local totalCount = 0
while true do
local actualTick = DSLua.VBlankCount()
g_BGTopText:PrintXY( 0,1, "Ticks Per Update " ..
tostring( actualTick - lastTick ) .. " " ..
tostring( 1 / ( ( actualTick - lastTick ) * 0.0167224 ) ) .. " fps" )
        totalCount = totalCount + ( actualTick - lastTick )
lastTick = actualTick

end

If ( actualTick - lastTick ) > 1 then I need to reduce game update stuff. You can obtain the time elapsed with ( totalCount * 0.0167224 )

I get the information from http://www.bottledlight.com/ds/index.php/Video/Screens

3 - You can put a logo by yourself. In my zhentris project I use lightweight states, And one of that states was one that only prepare a backgound text and wait for player input. Add a timer and you get a Logo screen.

Zhen a.k.a "Luis"
Logged
waruwaru
Administrator
Waxing Crescent
*****
Posts: 78


« Reply #3 on: May 17, 2006, 01:43:05 PM »

3.Can DSLua support a load mode like: directly start lua programme after loading rom?
   You can add a logo before the lua begin.I think that's my need.Thanks!!

Welcome!  Looks like most of your question has been answered already.  Thanks, guys! Smiley  About question #3, I think you want to make your own .NDS and when it runs, it will run your DSLua script, is that correct?  That is one of the common request I get.  I will implement it in the next couple of releases.

Thanks,
Waruwaru
Logged
daltonlaffs
First Quarter
***
Posts: 189


Freaking Insane


WWW
« Reply #4 on: May 17, 2006, 04:55:47 PM »

3.Can DSLua support a load mode like: directly start lua programme after loading rom?
   You can add a logo before the lua begin.I think that's my need.Thanks!!

Welcome!  Looks like most of your question has been answered already.  Thanks, guys! Smiley  About question #3, I think you want to make your own .NDS and when it runs, it will run your DSLua script, is that correct?  That is one of the common request I get.  I will implement it in the next couple of releases.

Thanks,
Waruwaru

Yes waruwaru, good plan, but I got a GOOD idea. How about this: Your scripts can still be multibooted (like now), but add a function like:

AUTORUN_ME = true

It would be start to make it check for that value. If it isn't in any script, or false, or both, but no true, it multiboots normally. But if that is true in any script, only that script is packed, and set to automatically run with its resources. Hehehe.

Do you want me to  Lips sealed,

Daltonlaffs
Logged

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



^^ That works, I SWEAR! ^^
Zhen
Waxing Crescent
**
Posts: 45


WWW
« Reply #5 on: May 17, 2006, 06:16:31 PM »

About AUTORUN, I think that Luaplayer has a better way.

The programs are separated in folders. If there is a script in the root folder, then that script is executed ( I don't remember if there is a special name for main lua file ). If you want, you can put a multiboot or explorer script in the root folder.

Zhen
Logged
daltonlaffs
First Quarter
***
Posts: 189


Freaking Insane


WWW
« Reply #6 on: May 17, 2006, 07:57:12 PM »

About AUTORUN, I think that Luaplayer has a better way.

The programs are separated in folders. If there is a script in the root folder, then that script is executed ( I don't remember if there is a special name for main lua file ). If you want, you can put a multiboot or explorer script in the root folder.

Zhen

Good point.  Grin
Logged

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



^^ That works, I SWEAR! ^^
sunicdavy
New Moon
*
Posts: 2


« Reply #7 on: May 17, 2006, 10:12:30 PM »

Thank you~~~
I'm the first time to post here.After trying DSLua,I have downloaded PALib and compiled some example.
PALib is powerful but it is too complex to beginner or RAD.
DSLua is fast enough I think.hehe
Logged
Pages: [1]
« previous next »
    Jump to: