Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / [Unity] Problem with accessing tables that may change in size

Author
Message
Redmotion
21
Years of Service
User Offline
Joined: 16th Jan 2003
Location: Mmm mmm.. Marmite
Posted: 25th Nov 2006 12:25 Edited at: 25th Nov 2006 12:26
I'm sure I'm approaching this the wrong way but, I'm using this LUA file:



"Number" tells the DBPro how many level files there are and table "Names" tells it what they are called (They are other LUA files).

The problem is, maybe I want to change it to 6 files? I can't work out how to access the "Names" table without rewriting DBPro code.

I'm using this code in DBPro:



Problem is you can't send a$ to the "lua array string" function, you can only use:

levelfile$(1)=lua array string("Files->names->#1")
levelfile$(2)=lua array string("Files->names->#2")
levelfile$(3)=lua array string("Files->names->#3")
levelfile$(4)=lua array string("Files->names->#4")

Which means, at the moment, I can't automate the level loading/building sequence outside of DBPro with Unity.

What should I be doing with the Unity commands? - I have a feeling it's a bit more complicated!?

Cheers.

Stupify
17
Years of Service
User Offline
Joined: 28th Oct 2006
Location:
Posted: 10th Dec 2006 11:45
I'm not familiar with the syntax or commands of unity, but could you do something like this?

Lua Code


DBP Code


Hope this helps or at least gives you an idea...
GatorHex
19
Years of Service
User Offline
Joined: 5th Apr 2005
Location: Gunchester, UK
Posted: 1st Jan 2007 08:23 Edited at: 1st Jan 2007 08:34
I do the lua file like this



I send data to a lua file like this



I read data from a file like this..


You can check out a little lua sample I wrote here
http://www.freewebs.com/sang33ta/LuaExample.rar

OK here is a little upgrade you can make to the Amazon.lua we will re-program the AI without needing DBP to recompile the software!!!

add these three lines...

spotPlayerDistance = 20
if dist > attackDistance and dist < spotPlayerDistance then
if timer > (oldTimer + attackTimer) and dist < attackDistance then

..now the monster only comes after you if you get too close to her.

Your full Amazon.lua file should looks as below...



http://www.KumKie.com http://bulldog.servegame.com
cassius
20
Years of Service
User Offline
Joined: 31st Oct 2003
Location:
Posted: 17th Jan 2007 22:03
@Redmotion

I have been using LUA (Unity) for a while and I would suggest the following to take into account dynamically changing array sizes. These are suggestions that I have implemented in my own code.

Make you LUA code look like this:



Now in your DBPro code you could do the following. Forgive me if my syntax is not exactly correct since I am at work and do not have a example of my code right in front of me:

In DBpro :



I hope this helps.

Cassius

Login to post a reply

Server time is: 2024-06-28 03:27:13
Your offset time is: 2024-06-28 03:27:13