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.

Program Announcements / New Lua5.1 Plugin - Free Scripting Pack for DBPro!

Author
Message
Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 28th Oct 2006 20:18
Quote: "Just a question about the eventual future of this plugin; would it be possible to include support for running cusom made DBP functions and returning values/strings from theese using scripts?
I heard that DarkScript could do this; the problem is that I can't buy it since I own no credit card
So, if possible.... "


uhm well, I could.. but.. then it wouldnt be such a nice solution.
maybe.. if.. I am not too stressed by my studies, I will add it.. somewhen.. perhaps.. but still.. its unsure. I wanted not to do it.. very well.. we will see.. yea.

Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 30th Oct 2006 11:40
Yeah, yeah, I see :\

"I kören hörs de brummande busarna Björnligan och Gondolen"
The admiral
21
Years of Service
User Offline
Joined: 29th Aug 2002
Location:
Posted: 2nd Nov 2006 07:47
How can you use the lua functions to create objects in dbpro.

The admiral
The admiral
21
Years of Service
User Offline
Joined: 29th Aug 2002
Location:
Posted: 3rd Nov 2006 22:13
Any body know because I cant seem to alter the functions example to make a dbpro object all it will do is load that object....I dont understand how to use dbpro commands with lua.

The admiral
Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 3rd Nov 2006 22:45 Edited at: 3rd Nov 2006 22:55
Its simple, if you keep this in mind: The Name of a dbpro command is altered by removing any spaces and making the first letter of each word upper case.

example:
make object sphere -> MakeObjectSphere

To call this command within a lua script you need to use the DBPro.Call() Funktion. This function takes as first parameter a string with the name of the dbpro command (e.g. "MakeObjectSphere"). The next parameters are the arguments for the dbpro command. e.g. object number, sphere size.

So all in one it would look like this:
DBPro.Call("MakeObjectSphere", 1, 10);

Rember: LUA is case-sensitive! dont write dbpro.call()!

edit: on the first page of this thread I have posted a screenshot of a luascript that uses a lot of DBPro.Call() functions. Have a look!

tadmiral
18
Years of Service
User Offline
Joined: 22nd Mar 2006
Location:
Posted: 5th Nov 2006 02:44
Thanks that worked although some of the commands dont work as their ment to im not sure why this is.
The admiral
21
Years of Service
User Offline
Joined: 29th Aug 2002
Location:
Posted: 5th Nov 2006 02:46
Thanks that worked although some of the commands dont work as their ment to do you know why this is?

The admiral
Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 5th Nov 2006 10:22
Can you tell me which commands dont work as you expect them to do?

If it is a command that takes a special parameter, like double integer, then there is the possibility to use DBPro.CallEx(). with this command you can specify the argument types. I already posted a short help about it on the first page of the thread.

Syntax:
DBPro.CallEx(command_name as String, argument_types as String, arguments...)

the argument_types String consists of letters that define the argument type by their order. E.g "LSD" means that you pass an integer, a String and a Dword.

The abbreviations are the same used by DBPro with their dll-string table. They are explained somewhere in the dbpro help about "how to create and use third party dlls" (under technical documents).

In most cases however, you do not need to specify the arguments, so you can use DBPro.Call()

The admiral
21
Years of Service
User Offline
Joined: 29th Aug 2002
Location:
Posted: 6th Nov 2006 06:05
It seems to be set object cull but im not entirely sure.

The admiral
The admiral
21
Years of Service
User Offline
Joined: 29th Aug 2002
Location:
Posted: 9th Nov 2006 06:56
What do you think?? Its just i used the same comfig i used in dbpro to make an object and doing it in the script the object looks different I dunno how to correct it.

The admiral
Final Epsilon
20
Years of Service
User Offline
Joined: 26th Jan 2004
Location: CA, USA
Posted: 17th Nov 2006 01:51 Edited at: 17th Nov 2006 01:52
I can't seem to call SetObjectLight. I keep on getting a "command not found" error when attempting to run the script. I don't believe SetObjectAmbient works either.
Maleck
19
Years of Service
User Offline
Joined: 12th May 2004
Location: US
Posted: 24th Nov 2006 06:26
Did you ever recompile with .NET 2003? Just wondering so I know if my prohs will require .NET 2.0 installed.

