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.

DarkBASIC Professional Discussion / what is great about lua and dbpro?

Author
Message
sovr
16
Years of Service
User Offline
Joined: 2nd Jan 2010
Location: USA
Posted: 5th May 2012 01:42
hello, I did see the expansion pack to dbpro unity which has lua in it. I understand a little on how the scripting language works syntax wise, but what does it really bring to dbpro to enhance it? I did hear that lua can not do too much, but are in a lot of games. Thank you for your help!

sov the game creator!
basjak
16
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 5th May 2012 04:54
good use of lua can do a lot for you.

lua is programing language by itself. every time you write a code, you will need to compile it to see your results. however, as the code get bigger and bigger, the compile time becomes huge. so, every time you need to change little information in your code, you have to wait until the IDE compiles your code. that will waist a lot of time.

with lua you can change your information then click on the compiled code (.exe) without the need to recompile your program again and again.
Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 5th May 2012 20:38
Unity is a pretty basic plugin; very easy to use but it does not have a world of features. You cannot override error messages and there only a few inbuilt 3D engine functions such as Move Object and Point Object; any communication (interoperability) between Unity and DBPRO is achieved through messages.



MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 7th May 2012 07:49
I was wondering if there were any books on working with LUA that were up to date...

Brendy boy
21
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 7th May 2012 15:20 Edited at: 7th May 2012 15:20
Quote: "I was wondering if there were any books on working with LUA that were up to date..."

LUA manual

MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 7th May 2012 22:45
I mean a tutorial for wusing it with DBPro Seppuku helped me out a few erm weeks ago but I think we need something more thorough...

Brendy boy
21
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 8th May 2012 00:27
every lua plugin comes with the examples, what do you need more?

MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 8th May 2012 00:29
A sample project

also the lua manual is geared towards use with LUA itself not like if I was using it with dbpro so I might struggle to figure out what will work for DBPro etc... just new to it cant be blamed can I?



Brendy boy
21
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 8th May 2012 00:53
Quote: "A sample project"

what's the difference between a sample project and example?

MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 8th May 2012 00:54
integration?

Brendy boy
21
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 8th May 2012 01:07
Quote: "integration? "

i don't understand, please clarify

MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 8th May 2012 02:35
using it in a program... [Brendy are you trolling? XD]

Brendy boy
21
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 8th May 2012 03:24
Quote: "using it in a program..."

and what do examples show? How to use it outside the program or what?
I really don't understand you.

Quote: "[Brendy are you trolling? XD]"

no

MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 8th May 2012 03:28
nvm... just the example material acompanied doesnt make clear sense... [in other words reiterating, I am new to it]

Quote: "Quote: "[Brendy are you trolling? XD]"
no
"


thats a relief

Brendy boy
21
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 8th May 2012 03:31
Quote: "nvm... just the example material acompanied doesnt make clear sense... [in other words reiterating, I am new to it]"

well, tell me which lua plugin you use and then what exactly you don't understand in the example. I'll try and clarify you

MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 8th May 2012 03:47
UNITY official plugin from the store...

more so the scripts that can be created I suppose...

I am unsure if the manual can help with that...

strange thing in my recent install of Unity I found a more detailed .doc file... weird... didnt find it last time...

Brendy boy
21
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 8th May 2012 03:49
Quote: "UNITY official plugin from the store..."

i'm not using that, i find the free lua plugins better that unity

MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 8th May 2012 03:51


I guess i will give the sample code a try and see if it makes sense... thanks Brendy you are a real asset to the forum...

when will you get your badge?

Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 8th May 2012 22:45
(Doesn't Unity supply DBPRO examples?)

MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 9th May 2012 01:55
Yes it does... Perhaps when I bought it the first time round I was too inexperienced with all the files and various folders...as I never made any sense out f it and didnt find a couple of files... All I did find was a very short file... But now I found both a .doc and a .pdf with lots of into... So will have a fiddle soon...

basjak
16
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 9th May 2012 03:53
the example files with unity are enough to make a professional app . many functions such as math, strings need a bit more reading at lua manual.
lua manual is available online and really cool.
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 9th May 2012 04:52
Quote: "lua manual is available online and really cool. "


LINKEDY LINK LINK LINK

Seppuku Arts
Moderator
21
Years of Service
User Offline
Joined: 18th Aug 2004
Location: Cambridgeshire, England
Posted: 9th May 2012 18:26
I can see if I can dig out my old text adventure out for later if you wish? It pretty much runs from LUA (the free plugin though, but i'm sure you can just apply it to Unity's commands.)

MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 9th May 2012 18:58
I Sepp

Seppuku Arts
Moderator
21
Years of Service
User Offline
Joined: 18th Aug 2004
Location: Cambridgeshire, England
Posted: 11th May 2012 16:40 Edited at: 11th May 2012 16:57
I've dug it up, it's not a brilliantly coded text adventure - it was my entry for the Text Adventure Competition Matt Rock used to run. You can see how LUA manages it.

You will need these 2 following plugins to make the code work:
Barnski's Free LUA Plugin
And
D3DFunc DLL - because this offers faster and better looking text.

I'll try to explain the code a little here, mainly becauae I didn't comment it too well.



Essentially I just used LUA to store a lot of values to affect the game code.

So if I want to create a 'room' in this text adventure, my LUA file would look like this:



To break it down:
Script = { current }

This is to tell DBP the name of the script (this was me being lazy in DBP)

Title = "..."

The title displayed for the room.

Background = "..."
Music = "..."


The image/music name of the background/music used, if "parent" is written, then it will use the image from the last room.

Text = { positionx, positiony }

The position of the text in the frame

body = "..."

This is the body of text used for describing what\'s going on. It's basically the narrative part.

choice = { count, n1 = {line, command, script}, n2 = {line, command, script}...}
This is used for the 'options' the player has in the text adventure. The 'Count' is used for an array to decide how many options the player has. So if you write '4' you need n1, n2, n3 and n4 complete. Because it's LUA, you can get away with multiple lines for a single line of script making it easier to read. With each 'option' you have line text, the command (for example if it says 'save' it'll perform what action 'save' does in DBP. If you write "loadscript" you'll have to use the 'script' argument to put in the file name.


Now, DBP will parse whatever script is thrown at it. And that\'s easy. You have to do the LUA LOAD FILE "..." to load your chosen script. I have my code use a default script and then after that have the script loaded depend on what the scripts tell DBP.

All you have to do then is check what's in the LUA script and code conditions for whatever the script contains. So, I have a variable called 'body', it's used as a string. So I store that into DBP as:

Body$ = lua string$("body")

That will grab "body" from the lua script.

Where there's a command, I could create some game logic.

if lua string$("choice.n1.command") = "end" then end

You'll see wherever I use a curly brace "{}" it'll be treated kind of like an object in object orientated programming, hence the dots.

I'm sure there's more to LUA than that, but it's how I used it.

Also, project is here.

https://www.dropbox.com/sh/1m1z3kzvk2rrwgy/ygR-2RGUtm/Pulse%20Demo

MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 11th May 2012 18:04
once again Sepp thank you so much

Greenster
21
Years of Service
User Offline
Joined: 3rd Feb 2005
Location: US ©
Posted: 15th May 2012 13:12
I have a plugin floating around somewhere that lets you choose which lua modules to load when you run a script, its good if you want to isolate script environments for security etc..

The official/cost one just loads scripts and has some passive data functions.

Login to post a reply

Server time is: 2026-07-22 00:35:22
Your offset time is: 2026-07-22 00:35:22