Scripting in my project
Posted: Wed Sep 09, 2009 12:57
Hi! I'm new to the forum, but not all new to CEGUI.
I've been working on a moderately small project with some people from my town. The game we're making is about two years old and is starting to shape up.
It's a round-based strategy game, and now the GUI-system is getting redone...by me.
Since the gui changes a lot between different states, we need a swift and versatile solution to handeling the gui. Instead of creating a bunch of buttons and images at each InitState(),
we wan't to be able to load a premade gui-file with all the necessary data.
This shouldn't be a problem for me. The problem is with scripting the buttons. As you can imagine, we have a bunch of different buttons, all with different behaviours.
Since we are a small "novice"-studio, we have no real experience from the industry, but after some researching, I've gotten the impression that scripting is The Way To Go.
So I have some questions: Can the script-file access any code in the system, or do I have to "expose" the functions I want to use in some way?
For example: I have a button that is used to select a specific soldier in the world (Each soldier will have it's own button like this). When I push a button, I want a script-function to run, which in turn
tells the game to runt the functions to actually make that soldier the selected one.
How do I go about writing the scriptfile? Do I just open up notepad and start scribbling away, and then save it as "btnPush.lua"?
I've read the tutorials, but they really didn't provide all the answers I needed.
Regards
Christoffer
ps. Sorry if my english is bad. I'm from sweden =P
I've been working on a moderately small project with some people from my town. The game we're making is about two years old and is starting to shape up.
It's a round-based strategy game, and now the GUI-system is getting redone...by me.
Since the gui changes a lot between different states, we need a swift and versatile solution to handeling the gui. Instead of creating a bunch of buttons and images at each InitState(),
we wan't to be able to load a premade gui-file with all the necessary data.
This shouldn't be a problem for me. The problem is with scripting the buttons. As you can imagine, we have a bunch of different buttons, all with different behaviours.
Since we are a small "novice"-studio, we have no real experience from the industry, but after some researching, I've gotten the impression that scripting is The Way To Go.
So I have some questions: Can the script-file access any code in the system, or do I have to "expose" the functions I want to use in some way?
For example: I have a button that is used to select a specific soldier in the world (Each soldier will have it's own button like this). When I push a button, I want a script-function to run, which in turn
tells the game to runt the functions to actually make that soldier the selected one.
How do I go about writing the scriptfile? Do I just open up notepad and start scribbling away, and then save it as "btnPush.lua"?
I've read the tutorials, but they really didn't provide all the answers I needed.
Regards
Christoffer
ps. Sorry if my english is bad. I'm from sweden =P