Hi. I have a header
struct GlobalTime {
writeprotected int second;
writeprotected int minute;
import attribute int Second;
import attribute int Minute;
}
a script
int get_Second(this GlobalTime*)
{
return this.second;
}
int get_Minute(this GlobalTime*)
{
return this.minute;
}
void set_Second(this GlobalTime*, int second)
{
while (second >=60)
{
second-=60;
this.set_Minute(this.get_Minute() + 1);
//Game don't allow to use attribute in script where I do a attribute definition, but this line do a error
//'.set_Minute' is not a public member of 'GlobalTime'. Are you sure you spelt it correctly (remember, capital letters are important)?
}
this.second = second;
}
void set_Minute(this GlobalTime*, int minute)
{
while (minute >=60)
{
minute-=60;
}
this.minute = minute;
}
You just need to move the definition of the set_Minute extender method to be above the definition of set_Second. AGS can't call functions that have been imported (declared) but not yet defined (:~().
P.S. writeprotected members are public (for reading, not setting, obviously). You probably don't want to expose the same member in two different ways. Either use a writeprotected member with a SetMember public function OR make the member protected instead.
Quote from: monkey0506 on Thu 29/06/2017 10:17:45
You just need to move the definition of the set_Minute extender method to be above the definition of set_Second. AGS can't call functions that have been imported (declared) but not yet defined (:~().
P.S. writeprotected members are public (for reading, not setting, obviously). You probably don't want to expose the same member in two different ways. Either use a writeprotected member with a SetMember public function OR make the member protected instead.
Thanks, it is work.