Author |
Message |
Doggeti Server Help Squatter
Age:39 Gender: Joined: Jan 12 2003 Posts: 297 Location: Germany Offline
|
Posted: Wed Jan 22, 2003 2:17 pm Post subject: Own variables in MERVBot DLL |
|
|
|
|
Here is what I made:
In spawn.h I added in class-definition of botInfo:
int goals[2];
and
goals[0] = 0;
goals[1] = 0;
In spawn.cpp I changed in botInfo::gotEvent the case EVENT_SoccerGoal. It now looks like this:
int team = *(int*)&event.p[0];
int reward = *(int*)&event.p[1];
goals[team]++;
String s;
s = "SCORE - Evens: ";
s += goals[0];
s += " Odds: ";
s += goals[1];
sendPublic(s);
But the Bot doesn't display the message when I score.
|
|
Back to top |
|
|
SOS Server Help Squatter
Joined: Dec 02 2002 Posts: 329 Offline
|
Posted: Wed Jan 22, 2003 3:01 pm Post subject: |
|
|
|
|
Looks fine here...
Maybe you are not loading the dll into the bot? _________________ 3y3 4m l33t h4x0r
j0! 3y3 4m t4lking to j00!
fux0red 5cr1pt k1dd13.
-"l33t h41ku"
|
|
Back to top |
|
|
catid Guest
Offline
|
Posted: Thu Jan 23, 2003 9:42 am Post subject: blah |
|
|
|
|
try sending it as an arena message. prefix "*arena".
i think there might be a problem with plain old public messages, lemme check it out
|
|
Back to top |
|
|
Doggeti Server Help Squatter
Age:39 Gender: Joined: Jan 12 2003 Posts: 297 Location: Germany Offline
|
Posted: Thu Jan 23, 2003 1:25 pm Post subject: |
|
|
|
|
I changed it to this:
int team = *(int*)&event.p[0];
int reward = *(int*)&event.p[1];
goals[team]++;
String s;
s = "*arena SCORE - Evens: ";
s += goals[0];
s += " Odds: ";
s += goals[1];
sendPublic(s);
is that what you meant? (it doesn't work)
|
|
Back to top |
|
|
SOS Server Help Squatter
Joined: Dec 02 2002 Posts: 329 Offline
|
Posted: Thu Jan 23, 2003 1:37 pm Post subject: |
|
|
|
|
Try putting a breakpoint there. Am thinkink that maybe it is not beink run for some reason.
|
|
Back to top |
|
|
Doggeti Server Help Squatter
Age:39 Gender: Joined: Jan 12 2003 Posts: 297 Location: Germany Offline
|
Posted: Thu Jan 23, 2003 2:11 pm Post subject: |
|
|
|
|
where exactly you want me to put it?
|
|
Back to top |
|
|
SOS Server Help Squatter
Joined: Dec 02 2002 Posts: 329 Offline
|
Posted: Fri Jan 24, 2003 1:00 am Post subject: |
|
|
|
|
Any of those lines under EVENT_SoccerGoal
|
|
Back to top |
|
|
Guest
Offline
|
Posted: Fri Jan 24, 2003 5:44 am Post subject: |
|
|
|
|
Doggeti wrote: | I changed it to this:
int team = *(int*)&event.p[0];
int reward = *(int*)&event.p[1];
goals[team]++;
String s;
s = "*arena SCORE - Evens: ";
s += goals[0];
s += " Odds: ";
s += goals[1];
sendPublic(s);
is that what you meant? (it doesn't work) |
It does have staff access right? Just checking
|
|
Back to top |
|
|
Doggeti Server Help Squatter
Age:39 Gender: Joined: Jan 12 2003 Posts: 297 Location: Germany Offline
|
Posted: Fri Jan 24, 2003 5:55 am Post subject: |
|
|
|
|
The bot acctually has mod-access and as i read in www.shanky.com/server/commands.html this should be enough for *arena command.
I will try it with higher levels and post it later whether it worked or not.
|
|
Back to top |
|
|
Doggeti Server Help Squatter
Age:39 Gender: Joined: Jan 12 2003 Posts: 297 Location: Germany Offline
|
Posted: Fri Jan 24, 2003 6:18 am Post subject: |
|
|
|
|
I gave Smod and after that SysOp powers to the bot but that didn't help.
|
|
Back to top |
|
|
Mine GO BOOM Hunch Hunch What What
Age:40 Gender: Joined: Aug 01 2002 Posts: 3614 Location: Las Vegas Offline
|
Posted: Fri Jan 24, 2003 9:19 am Post subject: |
|
|
|
|
You might want to just try to send a test public message before and afterwards, to see if the bot screwed up somewhere around it. Before and after that code section, just send a public message like "test1", and after it, send something like "test2". If it only sends test1, your code is wrong somehow. If it sends test1 and test2, then your goal[0] isn't being added to the string correctly.
|
|
Back to top |
|
|
Doggeti Server Help Squatter
Age:39 Gender: Joined: Jan 12 2003 Posts: 297 Location: Germany Offline
|
Posted: Sat Jan 25, 2003 4:47 am Post subject: |
|
|
|
|
I now tried this as well but the bot doesn't say anything. The only thing that works until now are private messages when player enter the arena.
|
|
Back to top |
|
|
SOS Server Help Squatter
Joined: Dec 02 2002 Posts: 329 Offline
|
Posted: Sat Jan 25, 2003 5:32 am Post subject: |
|
|
|
|
Erm... well maybe you have messed something up there.
Post the entire gotEvent() function
|
|
Back to top |
|
|
Doggeti Server Help Squatter
Age:39 Gender: Joined: Jan 12 2003 Posts: 297 Location: Germany Offline
|
Posted: Sat Jan 25, 2003 8:50 am Post subject: |
|
|
|
|
Ok, here are the both case-blocks I have changed so far:
case EVENT_SoccerGoal:
{
int team = *(int*)&event.p[0];
int reward = *(int*)&event.p[1];
goals[team]++;
String s;
s = "SCORE - Evens: ";
s += goals[0];
s += " Odds: ";
s += goals[1];
sendPublic(s);
}
break; |
and
case EVENT_PlayerEntering:
{
Player *p = (Player*)event.p[0];
String s;
s = "Hello ";
s += p->name;
s += "!";
sendPrivate(p, s);
}
break; |
As I said, the code in EVENT_PlayerEntering works but not the one in EVENT_SoccerGoal
|
|
Back to top |
|
|
VampZ Guest
Offline
|
Posted: Sat Jan 25, 2003 12:14 pm Post subject: |
|
|
|
|
The Soccer Goal Event doesn't happen when a soccer goal is scored. just put a simple sendPublic("Goal Scored"); to prove it. Dunno what to tell you.
|
|
Back to top |
|
|
Doggeti Server Help Squatter
Age:39 Gender: Joined: Jan 12 2003 Posts: 297 Location: Germany Offline
|
|
Back to top |
|
|
SOS Server Help Squatter
Joined: Dec 02 2002 Posts: 329 Offline
|
Posted: Sun Jan 26, 2003 7:56 am Post subject: |
|
|
|
|
callback tells the EXE that you want to do something. It's in the EXE source.
Quote: | Now I know the problem is not that EVENT_SoccerGoal doesn't get called; |
And you say this because... why?
sendPublic() works fine for everyone else...
Are you using all latest sources?
|
|
Back to top |
|
|
Doggeti Server Help Squatter
Age:39 Gender: Joined: Jan 12 2003 Posts: 297 Location: Germany Offline
|
Posted: Sun Jan 26, 2003 10:44 am Post subject: |
|
|
|
|
Yes. I am using the latest source directly from catid.sscentral.com.
Ok, you are right. i can't tell if the EVENT_SoccerGoal gets called or not but i can be sure that something must be wrong with the function 'sendPublic' or may way of using it .
|
|
Back to top |
|
|
SOS Server Help Squatter
Joined: Dec 02 2002 Posts: 329 Offline
|
Posted: Sun Jan 26, 2003 11:59 am Post subject: |
|
|
|
|
No, you can't
There's nothing special to use about it, so that's out...
As I said, post the entire getEvent() function and I might be able to find the error
|
|
Back to top |
|
|
Doggeti Server Help Squatter
Age:39 Gender: Joined: Jan 12 2003 Posts: 297 Location: Germany Offline
|
Posted: Mon Jan 27, 2003 9:39 am Post subject: |
|
|
|
|
OK. Though I don't know why you need the entire code here you have it (it's my spawn.cpp in attachment). I think that's the file that contains 'gotEvent'. If not please don't slap me
spawn.cpp - 10.77 KB
File downloaded or viewed 65 time(s)
|
|
Back to top |
|
|
tikiman Newbie
Joined: Jan 25 2003 Posts: 14 Offline
|
Posted: Tue Jan 28, 2003 4:03 am Post subject: |
|
|
|
|
Has anyone gotten this working? I tried it similar to the way Doggeti did and I have the same problem: sendPrivate seems to work, sendPublic doesn't, no matter where I put it.
I looked up the !say command that comes with the bot core. It's in command.cpp and the only difference is that it gets passed a Host object and uses the Host sendPublic() function like the following:
h->sendPublic("hi");
If h is of type Host*. I tried creating one of these in spawn.cpp but with multiple errors. Here's what I did.
Host* h = new Host;
h->sendPublic("hi");
It doesn't seem to work. My C++ is really rusty though so that may be completely wrong.
|
|
Back to top |
|
|
SOS Server Help Squatter
Joined: Dec 02 2002 Posts: 329 Offline
|
Posted: Tue Jan 28, 2003 8:47 am Post subject: |
|
|
|
|
Well, sendPublic() always worked for me and it has not changed in the latest MERV versions...
A thought occurs: Can people talk public chat in your zone? There is that bug where only moderators can use public chat. Hrm, altough usually bots have staff access... so I dunno...
|
|
Back to top |
|
|
Dr Brain Flip-flopping like a wind surfer
Age:38 Gender: Joined: Dec 01 2002 Posts: 3502 Location: Hyperspace Offline
|
Posted: Tue Jan 28, 2003 9:45 am Post subject: |
|
|
|
|
It works for me too, altho I have not tested it with the latest MERV version.
I HATE that pub chat bug, I had an event in my zone with 10 people, and I was the only one talkin... I thought they just didn't like speaking. _________________ Hyperspace Owner
Smong> so long as 99% deaths feel lame it will always be hyperspace to me
|
|
Back to top |
|
|
ExplodyThingy Server Help Squatter
Age:37 Gender: Joined: Dec 15 2002 Posts: 528 Location: Washington DC Offline
|
Posted: Tue Jan 28, 2003 11:10 am Post subject: |
|
|
|
|
Since we dont seem to know the source of the problem, ever thought of doing a sendTeam(); or similar to see if that event is called? That will tell you if its the event or sendPublic(); _________________ There are no stupid question, but there are many inquisitive idiots.
Loot
Dr Brain> I hate clean air and clean water. I'm a member of Evil Conservitive Industries
|
|
Back to top |
|
|
Doggeti Server Help Squatter
Age:39 Gender: Joined: Jan 12 2003 Posts: 297 Location: Germany Offline
|
Posted: Tue Jan 28, 2003 3:00 pm Post subject: |
|
|
|
|
LOL! I put sendTeam(s); into EVENT_SoccerGoal as Explody suggested and it didn't work.
SoccerGoal happens when the powerball crosses the goal-tile, right?
|
|
Back to top |
|
|
|