I want to be able to give a script context a pointer to a class, and then have that class passed to all the functions called in that script without the user having to pass it manually.
so I can have an enemy script like this:
// spider.script
int main()
{
if(get_health() < 10)
{
escape();
}
else
{
// attack!!
}
}
where "get_health()" looks something like this:
int get_health(void *pointer_to_class)
{
return pointer_to_class->health;
}
Then I can have one script for each type of enemy, then in my program loop through each game_entity and call the relevant module, passing a pointer to itself.
I hope that made sense. If there's a way better way of doing it, let me know, but I want to keep it relatively high level and avoid using OOP style scripting...