Hello, it's Metalclunch here, and I've got a pretty simple and straightforward question: How would one implement a scripting language? Prefferably Python. Thing is, I'm pretty much a beginner, I know about the if, else if, for, while statements and functions.
Okay. Here goes. I've made a very simple text-based game. I've also got a .cfg (Configuration) file all set up, so I know (atleast) something. My game is around 400 lines of text (I have a LOT of functions), and I just feel that all the If and Else If stuff is simply cluttering it up and making it un-readable.
This is why I want to implement a scripting language. Here's some of my ideas.
[B]In C++.[/B]
if (ComputerStamina < 15) {
while (ComputerStamina < 35) {
ComputerStamina++; }
}
[B]In the Python scripting file.[/B]
(begin), #Begin the script.
(lt, "$ComputerStamina", 15), #If the global variable ($) is less than 15, continue.
(while|lt, "$ComputerStamina", 35), #While ComputerStamina is less than 35, continue.
(value_add, "$ComputerStamina", 1), #Add the value of 1 to ComputerStamina.
(end), #End the script.
I hope you understand what I aim to. Then, the game would read the infromation from the .py script file. Does anyone have any ideas how to implement this kind of system? Any kind of links to good articles or something?
Thanking ahead,
metalclunch.