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.

Newcomers DBPro Corner / Scripting?

Author
Message
Luminence
20
Years of Service
User Offline
Joined: 31st Jul 2004
Location:
Posted: 1st Aug 2004 00:59
Anybody have a snippet or ideas on how to implement a simple parser/scripting languege in dark basic pro?
zircher
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 1st Aug 2004 12:02
It's really a matter of looping through a SELECT command as you run your script on loading or as part of the main loop. The coding is simple, if brute force. The challenge with scripting is in the design of the script language and making the parser fault tolerate.

Usually, anyone's script code is very problem/program specific and you will usually end up totally re-writing their parser anyway. Are you looking for a loading script or something like an in-game AI script?
--
TAZ

"Do you think it is wise to provoke him?" "It's what I do." -- Stargate SG-1
Luminence
20
Years of Service
User Offline
Joined: 31st Jul 2004
Location:
Posted: 2nd Aug 2004 00:01
It's going to handle entities(enemie's, NPC's and objects), Dialogue, Events(triggers), AI and Maps. I was thinking of using a large 1,1024 array where each slot is a type. This type will hold two strings, the type of command(varible, command or block), the next string would hold the name of the block, varible or command. Then there would be 4 floats for holding parameters for the commands.
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 2nd Aug 2004 00:03
http://www.flipcode.com/tutorials/tut_scr01.shtml

There are about 8 sections to that tutorial. It explains how to make a scripting engine, but with C.

Get 15 new commands, all the date / time commands left out of DBPro for free!
DOWNLOAD PLUGINS HERE: http://www.davidtattersall.me.uk/ and select "DarkBasic"
Luminence
20
Years of Service
User Offline
Joined: 31st Jul 2004
Location:
Posted: 2nd Aug 2004 01:05
Thanks, I'd get to work on it but I'm pretty sick right now.
Luminence
20
Years of Service
User Offline
Joined: 31st Jul 2004
Location:
Posted: 2nd Aug 2004 01:18
Hey zircher, could you show me an example of the select statement? I looked at help but I still don't get it. Thanks.
Emperor Baal
20
Years of Service
User Offline
Joined: 1st Dec 2003
Location: The Netherlands - Oudenbosch
Posted: 2nd Aug 2004 01:26
just use something like this:



if the computer reads move it will move object 1. Pretty simple. Here's the code I use in DarkZ as basic script interpreter:
(its not commented)



This piece of code can read and execute 4 instructions, depending on the letter it reads. This is the level1.txt script:





zircher
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 2nd Aug 2004 02:27 Edited at: 2nd Aug 2004 02:30
Good job, Emperor Baal.

Azur3, if you want a gory example of loading script code that will build a 'level' on the fly, feel free to check out the VirMin pre-beta here: http://games.groups.yahoo.com/group/virmin/

VirMin source code, binaries, and sample data are in the file section.
--
TAZ

"Do you think it is wise to provoke him?" "It's what I do." -- Stargate SG-1
Luminence
20
Years of Service
User Offline
Joined: 31st Jul 2004
Location:
Posted: 2nd Aug 2004 03:20
Thanks for the help.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 2nd Aug 2004 05:00
You could check out my string tokenizer in the codebase for parsing strings.

"eureka" - Archimedes
Luminence
20
Years of Service
User Offline
Joined: 31st Jul 2004
Location:
Posted: 2nd Aug 2004 07:14 Edited at: 2nd Aug 2004 07:15
I'll look into that, Phaelax.

Login to post a reply

Server time is: 2024-11-27 04:51:31
Your offset time is: 2024-11-27 04:51:31