Server Help

Bot Questions - help

Anonymous - Sat Jan 11, 2003 7:04 pm
Post subject: help
i understand basic c++ but i dont understand the format tha mervbot uses. would someone please help me.[/code]
SuSE - Sat Jan 11, 2003 9:27 pm
Post subject:
-> Tutorial for making plugins for MERVBot and check out catid.sscentral.com and like email catid if you need more.
Anonymous - Sat Jan 11, 2003 9:37 pm
Post subject:
i already have that... i know a little c++ and i tried to explore a source file. all that does is tell you how to compile it which i know.
Helicon - Sat Jan 11, 2003 10:45 pm
Post subject:
youre going to have to look at, understand, interpret, and utilize his code. he works that way...
Anonymous - Sat Jan 11, 2003 11:15 pm
Post subject:
hmm... ive already tried that and it doesnt make any sense but whatever...
SOS - Sun Jan 12, 2003 5:13 am
Post subject:
MERVBot uses the normal C++ format(As if you can use any other...) sa_tongue.gif
I dunno... I found it totally understantable at start... just put whatever you want to do in the event switch in botInfo::gotEvent()
Helicon - Sun Jan 12, 2003 3:18 pm
Post subject:
there is a pretty thick line between knowing C++ just to get stuff done, and "knowing" C++ to do development. i personally am not yet too familiar with the second part, but im getting there. its not easy. it takes a lot of experience and playing around (at least it has for me) to get it right. this isnt the high school computer lab... catid isnt your friendly neighbourhood CS teacher.
Anonymous - Sun Jan 12, 2003 5:53 pm
Post subject:
ok... thanks
Helicon - Sun Jan 12, 2003 7:44 pm
Post subject:
no insult meant, but this is stuff that takes some previous knowledge. if you keep working with getting something done for yourself in SS, eventually just dabbling in the catid's stuff will teach you quite a lot. make it a point to learn what you need to know to write that bot plugin, and by the time you get it done, youll find you know quite a lot more about the language itself, and youll be that much better off for it. icon_eek.gif and youll have learned the semi-fun way, without having to tear through a massive C++ book. at this point you dont know all of C++ by any stretch of the imagination, but youll probably have enough in your belt to learn what you may need to learn fast.

hope this helps... icon_wink.gif
Anonymous - Sun Jan 12, 2003 7:54 pm
Post subject:
i understand a little now. say i want to open doors with the command
!doors 0. is this what it would look like. i seriously doubt it but.

