Call Memberfunction in rep_execute?

Started by Rocco, Fri 08/08/2008 12:21:14

Previous topic - Next topic

Rocco

I dont know if its my fault - but maybe its a bug.

here is an short example what i did and whats going on -

module header -
Code: ags

struct Test {

import function SetRunIntervall(int day_intervall, int timer = 14);
bool timer_activ;
};

Test calendar;
export calendar;


module script
Code: ags

function Test::SetRunIntervall(int day_intervall, int used_timer)
{
  
  this.timer_activ = true;
    player.Say("%d - this-timer, %d - calendar_timer", this.timer_activ,  calendar.timer_activ);
} 


and then in players enters screen after fade in
Code: ags

calendar.SetRunIntervall(100);

thats it -  and the result is
1 - this-timer, 0 - calendar_timer

i loaded an example up here ->  http://share-now.net/files/29323-this-test.zip.html

Khris

That's the error right there:
Quote from: Rocco on Sat 09/08/2008 10:14:23
module header -
Code: ags
...
Test calendar;
export calendar;

Move that to the module script and put "import Test calendar;" into the header.

Don't declare stuff in the header because the header is put an top of every other script, thus creating many variables with the same name if you declare them inside.

Rocco

Big thx, that was the mistake  ::)  :),
it seems that now all is working as it should be. :)

SMF spam blocked by CleanTalk