Server Help

Bot Questions - Mervbot c->final

Maverick - Sat Feb 26, 2005 2:01 pm
Post subject: Mervbot c->final
Hiya Guys,

Got a simple question concering Mervbot:

When a player does '!command parameter'; How can I get the full command and parameter in a String?
I am trying to do that now because I have a command that concerns giving a squad for a parameter. So if the operator does !command -=SMG=- Mervbot sees that as a switch and then c->final is empty icon_confused.gif

Someone already had this problem or does someone know the solution to this?
D1st0rt - Sat Feb 26, 2005 2:16 pm
Post subject:
Code: Show/Hide
struct Command
{
   _linkedlist <_switch> slist;

   char *cmd;      // !_______ -at=blah-s blah
   char *final;   // !command -at=blah-s ____

   Command(char *msg);            // Parse
   ~Command();                  // Clean up

   bool check(char *msg);         // Check against cmd
   bool checkParam(char *msg);      // Check against final

   void addParam(char *msg);      // Add a switch
   _switch *getParam(char type);   // Check against switches
};


It doesn't appear to have something like that built in...
Solo Ace - Sat Feb 26, 2005 2:27 pm
Post subject:
It "thinks" that "-=SMG=-" is a switch?
Hah, sounds like a command parsing "bug" to me.

A nasty, quick solution may be adding an extra characters to it, like quotes next to the squadname.

Otherwise you could edit the core and add some variable which contains the whole line after the command or get rid of switches.
Cyan~Fire - Sat Feb 26, 2005 2:47 pm
Post subject:
Just don't design command stuff starting with the '-' character. I can't see any situation in which it would be necessary.
Solo Ace - Sat Feb 26, 2005 3:08 pm
Post subject:
He wants a parameter to be able to start with '-', since the parameter of his command is supposed to have a squadname as the parameter.
So, if a squadname starts with a '-' he's screwed since MERV parses it as a switch.
Cyan~Fire - Sun Feb 27, 2005 12:36 am
Post subject:
Oh, duh. Sorry, I guess I didn't read too clearly.

You could just have them put the squad name in quotes. It's kinda hard to make a very reliable command system to recognize what's a switch and what's raw input, and Catid's command processing code kinda sucks. Maybe I'll rewrite it some day for him. Some day.
50% Packetloss - Sun Feb 27, 2005 4:00 am
Post subject:
Mervbot core should handle all command functions, similar to the way ASSS does. Have the dll register commands with the core and have the core store a pointer to a specific function in the dll that should be run when the command is sent to the bot. Registering !commands with the core will allow for the core to display a nicely formated !help menu. You can take a look at a powerbot in EG or PB, they register commands with the core and it makes it easier to read commands and understand them.

Switches are useless, they should be taken out entirely or made into a seperate function.
Maverick - Sun Feb 27, 2005 4:41 am
Post subject:
hmm ok.. quotes it is then.

I suppose it also isn't possible to somehow use the switch to get the full parameter anyway?

(first I thought that Mervbot was wow and way to go icon_surprised.gif but that feeling is getting lesser and lesser while making advanced bots icon_sad.gif )
Solo Ace - Sun Feb 27, 2005 5:41 am
Post subject:
Maverick wrote:
I suppose it also isn't possible to somehow use the switch to get the full parameter anyway?


It probably is.
On the league bot, in the zone I was staff in, we used -a= -b= switches to set the squadnames.
In a log I just saw that a player set the squadnames to "-a" and "-b", which means that the actual switch parameters can start with a '-'.

So, in your case "!command -p=-=SMG=-" might work, if not, use the quotes or hack the core. sa_tongue.gif
Maverick - Sun Feb 27, 2005 6:35 am
Post subject:
ok grav_cool-hands.gif

icon_wink.gif
D1st0rt - Sun Feb 27, 2005 9:30 am
Post subject:
From what I've seen, the bots all have most things in common and just differ in what "fancy things" they have (thanks 50% biggrin.gif). Probably the biggest difference between the 3 main cores is the language they are written in. I'd be writing stuff in asss, but I can't get stupid grub to work icon_sad.gif
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group