Hello, I was advised to create a script file and parse it when loading the game and when speaking to other characters. What is the best way to create this file and use it. What are some good methods to use. If there are any tutorials out there too please point me to them.
script file for an RPG game
BlitzMax Forums/BlitzMax Programming/script file for an RPG game Check the LUA tutorials on the Wiki.
http://www.blitzwiki.org/index.php/Lua_Tutorial
http://www.blitzwiki.org/index.php/Introduction_to_Lua
http://www.blitzwiki.org/index.php/Lua_Tutorial
http://www.blitzwiki.org/index.php/Introduction_to_Lua
LUA is a very good solution. But it's more fun to make your own scripting language.
If LUA is a little too much for you, check the boards for BPScript module.
A "far easier" language to get in as it is basic with not that much "super power present" as in LUA :-)
A "far easier" language to get in as it is basic with not that much "super power present" as in LUA :-)
LUA is a very good solution. But it's more fun to make your own scripting language.
I must concur. I thought learning something premade might be the easier solution here ( although I have no experience with LUA, so I may be wrong ) but it's definitely more fun to come up with your own.
I'm coding a scripting language of my own right now infact
I think its better to do it this way because you can custom tune your language to work with your own engine
Heres the basics:
Fist Open the File
Use ReadLine to scan through it
Use:
[CODE]
Repeat
Command$ = Left(LineFromFile,Len(Command)+1)
Until Right(Command,1) = CharacterUsedForEndOfCommand
[/CODE]
To identify your commands
And then to begin with you can have a simple Select Block to carry them out, but as the list of commands grow you will need a slightly more complex system
I think its better to do it this way because you can custom tune your language to work with your own engine
Heres the basics:
Fist Open the File
Use ReadLine to scan through it
Use:
[CODE]
Repeat
Command$ = Left(LineFromFile,Len(Command)+1)
Until Right(Command,1) = CharacterUsedForEndOfCommand
[/CODE]
To identify your commands
And then to begin with you can have a simple Select Block to carry them out, but as the list of commands grow you will need a slightly more complex system
If you want to roll your own, Why not look into the design and implementation of virtual machines? It can be quite a useful experience to code your own compiler/assembler/interpreter.
If your not into that kinda thing though, i guess LUA is easier ;)
If your not into that kinda thing though, i guess LUA is easier ;)
If LUA is a little too much for you, check the boards for BPScript module.
The topic on the boards is outdated a little (not a huge amount though, I scrapped this in favour of a writing a more organized and optimized one shortly after posting it here.), you can get the newer version here (name has been changed). It comes with the full source to the VM and compiler, so feel free to change it to your preferences.
http://www.binaryphoenix.com/?action=software&step=view&id=11
You can also download a wrapper for the Squirrel programming language here.
http://www.binaryphoenix.com/?action=software&step=view&id=6
Hope thats of help.