Thanks for all the great work.
Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 24th Nov 2006 11:43 Edited at: 24th Nov 2006 11:45
I still use Visual Studio .NET 2005, but it is not using .NET 2.0 anymore. I had to change the libraries that are linked in while compiling (the path order in the windows environment variable 'INCLUDE' and 'LIB').

So your programs should NOT require .NET 2.0 anymore (at least not because of my plugin).

Quote: "Thanks for all the great work. "

Thanks too for using it

Stupify
17
Years of Service
User Offline
Joined: 28th Oct 2006
Location:
Posted: 7th Dec 2006 06:47
Barnski, this plugin is simply amazing!! I must say Thank You for the excellent work.

I've been using it for about 2 days now, and it sure can do some powerful things, which inturn makes your life much easier. I've had a bit of a Lua learning-curve to overcome, but its well worth the effort.

Have you put any more thought into adding support for accessing DBP functions or access to other DLL's? These 2 features would increase the value 10x, although like I said earlier its wonderful as it is, but those features sure would be nice!

Anyways, just wanted to say Thanks for all the hard work and effort, and to let you know how much its appreciated!!
The admiral
21
Years of Service
User Offline
Joined: 29th Aug 2002
Location:
Posted: 5th Jan 2007 10:02
Hey ive been wondering if you can use if then sort of commands in the lua functions and if so then how?

The admiral
Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 7th Jan 2007 23:27
Quote: "Have you put any more thought into adding support for accessing DBP functions or access to other DLL's? These 2 features would increase the value 10x, although like I said earlier its wonderful as it is, but those features sure would be nice!

Anyways, just wanted to say Thanks for all the hard work and effort, and to let you know how much its appreciated!! "

Thanks Stupify, much appreciated aswell!
about calling user functions; I have been giving it some thoughts a while ago, but decided not to pursue a possible solution. It is too much effort with no pro's for me, as I use c++, where u can hand over function pointers. 2bad this is not possible in DBP.

Quote: "
Hey ive been wondering if you can use if then sort of commands in the lua functions and if so then how?
"

Yes you can use 'if, while, for' and other control statements in lua. check out the official lua website here: http://www.lua.org

I might not be able to work on my plugins for some time;
my desktop PC has crashed and I have exams soon, so no time and energy for my projects.
But I will be back.

The admiral
21
Years of Service
User Offline
Joined: 29th Aug 2002
Location:
Posted: 8th Jan 2007 03:51
Yeah but i dunno how to use those commands properly and the site is not much help in relation to dbpro...

The admiral
Stupify
17
Years of Service
User Offline
Joined: 28th Oct 2006
Location:
Posted: 8th Jan 2007 09:18
@ Barnski
NP man, i understand. thx again, great plugin!!

@ The admiral
If you look on the 1st page of this thread about 3/4 the way down, Barnski has an image with some code in it utilizing some If Then statements. I know its not a tutorial or anything but it may give you some ideas of how it works. If you have more specific questions I can try and help... GL!
Peter H
20
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 10th Jan 2007 01:16 Edited at: 10th Jan 2007 01:17
so, hypothetically speaking, could a complete program that uses this plugin run on a computer that doesn't have .net installed?
(not asking if i can develop on a computer without it, i just want to know if people would have to install .net before playing my game)

btw, it worked after i installed .net 2.0, thanks!

One man, one lawnmower, plenty of angry groundhogs.
The admiral
21
Years of Service
User Offline
Joined: 29th Aug 2002
Location:
Posted: 17th Jan 2007 00:23
Thanks for the help stupidfy is there anyway to access typed data from your programme using a a script without inputting the values into the function.

The admiral
Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 28th Jan 2007 19:00
@Peter H
I am not quite sure whether its still depending on .net 2.0.
On my PC it worked without... but it requires more testing to be sure I guess.

@The Admiral
Quote: "
is there anyway to access typed data from your programme using a a script without inputting the values into the function."

I don't quite understand what you're asking. could you try to rephrase your question please?

Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 29th Jan 2007 18:44
I just had some issues calling non-standard DBPro functions from your plugin (things from plugins, that is).
Since I don't remember having done this before; can you only access the standard DBP functions using BDPro.Call or am i missing something here?

"I kören hörs de brummande busarna Björnligan och Gondolen"
The admiral
21
Years of Service
User Offline
Joined: 29th Aug 2002
Location:
Posted: 29th Jan 2007 21:41
Never mind i solved my problem once again heh.