Code: Show/Hide
if(c->check("doors 0))
{
sendpublic(p, "?set door:doormode=0");
}
//i dont know if thats the right command to do a public message


i know all of that is in the command file
Helicon - Sun Jan 12, 2003 7:59 pm
Post subject:
where did you put that?
Anonymous - Sun Jan 12, 2003 9:41 pm
Post subject:
i didnt put that anywhere. i was just wondering if that would be the right code.
SOS - Sun Jan 12, 2003 11:40 pm
Post subject:
no

sendPublic(soundcode, text) is the (a) prototype(soundcode is optional)

and you can only check for one single word with c->check()

So it'd be

Code: Show/Hide
if (c->check("doors"))
{
// Trust the player was right and just set it to whatever the player said with no checking
String s = "?set door:doormode:";
s += c->final;//c->final is the final part of the command
sendPublic(/*No sound code needed*/s.msg);//.msg because we are puritan :) You could get by with just s too probably, but s.msg is clearer and more safe
}

Anonymous - Mon Jan 13, 2003 4:18 pm
Post subject:
ok. thanks
Anonymous - Thu Jan 16, 2003 6:17 pm
Post subject:
i succesfully made my first bot biggrin.gif . it was just a elize source with the elize stuff deleted and a !doors command and a kill macro (thanks to Dr Brain for his help). i was wondering how you base something on a players rec like for example if you want to eliminate a player at 5 deaths.
SOS - Thu Jan 16, 2003 11:57 pm
Post subject:
Guess what EVENT_PlayerDeath is for icon_smile.gif
Look for it and put your code after it. The variables should already be there(unless you deleted too much sa_tongue.gif). k is the killer, just so you remember sa_tongue.gif I'm often wondering if k is the killer or the killed...
Anonymous - Fri Jan 17, 2003 4:17 pm
Post subject:
i know where to put it, i just dont know what to put
Anonymous - Sat Jan 18, 2003 5:30 pm
Post subject:
What you`re looking for is something like this :

case EVENT_PlayerDeath:

{
Player *p = (Player*)event.p[0], // the player who died
*k = (Player*)event.p[1]; // the killer
Uint16 bounty = (Uint16)event.p[2]; // one of the players bounty

if (p->score.losses==5)
{
sendPrivate(p,"*spec");
sendPrivate(p,"*spec"); //Avoid the player being locked in spec
String s;
s += p->name;
s += "is out!";
sendPublic(s);
}

}

I`m writing most of this from memory, so don`t excpect it to work right away =)

-Rifleman
Nikon F5 - Sat Jan 18, 2003 6:30 pm
Post subject:
do you know how to say how many wins:losses?
Nikon F5 - Sat Jan 18, 2003 9:51 pm
Post subject:
im working on a bot to host duels. so far, it specs people at 5 deaths. i want to be able to have a customizeable amount of deaths. when i compile i get the error "c:\program files\continuum\mervbot34\mervbot\src\duel\command.cpp(228) : error C2440: '=' : cannot convert from 'char *' to 'int'"

Code: Show/Hide
      if(c->check("enable"))
   {
      onoff=c->final;
   }

SOS - Sun Jan 19, 2003 5:02 am
Post subject:
Well obviously onoff is an int, not a string... use some conversion there.
Nikon F5 - Sun Jan 19, 2003 8:12 am
Post subject:
i dont know what conversion to use icon_confused.gif
SOS - Sun Jan 19, 2003 10:23 am
Post subject:
strtol()
strtoul()
String::toInteger() or something like that

All good
Anonymous - Sun Jan 19, 2003 4:47 pm
Post subject:
I recommend you declare onoff as bool, then use this :

if(c->check("enable"))
{
if (onoff==false)
{
onoff=true;
}
else
{
onoff=false,;
}
}

I find it more understandable this way =)

To display wins/losses, use :

String s;
s += "The player ";
s += p->name;
s += " has ";
s += p->score.wins;
s += " wins and ";
s += p->score.losses;
s += " losses.";
sendPublic(s);

Not that hard to get the hang of once you`ve used it a bit =)

-Rifle
Nikon F5 - Sun Jan 19, 2003 5:26 pm
Post subject:
i already figured out my self how to display wins:losses but what i want is like for !enable 5 to spec at 5 and !enable 7 to spec at 7. i know i would have to take the final part of the code and make it the integer but i dont know how.

like sos said above, i need to use a conversion, but i dont know what conversion to use. i tried all the ones sos said and none of them worked.
SOS - Sun Jan 19, 2003 11:41 pm
Post subject:
Rifle: You want !enable to toggle it?? Ewwww I hate toggling commands

Nikon: Why didn't they work? They all do. The last one doesn't work if the string is not an integer...
"5 to spec at 5" is why... you'll have to splice the string up to get the numbers.
You'll probably be better off with a different command syntax, since cutting up strings is always messy.
Nikon F5 - Mon Jan 20, 2003 8:39 am
Post subject:
well, i figured it out. now i have

Code: Show/Hide
   
                if(c->check("enable"))
{
   onoff= atoi(c->final);
   String s= "Removing players with";
   s += onoff;
   s += " deaths";
   sendPublic(s.msg);
}


that works, but now my bots not accepting any commands. bah, stupid bots. grav_bigger.gif
Nikon F5 - Mon Jan 27, 2003 9:31 pm
Post subject:
how do i do something, then wait 10 seconds and do something else? like if i want to the bot to say "*arena Game begins in 10 seconds..." and then 10 seconds later for it to say "*arena GO GO GO!!!" how would i do that?

edit:i figured out how, no thanks to any of you. sa_tongue.gif
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group