RPGDXThe center of Indie-RPG gaming
Not logged in. [log in] [register]
 
 
Post new topic Reply to topic Goto page 1, 2  Next 
View previous topic - View next topic  
Author Message
DeveloperX
202192397


Joined: 04 May 2003
Posts: 1626
Location: Decatur, IL, USA

PostPosted: Wed May 07, 2003 7:48 am    Post subject: Scripting Language [quote]

What is a good start for implementing a scripting language?

I've tried the whole:
$command
%characterchange
concept already (via kakurots tut)

any good advice?
Mind you this will be implemented in either QB or C/C++
Though, remember it is DOS.
_________________
Principal Software Architect
Rambling Indie Games, LLC

See my professional portfolio
Back to top  
DrunkenCoder
Demon Hunter


Joined: 29 May 2002
Posts: 559

PostPosted: Wed May 07, 2003 12:23 pm    Post subject: [quote]

well with the limited data-handling capabilities and the selfimposed limits you're living under I actually dubt that anything more advanced would be really doable esp. If you think in just having it interpreted instead of compiled to bytecode...

but hey, anything that floats your boat...
_________________
If there's life after death there is no death, if there's no death we never live. | ENTP
Back to top  
Tenshi
Everyone's Peachy Lil' Bitch


Joined: 31 May 2002
Posts: 386
Location: Newport News

PostPosted: Wed May 07, 2003 4:10 pm    Post subject: [quote]

- What, you mean you're not going to convert your scripts to byte-code? You can do so much with Byte-codes. Without getting too particular about my scripting engine (done in QB), I have scripts like this:
Code:
MASTER Test Script 2; 0; 0; 0;
script.begin
#load(weather) SNOW
load(map) "Mapper"
script.end

- This is a "master" script. My system allows only for one "master" script , but I allow for up to 9 subscripts ('cause really, I don't need anything beyond that). Since scripts are run straight from the file ( to avoid bytecode errors from trying to load them into XMS, that was pissing me off ), I only need an array of Strings to point to each file being used, and a couple other environment variables, like which script is being parsed currently, and what line it's on, etc. etc. This script here sets up the environment, and then tells it to load the map "Mapper" (The weather line is commented out with the # sign). The map engine starts, and since the script ends, there's not much anything else to do except run around the map until the user ends the game.

- Here's something a bit more in-depth, an item script:
Code:
ITEM Turbo Potion;
script.begin
# Use Engine's target.
acquire_target ON
# Check to see if in battle or not
condition(in_battle) 1 3
# If Has Slot "Medic" (43), then double power.
condition(has_slot) USER USER 43 1 2
set_hp TARGET TARGET + 2000
# Else... normal power.
set_hp TARGET TARGET + 1000
acquire_target OFF
script.end

- My compiler uses a series of tables to turn keywords and numbers into respective byte-codes, and knows whether or not to use one byte, 2, 3, 4, or an arbitrary number, as if for a string ( only allow fixed-length strings, to be easy on myself). It also handles "aliases" and strings differently. ON and "ON" are two different things. A string without quotes means that the compiler should look in the table of "string - value" listings, while with quotes means it should interpret it as-is.

- However, in essense, my scripting engine is very simple, it only handles things as "Command [param, param, param, ...]". I could make it do more, but hey, this is good enough. Commands are set up as Tree + action, for example, Load(map) is under the FILE tree, and is Action #9 or something... so I use two bytes for command.

- Umm, I don't know how useful this was. =T I'm going to be writing an Object-oriented scripting engine, next, but that will be for my MMORPG.
_________________
- Jaeda
Back to top  
akOOma
Wandering Minstrel


Joined: 20 Jun 2002
Posts: 113
Location: Germany

PostPosted: Wed May 07, 2003 7:59 pm    Post subject: [quote]

Hey Tenshi,..,this sounds very interesting. Next time I talk to you per AIM, I will ask you some questions 'bout compiling scriptin' code...
_________________
Keep on codin'
-----------------

-----------------
Just another post to increase my rank...
Back to top  
janus
Mage


Joined: 29 Jun 2002
Posts: 464
Location: Issaquah, WA

PostPosted: Wed May 07, 2003 11:51 pm    Post subject: [quote]

You definitely should try for a bytecode-based system... they're way faster and they use less RAM for parsing.
Back to top  
DrV
Wandering Minstrel


Joined: 15 Apr 2003
Posts: 148
Location: Midwest US

PostPosted: Thu May 08, 2003 12:44 am    Post subject: [quote]

Yeah, even *real* scripting languages (lol) use bytecodes - for example, Perl, and *gasp* VB (before version 5). So they really are a good thing...
_________________
Don't ask no stupid questions and I won't send you away.
If you want to talk fishing, well, I guess that'll be okay.
Back to top  
Rainer Deyke
Demon Hunter