The admiral
Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 30th Jan 2007 00:07 Edited at: 30th Jan 2007 00:17
Quote: "can you only access the standard DBP functions using BDPro.Call "

Yes, at the moment you can only call the standard DBPro commands from the dbpro dlls.
I could however easily add a command that allows 'loading' another plugin dll, and make these commands available to the lua script.
But these plugins must have an unencrypted string table, which is not the case with the licensed add on plugins from TGC, as I was told.


Some time ago I was told that some of the 'set object' commands are not callable in the lua script. As I know, the set object commands are heavily overloaded, that means, you can specify a variable amount of parameters.
In order to let my plugin chose the right command for you, you have to tell it which version of the command it shall call.
You can do this by using DBPro.CallEx.
Check the help online here:
http://homepage.swissonline.ch/barnski/help/lua/DBPro.CallEx.htm
You need to specify the arguments with a string, describing their type and implying the amount.

edit: (for the technically interested)
since lua has almost typeless variables, it is impossible for my plugin to determine the type of the arguments automatically. Therefore you need to specify them manually (if the amount does not imply the command).

The admiral
21
Years of Service
User Offline
Joined: 29th Aug 2002
Location:
Posted: 12th Feb 2007 00:52
Im having troubles returning more than one value from a script file i thought this was possible.

The admiral
The ARRAYinator
18
Years of Service
User Offline
Joined: 13th Aug 2005
Location:
Posted: 12th Feb 2007 03:23
Not that im planiing on making a commercial game in the near future but are there license restrictions if you sell a game that uses it? IF so how much etc?



Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 14th Feb 2007 12:50
Quote: "Not that im planiing on making a commercial game in the near future but are there license restrictions if you sell a game that uses it? IF so how much etc?"

No license restrictions. I just want a free copy of the game.
there is a license text file along with my email in the plugins download pack.

Quote: "Im having troubles returning more than one value from a script file i thought this was possible."

I haven't tried this yet, but the lua stack should be fully accessible from within dbp. So to retrieve 2 or more values, just pop from the lua stack twice or more times.
In lua I think you need to seperate the return variables with commatas:
return a, b, c

But I am not sure on the order you then pop them (c, b, a) or (a, b, c).
Hope this helps.

Peter H
20
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 24th Feb 2007 17:24
hmm... this is working fine on my main computer, but whenever i try to run a exe that uses LUA on our secondary computer, i get a "cannot load 'Barnski'sLuaPlugin_debug.dll'" type of error

i've tried both the release and the debug version, i've even tried including the .dll in the folder with the exe

any idea what may be wrong? i'd like to use this but i can't if i have no guarantee that it will work on other systems... (also though i understand that this is something you made for free, and it may be a pain to figure out what's wrong)

One man, one lawnmower, plenty of angry groundhogs.
General Reed
18
Years of Service
User Offline
Joined: 24th Feb 2006
Location:
Posted: 24th Feb 2007 20:05
Peter H, what version of dbpro r u using, im using 6.4, and im getting the same.

Beware, Killing chavs is not a crime, but is the only way to cure the earth
Vist www.scratchyrice-dev.co.uk
Peter H
20
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 24th Feb 2007 21:10 Edited at: 24th Feb 2007 21:11
6.3

It works on my computer with .net 2.0, and it works on flindiana's computer, with .net 1.1, but not on my secondary computer with no .net...

I think that it requires .net...

@Barnksi- is this because you compiled it in visual studio? is it possible that you could compile it in DevC++? http://forum.thegamecreators.com/?m=forum_view&t=97069&b=5

I don't know if that would be possible (as i've never made a dll before)

One man, one lawnmower, plenty of angry groundhogs.
bitJericho
21
Years of Service
User Offline
Joined: 9th Oct 2002
Location: United States
Posted: 25th Apr 2007 05:38
In windows vista, I get the following error if I use

lua make or lua make 1



Loading lua with LUA MAKE 0 allows the program to run, and it can read from lua scripts, however, when I close the program, it crashes with the following:



This happens with both the debug and release version of the dll.

FERSIS
17
Years of Service
User Offline
Joined: 17th May 2006
Location:
Posted: 30th Apr 2007 20:35
great plugin , i was thinking on make a script for my game , but with this , you saved me a lot of time
again great plugin , thanks
Gamers for sale
18
Years of Service
User Offline
Joined: 19th Nov 2005
Location: Some where beneath the elements
Posted: 13th Jun 2007 00:21 Edited at: 13th Jun 2007 00:38
I was having a problem with this code:



