by ender » Mon May 19, 2008 10:17 am
Code from VCM
Method : GetMood
Parameters : int min, int max
Random rand = new Random();
int num = rand.Next(min, max);
return num;
Code from _Startup
<?csharp
vars['happy'] = Mood.GetMood(1,10);
vars['ego'] = Mood.GetMood(1,10);
?>
When this runs both Ego and Happy = the same.
I've tried several things to get around this problem.
I wrote two new methods called: GetEgo and GetHappy with different variable names and still they equaled the same. I tried calling one from _Startup and then one from _startup2 ... using a send from _Startup ... still got the same number. I tried taking out the min,max and having them hard coded ... One time, just to see what would happen, I tried happy at 1,10 and ego at 1,20 and .... happy = 7 and ego = 14.... I ran startup again and got ... happy = 5 and ego = 10...
No idea whats going on.
---------
At any rate, it sounds like you and I are trying to do different things ... I am trying to set the bots mood at startup ... thats all. Then, various inputs effect the bots mood .... for instance, if I say its stupid then its happy goes down by 1 point ... If I say its smart then its happy goes up by 1 point. Then I have other rules that use 'happy' as a condition using something like "int.Parse(vars["Happy"]) >= 8"... which then runs that output if the bots happy is greater than or equal to 8 ...
The idea of the 'random at startup' is to account for the things that happen between the time we talk to a person ... since typically people are NOT in the same mood now as when we talked to them last.
Eventually, this will get more complex, with each variable having 100 points and potentially having several factors effect mood at startup ... i.e. time of day, length between conversations, etc.
I might even try to figure out how to have a effect variable... since sometimes when we talk to people, what we say has a greater impact or lesser impact than other times .... i.e. maybe one time I talk to the bot and say its smart that gives it 2 points of happy, but the next time it gives 1 or even 0, and then another 5 or 10 points... but thats a while a way ... right now I am just testing the basic concept before investing to much time in developing it.
The way I have decided to currently solve my problem with the random numbers is to have mood SETS ... so if GetMood() returns 6 then happy = 5 and ego = 4 ... which actually is more true to real life, as I'm eventually planning to add in things like anger, bored, etc ... and it would be kind of strange to have the bot have a 10 in happy and 8 in anger... since those two emotions, while different, are mutually exclusive.