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 Discussion / Come, RPG Boffins, Share your wisdom...

Author
Message
Dmitri
21
Years of Service
User Offline
Joined: 27th Nov 2003
Location:
Posted: 27th Nov 2003 09:21
Hi,

I'm currently working on a 2D rpg/adventure game and attempting to create a scripting language.

My question is this: How would one go about transferring a variable from the script to the main program? I need some way of labelling the variable in the script so that the main program knows which variable to use.

For instance, my script says "if x = 1 then move hero up 20". I've got the program to recognise the IF THEN bit, and will move the hero up 20 pixels, but how do I get it to recognise the variable x?

If anyone understands what I mean and knows a way to do it I would be very grateful for some much-needed guidance.

It's a long story and there's no punchline...
JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 27th Nov 2003 19:59
i understand what you mean, but i dont know how, sorry

=<=Pudgie Wars=>=
Game engine: 20% = Models: 25% = Textures: 1% = Sounds/Music: 0% = www.geocities.com/bigapple_entertainment
Dmitri
21
Years of Service
User Offline
Joined: 27th Nov 2003
Location:
Posted: 28th Nov 2003 07:08
Thanks anyway, Darwin. I think I have an idea how to do it, but I've not tried it yet. Basically, I was thinking that any variable that I need will either be -

A) linked to a specific command, e.g. the script's "place hero" command will always use the variables hero_x and hero_y.

or

B) the variable will be set within another script, e.g. a variable that says whether or not the hero has completed a certain task.

In this case, it should be possible to create an array from the variables defined within the scripts and retrieve my data from that. As I said, haven't tried it yet so cross your fingers for me.

It's a long story and there's no punchline...
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 4th Dec 2003 06:34
if your refering to a script like interface to handle monsters per say as an example then you can do this

lets say we have a folder that stores monster files

Folder name MonsterDATA

lets say we have a file for each monster and the file data is always the same for each monster

monsterfilename.mos

reading in the data may look like this

monster_name
monster_hps
monster_def
monster_exp
monster_gold
monster_x
monster_y
monster_z


the file may look like this

bugbear
54
20
100
34
100
0
100

you can tell the computer to read this data into the system and also calculate dynamically how many files there are in a given folder so this maximum number becomes the maximum recorded monster files you want to import into your game.

Login to post a reply

Server time is: 2025-05-22 08:31:08
Your offset time is: 2025-05-22 08:31:08