It crashes?

I can't figure out what I did wrong.

It doesn't seem to like any loop with if statments after lua terminate.

Is there a problem with the code structure or the DLL?

GFS

Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 3rd Jul 2007 13:40 Edited at: 3rd Jul 2007 13:46
New version 1.0.1 available

Hello all!
After a long period of absence (studies in computer science), I found the time to bring my plugins up to date.

This new version can be downloaded from my plugins website (signature).
Its a fix for the following problem described by Peter H:
Quote: "
hmm... this is working fine on my main computer, but whenever i try to run a exe that uses LUA on our secondary computer, i get a "cannot load 'Barnski'sLuaPlugin_debug.dll'" type of error

i've tried both the release and the debug version, i've even tried including the .dll in the folder with the exe

any idea what may be wrong? i'd like to use this but i can't if i have no guarantee that it will work on other systems... (also though i understand that this is something you made for free, and it may be a pain to figure out what's wrong)
"


The plugin works on any computer now! No need for .NET! its a win32 dll.
The debug version should work fine for everyone!
I recommend all who had problems with crashes to retry the new version.

Have a try, and thanks for the patience (sorry for the waiting) guys...

edit: I also recompiled the Lua5.1Compiler. It should work for everyone now. Get it from my website.

Greetz,
Barnski

Duffer
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: chair
Posted: 3rd Jul 2007 19:07
@ Barnski,

Could I use this plugin and Lua files say for instance for stats and attributes stuff in an RPG?

a long time dabbler with DBC and DBPro with no actual talent but lots of enthusiasm...
Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 3rd Jul 2007 21:16
Quote: "@ Barnski,

Could I use this plugin and Lua files say for instance for stats and attributes stuff in an RPG?"

You can use lua to define the bonus and effects of your skills, inclusive the special visual effects of a spell for example. You can then easily fine tune the skill behaviour by just changing the lua file without compiling the game or even during runtime!
Of for example reposition or enlarge the visual effect.
And play sounds. whatever you like to customize.

However stats and attributes are quite fix things, I would use a datastructure. You may use lua tables but struct is fine. A struct is a user type.
To save those attributes to a file I would write your own routines or use the DBPro save array or the like.

Hope this answers your question?

Duffer
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: chair
Posted: 3rd Jul 2007 22:36
@ Barnski - thanks - question answered

a long time dabbler with DBC and DBPro with no actual talent but lots of enthusiasm...
Try
19
Years of Service
User Offline
Joined: 16th Aug 2004
Location:
Posted: 6th Jul 2007 12:15
@Barnski:
Hey nice work man, keep it up.

Q1: I'm using DGDK, I've included your .h and .lib files but when I try using it (for example just the make()) I get some errors

Q2: btw, I didn't completely get it; the call of DBP commands are just for the DBP Plug-in (the one your made) or DGDK users can use DGDK commands either? (because I saw a table command or something like that, is it right?)
Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 6th Jul 2007 16:11
Thanks Try,

Please see my response to your questions in the DarkGDK thread:
http://forum.thegamecreators.com/?m=forum_view&t=109593&b=22

Please use that thread for questions and problems regarding only the c++ library version of the plugin (compilation and differences to the plugin dll).

Use this thread for functionality issues and bugs, that concern both, c++ library and DBPro Plugin.

This is to not confuse DBPro users with c++ related stuff.

Thanks!

Try
19
Years of Service
User Offline
Joined: 16th Aug 2004
Location:
Posted: 6th Jul 2007 16:27
@Barnski:
uh, that makes sense, sorry for that.
(btw, I was confused too)

Thanks for your help, good luck man.
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 7th Jul 2007 20:49
He Barnski, I'm using your plugin for the ability to handle different entities in my game, but I'm having some problems controlling them.

Here is the Lua code (which compiles fine):


The antiGravity function creates and positions an "anti gravity" field. The controlAntiGravity function checks if the player is inside the feild, and returns an upward force, which is used in the actual game.

This is the DBPro code for calling the controlAntiGravity function:


That's inside the main loop. Obviously the upward force isnt being applied yet. My problem is, that with that code, my game crashes. I'm having a bad feeling that there's a stack overload or something, but I can't be sure. Do you know what's happening? Thanks.

P.S. If I put that code outside the loop, it runs fine.

Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 8th Jul 2007 00:38
@Zotoaster
When I look at your code it seems that you forget to push the antiGravField obj when calling the "controlAntiGravity" function.
Instead you only push the player obj and call the function as if it needed one parameter. In the lua code you specify 2. Is that the problem?

Besides, you use DBPro to calculate sqrt, but lua has a table called math, which provides the same functionalities, and it is faster than calling the dbpro function. for syntax; visit www.lua.org

Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 8th Jul 2007 00:53
Barnski, you have made me feel like an idiot Haha, I'll edit this post if I have any more problems.

Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 9th Jul 2007 12:28
Hi again. Is there any way to get Lua to use linked lists? I searched wikipedia and the lua documentation, but didn't find anything. Thanks

Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 9th Jul 2007 17:35
@Zotoaster
Linked lists are not available in lua. But you can probably achieve the same by using the associative array, where you specify a unique ID for every item and set a "next" and "prev" for each element you insert. SO you have to manually make the linked list.

Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 9th Jul 2007 18:18
That sucks... luckily, I figured a work around. Heheh.

Another thing to mention: DBPro's "Set Alpha Mapping On" seems to cause an error. Do you know why? Or did you not implement it for some reason or other?

Thanks.

Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 10th Jul 2007 01:34
Quote: "Another thing to mention: DBPro's "Set Alpha Mapping On" seems to cause an error. Do you know why? Or did you not implement it for some reason or other?
"

Please show me the lua source code you use to call it.
Also, you might want to try "DBPro.CallEx". Have a look in the help of my plugin. On the bottom of the index it can be found. (e.g. Online Help).

If all fails, it would be the easiest for me to get all stuff I need to reproduce the error. You can also send me per email. Thanks!

Seppuku Arts
Moderator
19
Years of Service
User Offline
Joined: 18th Aug 2004
Location: Cambridgeshire, England
Posted: 10th Jul 2007 11:38 Edited at: 10th Jul 2007 12:13
This is a pretty cool lua plugin, good work and cheers - it's giving me some hours experimenting what I can do with it.

[edit]
May I ask, is there a way to write values into LUA from DBP? Like say:

I have a character who reads the value of the HP in the script (700) and that value is reduced ingame and then can I record the reduced HP back into the LUA script, so next time DBP reads the HP Integar, it has the new value? May seem like a daft question, but I asked it.

From your tutorial I gather it was the set int, but nothing seemed to happen, this is the code I used to set the integar.


if shiftkey()=1 then LUA SET INT ("enemyhealth"), enemyhealth

Support the return of Cow-Fishing! Hook up Paris Hilton and die!
Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 10th Jul 2007 15:39 Edited at: 10th Jul 2007 15:41
Quote: "This is a pretty cool lua plugin, good work and cheers - it's giving me some hours experimenting what I can do with it."

Cheers!

Lua is only reading the script files, changes you do to your variables during runtime wont be written to the script file.
Therefore I would not use lua to store dynamic data, that needs to be stored over several runtime sessions, as savegames or character data.
Instead, you can specify customizable settings. The tutorial suggests its usage as configuration, but via the lua script file exclusively. Or you write the line by yourself to the file.

Put all data that is static and might need tweeking into lua files, such that you can easier develop your game for example.

Another possibility is language files as lua scripts.

Further you can allow your endusers to customize your game using lua scripts. E.g. the skins, the GUI appearance, but also the models, etc. Effectively you can allow your users to make mods.

I am sure you can come up with lots of other possibilities.
I think there are some tutorials on LUA in this forum, however in conjunction with Unity. Nevertheless you might want to search the forum.
Good Luck!

Seppuku Arts
Moderator
19
Years of Service
User Offline
Joined: 18th Aug 2004
Location: Cambridgeshire, England
Posted: 10th Jul 2007 16:44 Edited at: 10th Jul 2007 17:02
Cheers, I'm sure I can use the DBP commands to write to the lua document though, as long as I've got line numbers etc. I'm sure I can work something out.

Thanks.

[Edit]
DBP's internal file commands do the trick nicely.

Support the return of Cow-Fishing! Hook up Paris Hilton and die!

Login to post a reply

Server time is: 2024-04-16 21:27:47
Your offset time is: 2024-04-16 21:27:47