Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
Own variables in MERVBot DLL
Goto page 1, 2  Next
 
Post new topic   Reply to topic Printable version
 View previous topic  Help with the Pball Post :: Post Player Position Detection  View next topic  
Author Message
Doggeti
Server Help Squatter


Age:39
Gender:Gender:Male
Joined: Jan 12 2003
Posts: 297
Location: Germany
Offline

PostPosted: Wed Jan 22, 2003 2:17 pm    Post subject: Own variables in MERVBot DLL Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List Send email AIM Address
SOS
Server Help Squatter


Joined: Dec 02 2002
Posts: 329
Offline

PostPosted: Wed Jan 22, 2003 3:01 pm    Post subject: Reply to topic Reply with quote

Looks fine here...
Maybe you are not loading the dll into the bot? sa_tongue.gif
_________________
3y3 4m l33t h4x0r
j0! 3y3 4m t4lking to j00!
fux0red 5cr1pt k1dd13.
-"l33t h41ku"
Back to top
View users profile Send private message Add User to Ignore List Send email
catid
Guest


Offline

PostPosted: Thu Jan 23, 2003 9:42 am    Post subject: blah Reply to topic Reply with quote

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:Gender:Male
Joined: Jan 12 2003
Posts: 297
Location: Germany
Offline

PostPosted: Thu Jan 23, 2003 1:25 pm    Post subject: Reply to topic Reply with quote

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) new_puppy_dog_eyes.gif
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
SOS
Server Help Squatter


Joined: Dec 02 2002
Posts: 329
Offline

PostPosted: Thu Jan 23, 2003 1:37 pm    Post subject: Reply to topic Reply with quote

Try putting a breakpoint there. Am thinkink that maybe it is not beink run for some reason.
Back to top
View users profile Send private message Add User to Ignore List Send email
Doggeti
Server Help Squatter


Age:39
Gender:Gender:Male
Joined: Jan 12 2003
Posts: 297
Location: Germany
Offline

PostPosted: Thu Jan 23, 2003 2:11 pm    Post subject: Reply to topic Reply with quote

where exactly you want me to put it?
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
SOS
Server Help Squatter


Joined: Dec 02 2002
Posts: 329
Offline

PostPosted: Fri Jan 24, 2003 1:00 am    Post subject: Reply to topic Reply with quote

Any of those lines under EVENT_SoccerGoal
Back to top
View users profile Send private message Add User to Ignore List Send email
Guest



Offline

PostPosted: Fri Jan 24, 2003 5:44 am    Post subject: Reply to topic Reply with quote

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) new_puppy_dog_eyes.gif


It does have staff access right? Just checking
Back to top
Doggeti
Server Help Squatter


Age:39
Gender:Gender:Male
Joined: Jan 12 2003
Posts: 297
Location: Germany
Offline

PostPosted: Fri Jan 24, 2003 5:55 am    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List Send email AIM Address
Doggeti
Server Help Squatter


Age:39
Gender:Gender:Male
Joined: Jan 12 2003
Posts: 297
Location: Germany
Offline

PostPosted: Fri Jan 24, 2003 6:18 am    Post subject: Reply to topic Reply with quote

I gave Smod and after that SysOp powers to the bot but that didn't help.
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
Mine GO BOOM
Hunch Hunch
What What
Hunch Hunch<br>What What


Age:40
Gender:Gender:Male
Joined: Aug 01 2002
Posts: 3614
Location: Las Vegas
Offline

PostPosted: Fri Jan 24, 2003 9:19 am    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List Send email
Doggeti
Server Help Squatter


Age:39
Gender:Gender:Male
Joined: Jan 12 2003
Posts: 297
Location: Germany
Offline

PostPosted: Sat Jan 25, 2003 4:47 am    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List Send email AIM Address
SOS
Server Help Squatter


Joined: Dec 02 2002
Posts: 329
Offline

PostPosted: Sat Jan 25, 2003 5:32 am    Post subject: Reply to topic Reply with quote

Erm... well maybe you have messed something up there.
Post the entire gotEvent() function
Back to top
View users profile Send private message Add User to Ignore List Send email
Doggeti
Server Help Squatter


Age:39
Gender:Gender:Male
Joined: Jan 12 2003
Posts: 297
Location: Germany
Offline

PostPosted: Sat Jan 25, 2003 8:50 am    Post subject: Reply to topic Reply with quote

Ok, here are the both case-blocks I have changed so far:

Code: Show/Hide

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

Code: Show/Hide

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
View users profile Send private message Add User to Ignore List Send email AIM Address
VampZ
Guest


Offline

PostPosted: Sat Jan 25, 2003 12:14 pm    Post subject: Reply to topic Reply with quote

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:Gender:Male
Joined: Jan 12 2003
Posts: 297
Location: Germany
Offline

PostPosted: Sun Jan 26, 2003 4:26 am    Post subject: Reply to topic Reply with quote

I put following line into case EVENT_PlayerEntering:

Code: Show/Hide

sendPublic("Hello!");


Guess what, he didn't say it. BUT icon_exclaim.gif Now I know the problem is not that EVENT_SoccerGoal doesn't get called; The problem is in sendPublic() or in one of the functions related to it.

So I looked for the definition of sendPublic(). At the bottom of spawn.cpp I found all the message-functions including two sendPublic(). One of them was with sound the other one without.

Code: Show/Hide

void botInfo::sendPublic(char *msg)
{
    tell(makeSay(MSG_Public, 0, 0, msg));
}

void botInfo::sendPublic(BYTE snd, char *msg)
{
    tell(makeSay(MSG_Public, snd, 0, msg));
}


I found 'makeSay' in dllcore.cpp. It simply sets the properties of an event and returns this event.
This event is then given to 'tell'. 'tell' is a method if botInfo. It's located at top of spawn.cpp.

Code: Show/Hide

void botInfo::tell(BotEvent &event)
{
    if (callback && handle)
    {
        event.handle = handle;
        callback(event);
    }
}


'callback' should now be called with our little event. The problem is that i couldn't find this function 'callback'. Where is it icon_question.gif What does it do icon_question.gif
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
SOS
Server Help Squatter


Joined: Dec 02 2002
Posts: 329
Offline

PostPosted: Sun Jan 26, 2003 7:56 am    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List Send email
Doggeti
Server Help Squatter


Age:39
Gender:Gender:Male
Joined: Jan 12 2003
Posts: 297
Location: Germany
Offline

PostPosted: Sun Jan 26, 2003 10:44 am    Post subject: Reply to topic Reply with quote

new_color_.gif Yes. I am using the latest source directly from icon_arrow.gif 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 sa_keke.gif .
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
SOS
Server Help Squatter


Joined: Dec 02 2002
Posts: 329
Offline

PostPosted: Sun Jan 26, 2003 11:59 am    Post subject: Reply to topic Reply with quote

No, you can't sa_tongue.gif
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
View users profile Send private message Add User to Ignore List Send email
Doggeti
Server Help Squatter


Age:39
Gender:Gender:Male
Joined: Jan 12 2003
Posts: 297
Location: Germany
Offline

PostPosted: Mon Jan 27, 2003 9:39 am    Post subject: Reply to topic Reply with quote

icon_rolleyes.gif 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 biggrin.gif



spawn.cpp - 10.77 KB
File downloaded or viewed 60 time(s)
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
tikiman
Newbie


Joined: Jan 25 2003
Posts: 14
Offline

PostPosted: Tue Jan 28, 2003 4:03 am    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List
SOS
Server Help Squatter


Joined: Dec 02 2002
Posts: 329
Offline

PostPosted: Tue Jan 28, 2003 8:47 am    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List Send email
Dr Brain
Flip-flopping like a wind surfer


Age:38
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Tue Jan 28, 2003 9:45 am    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
ExplodyThingy
Server Help Squatter


Age:37
Gender:Gender:Male
Joined: Dec 15 2002
Posts: 528
Location: Washington DC
Offline

PostPosted: Tue Jan 28, 2003 11:10 am    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List Visit posters website
Doggeti
Server Help Squatter


Age:39
Gender:Gender:Male
Joined: Jan 12 2003
Posts: 297
Location: Germany
Offline

PostPosted: Tue Jan 28, 2003 3:00 pm    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List Send email AIM Address
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Bot Questions All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 666 page(s) served in previous 5 minutes.

phpBB Created this page in 0.679006 seconds : 52 queries executed (83.4%): GZIP compression disabled