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 / how to make scripting system

Author
Message
nruser
18
Years of Service
User Offline
Joined: 22nd Dec 2007
Location: Serbia
Posted: 10th Jun 2011 02:30
i was thinking about making a scripting system for my game, but i don't know how could i make dbp read the file like



and execute it in real time, this is sample script file all it should do is to print text line in console of the game?

How could i get this to work?

i had an idea of dbp reading line by line and storing function in array or something and then execute it on call time from another script like PrintString() but i don't know how to do this.
Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 10th Jun 2011 03:14 Edited at: 10th Jun 2011 03:16
I think the most reliable and flexible way to do this would be through an LUA plugin. I have little experience with LUA, and I've never used LUA with DBPro, so... I couldn't help you much with the details. I do know there are some LUA plugins out there:
http://forum.thegamecreators.com/?m=forum_view&t=126843&b=5


I think it would be overall less painful.

[edit]
I say less painful, because the two options I can think of are
(1) create your own language, then figure out how to parse it, then figure out how to execute it or
(2) learn LUA syntax and install a plugin


Why does blue text appear every time you are near?
MayoZebraHat 1979
18
Years of Service
User Offline
Joined: 21st Dec 2007
Location:
Posted: 10th Jun 2011 07:53
Making a scripting language could be fun but it's quicker to learn a scripting language that exists that come up with all the abilities on your own. And it's next to "A bad idea" to try and write a well featured scripting system in DBPro. Best to do it in a plugin... and that requires C++ or PureBasic.

The free Lua plugin works great. I've made a complete console for a game letting me set params and "GOD mode" and added some OOP-like elements in there. Scripting is great when you need code that doens't have to be recompiled while editing. But it won't execute along side the DBPro code, it halts the execution. I think I've heard of a scripting plugin that costs money that might but I cannot recall the name... something like monkeyscript...
BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 10th Jun 2011 09:19
I used Lua for my game that on the Touch-Typing publication. It generates an entire story that can be changed by editing the script. In the time it takes to create your own scripting parser, you can have churned out several games with Lua.

Dark Dragon
19
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 10th Jun 2011 23:21
I got frustrated with Lua a while back, not Lua it self, but the Unity plugin for DBP that allows you to use it. When it comes to 3d stuff, its totally easy as heck to implement and control objects from scripts(Because of the built-in commands)! But in the way of 2d Sprites,to this day im still confused......but hey, it probaly is easier for you to just get Unity than code a scripting langauge yourself!

Login to post a reply

Server time is: 2026-07-11 02:14:04
Your offset time is: 2026-07-11 02:14:04