Joined: 05 Jun 2002
Posts: 672

PostPosted: Thu May 08, 2003 12:51 am    Post subject: [quote]

Actually for a small, non-speed-critical scripting language the Interpreter Pattern (see: Design Patterns) can be just as effective as byte-code with less work. My first scripting language was based on the Interpreter Pattern, it only took me a little over a day to write, and it worked really well.
Back to top  
DeveloperX
202192397


Joined: 04 May 2003
Posts: 1626
Location: Decatur, IL, USA

PostPosted: Thu May 08, 2003 3:41 am    Post subject: [quote]

Would someone want to contribute a scripting system to the PROJECT?
(note, PROJECT is the name of the project that I'm working on.)
http://www.freewebs.com/ccps/ffa/

Btw, website has a NEW look!
Hope everyone likes it. :)
_________________
Principal Software Architect
Rambling Indie Games, LLC

See my professional portfolio
Back to top  
Tenshi
Everyone's Peachy Lil' Bitch


Joined: 31 May 2002
Posts: 386
Location: Newport News

PostPosted: Thu May 08, 2003 10:30 pm    Post subject: [quote]

- You can use mine if you like, you'd need to customize portions of it, but it's kind of flexible. It all depends on what it is you're looking for and what kind of functionality you need.
_________________
- Jaeda
Back to top  
DeveloperX
202192397


Joined: 04 May 2003
Posts: 1626
Location: Decatur, IL, USA

PostPosted: Thu May 08, 2003 10:33 pm    Post subject: [quote]

Tenshi wrote:
- You can use mine if you like, you'd need to customize portions of it, but it's kind of flexible. It all depends on what it is you're looking for and what kind of functionality you need.

there a url? or you want to email it to me?
_________________
Principal Software Architect
Rambling Indie Games, LLC

See my professional portfolio
Back to top  
BigManJones
Scholar


Joined: 22 Mar 2003
Posts: 196

PostPosted: Fri May 09, 2003 12:59 am    Post subject: [quote]

There is a really good article in one of the first issues of pixelate about implementing a scripting language. And for C/C++ you can use something like lua (its pretty tough to get going on awindows/gcc compiler though). Scripting was what kept my mini-compo entry from getting submitted :(

Bytecode would be super simple - you can load the entire script and have an array of 'variables' and a p.c. (ie program counter) that would tell you which line is next - by alter the pc you can implement all the control structures (for-next, do-while, while, if then and case) like you would in 68hc11 assembler. You could even have a jump-to-subroutine and return-from-subroutine stack. This should be doable in qbasic (I don't know qbasic though)
Back to top  
janus
Mage


Joined: 29 Jun 2002
Posts: 464
Location: Issaquah, WA

PostPosted: Fri May 09, 2003 6:11 am    Post subject: [quote]

DeveloperX wrote:
Would someone want to contribute a scripting system to the PROJECT?
If it wasn't unplanned and using a decades-old toy language, sure. ;) I'd be glad to help you out, but I'm sure as hell not writing your code for you, especially not in a crippled language I haven't used in nearly 6 years.
Back to top  
akOOma
Wandering Minstrel


Joined: 20 Jun 2002
Posts: 113
Location: Germany

PostPosted: Sat May 10, 2003 11:31 am    Post subject: [quote]

I just want to try something with compiling scripts to bytecode. It would be cool to code something like that..
_________________
Keep on codin'
-----------------

-----------------
Just another post to increase my rank...
Back to top  
Tenshi
Everyone's Peachy Lil' Bitch


Joined: 31 May 2002
Posts: 386
Location: Newport News

PostPosted: Sat May 10, 2003 3:36 pm    Post subject: [quote]

- It's "cool" I guess. The type of scripting I used made for an easy compiler (though I added a billion things to it to make it kinda complex), but if you want to get nasty with complex statements (like X = Y + 1) then I'm not at that point yet. My 32-bit compiler will be.

DeveloperX, I emailed ya.
_________________
- Jaeda
Back to top  
DeveloperX
202192397


Joined: 04 May 2003
Posts: 1626
Location: Decatur, IL, USA

PostPosted: Sun May 11, 2003 5:59 am    Post subject: [quote]

Tenshi wrote:

DeveloperX, I emailed ya.


Uhm, I have no emails from you.

Are you sure that you sent it to the correct address?

ccps@SoftHome.net

is my email address.

I guess you sent it to my hotmail account?
I don't use it for email, only MSN Messenger.
_________________
Principal Software Architect
Rambling Indie Games, LLC

See my professional portfolio
Back to top  
Post new topic Reply to topic Page 1 of 2 All times are GMT
Goto page 1, 2  Next 



Display posts from previous:   
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum