• Create Account

### #ActualBow_vernon

Posted 17 August 2013 - 11:46 AM

Hi all, I have a problem now. I design that in the game, I'll have one global module (that is where I store functions that another module can call), and many "static" module. I need the "static" module to be able to refer to the "global" module such as :

//global.as
//this is where I define a set of "default" function
void def_item_drop_behavior()
{
//do something generic
}

//sword.as

void on_drop()
{
//do something that is "sword" specific
blah();
//do something that every item would do when dropped
def_item_drop_behavior();
}

//potion.as

void on_drop()
{
//do something "potion" specific
blah();
//do something that every item would do when dropped
def_item_drop_behavior();
}


now I'm at lost at how I'm supposed to do this. Any insight?

EDIT : I'm using angelscript of course, I recently see the sample on the SDK. The #include sample basically, it allowed me to reuse code, but I don't want to duplicate variables. I need the variables in the "global" module to be shared/referenced by the other script. That's what I'm pursuing.

I'm rethinking my approach now, so feel free to give suggestions. Thanks a bunch!!

### #3Bow_vernon

Posted 17 August 2013 - 11:46 AM

Hi all, I have a problem now. I design that in the game, I'll have one global module (that is where I store functions that another module can call), and many "static" module. I need the "static" module to be able to refer to the "global" module such as :

//global.as
//this is where I define a set of "default" function
void def_item_drop_behavior()
{
//do something generic
}

//sword.as

void on_drop()
{
//do something that is "sword" specific
blah();
//do something that every item would do when dropped
def_item_drop_behavior();
}

//potion.as

void on_drop()
{
//do something "potion" specific
blah();
//do something that every item would do when dropped
def_item_drop_behavior();
}


now I'm at lost at how I'm supposed to do this. Any insight?

EDIT : I'm using angelscript of course, I recently see the sample on the SDK. The #include sample basically, it allowed me to reuse code, but I don't want to duplicate variables. I need the variables in the "global" module to be shared/referenced by the other script. That's what I'm pursuing.

I'm rethinking my approach now, so feel free to give suggestions. Thanks a bunch!!

### #2Bow_vernon

Posted 17 August 2013 - 11:05 AM

Hi all, I have a problem now. I design that in the game, I'll have one global module (that is where I store functions that another module can call), and many "static" module. I need the "static" module to be able to refer to the "global" module such as :

//global.as
//this is where I define a set of "default" function
void def_item_drop_behavior()
{
//do something generic
}

//sword.as

void on_drop()
{
//do something that is "sword" specific
blah();
//do something that every item would do when dropped
def_item_drop_behavior();
}

//potion.as

void on_drop()
{
//do something "potion" specific
blah();
//do something that every item would do when dropped
def_item_drop_behavior();
}


now I'm at lost at how I'm supposed to do this. Any insight?

### #1Bow_vernon

Posted 17 August 2013 - 05:04 AM

Hi all, I have a problem now. I design that in the game, I'll have one global module (that is where I store functions that another module can call), and many "static" module. I need the "static" module to be able to refer to the "global" module such as :

//global.as
//this is where I define a set of "default" function
void def_item_drop_behavior()
{
//do something generic
}

//sword.as

void on_drop()
{
//do something that is "sword" specific
blah();
//do something that every item would do when dropped
def_item_drop_behavior();
}

//potion.as

void on_drop()
{
//do something "potion" specific
blah();
//do something that every item would do when dropped
def_item_drop_behavior();
}


now I'm at lost at how I'm supposed to do this. Any insight?

PARTNERS