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
mervbot and .40

 
Post new topic   Reply to topic Printable version
 View previous topic  help with creating a dll for mervbot Post :: Post Mervbot which plugin it executes first  View next topic  
Author Message
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1011
Offline

PostPosted: Sat Jun 28, 2008 9:35 pm    Post subject: mervbot and .40 Reply to topic Reply with quote

if i recall correctly, mervbot uses the old vie subspace protocol, and requires vip to remain connected to a zone...
is there a way to write a plugin/recompile it so it can connect to a .40-required zone without vip?

ive seen some chatnet bots being used in zones like hyperspace, but they only have limited functionality...

also, making a simple prize mod last night, i encountered 2 problems:
Code: Show/Hide

signed int temp6 = 0;
sscanf(c->final, "%d", &temp6);

^if -6 is entered, the default 0 is used... why cant %d handle signed numbers?
result: incapability to prize -greens

Code: Show/Hide

void whatever(int greennum, string playername)
...
//sendPrivate(playername,"*prize #" + (String)greennum); <--didnt work, not p
      sendPublic("priv green");
      _listnode <Player> *parse = playerlist->head;
      while (parse)
      {
         Player *p = parse->item;
   
         if (p->name==playername)
         {
            sendPrivate(p,"*prize #" + (String)greennum);
            sendPrivate(p,"green pm");
            sendPublic("priv green sent");
         }
   
         parse = parse->next;
      }

only sends 'priv green', after the delay, only AFTER someone else has pub'd...
'green pm' or 'priv green sent' is never recieved, nor the prize, even if the name is case sensitive...

everything else about the plugin works flawlessly.

to anyone that cares: i have begun to make merv plugins again...
even though i cant remember anything =)
_________________
SSC Distension Owner
SSCU Trench Wars Developer


Last edited by Cheese on Sun Jun 29, 2008 12:49 am, edited 1 time in total
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
L.C.
Server Help Squatter


Age:27
Gender:Gender:Male
Joined: Jan 03 2003
Posts: 572
Location: Missouri, US
Offline

PostPosted: Sat Jun 28, 2008 11:33 pm    Post subject: Reply to topic Reply with quote

For this matter, MERVBot should be rewritten under Snrub's documents (and Starlight, for example). Though I cannot think of any benefits of doing this at the moment.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1011
Offline

PostPosted: Sun Jun 29, 2008 12:49 am    Post subject: Reply to topic Reply with quote

i was figuring the whole core would need to be modified...

i also found one of the problems:
if (p->name==playername)

even if Cheese was both pname and playername, it wasnt equal. any ideas?
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
Bak
?ls -s
0 in


Age:19
Gender:Gender:Male
Joined: Jun 11 2004
Posts: 1826
Location: USA
Offline

PostPosted: Sun Jun 29, 2008 12:52 am    Post subject: Reply to topic Reply with quote

you're comparing the address of p->name and the address stored in player name... perhaps you should compare the contents?
_________________
SubSpace Discretion: A Third Generation SubSpace Client
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Purge
Episode I > Eposide III
Jar-Jar is kool


Age:28
Gender:Gender:Male
Joined: Sep 08 2004
Posts: 2017
Location: 中国
Offline

PostPosted: Sun Jun 29, 2008 2:33 am    Post subject: Reply to topic Reply with quote

Use the function strcmp() to compare the contents of both strings.
Back to top
View users profile Send private message Add User to Ignore List Send email
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1011
Offline

PostPosted: Sun Jun 29, 2008 2:57 am    Post subject: Reply to topic Reply with quote

well, i just fixed it before i read your posts X_x
i ghetto-fix'd it by:
if ((String)p->name==playername)

^_^


but i still cant figure out why sscanf() isnt returning negative numbers...
works well with positive, but does nothing with negatives.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
Samapico
No, these DO NOT look like penises, ok?


Age:31
Gender:Gender:Male
Joined: May 08 2003
Posts: 1252
Location: Montreal, Canada
Offline

PostPosted: Sun Jun 29, 2008 11:42 pm    Post subject: Reply to topic Reply with quote

You should use

if (strcmp(p->name, playername) == 0)

instead.

Also, try not to use both 'string' and 'String' stuff... In MervBot, I usually only use the 'String' class.
_________________
DCME co-developer
17th Parallel Head Sysop
Subspace: The Future
Back to top
View users profile Send private message Add User to Ignore List
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1011
Offline

PostPosted: Mon Jun 30, 2008 3:44 am    Post subject: Reply to topic Reply with quote

well, what if you could somehow spawn a bot into another ip/port using a dll plugin, which would have the cont .40 protocol,and somehow link the two bots together?

i always use 'String', the code here wasnt real, only for effect and demonstrative purposes.
i never really use strcmp, does it compare arrays to strings correctly?
and is it case sensitive?

'but i still cant figure out why sscanf() isnt returning negative numbers...
works well with positive, but does nothing with negatives.'
^this is still true, ive made 3 plugins in 3 nights, and this is the only glaring error to my otherwise spotless plugins...
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
Samapico
No, these DO NOT look like penises, ok?


Age:31
Gender:Gender:Male
Joined: May 08 2003
Posts: 1252
Location: Montreal, Canada
Offline

PostPosted: Mon Jun 30, 2008 9:51 am    Post subject: Reply to topic Reply with quote

http://www.cplusplus.com/reference/clibrary/cstring/strcmp.html
All your questions answered tongue.gif
Yes it is case sensitive (just like using == between 2 Strings)

I have a function that might be useful for you; I made it especially to search for a player in the player list, so it ignores case, and can work for partial matches:


Code: Show/Hide

Player* FindPlayerByName(char *name, bool exactmatch, _linkedlist <Player>* list)
{
   _listnode <Player> *parse = list->head;   //set to first link of the player linked list
   Player* bestmatchplayer = NULL;
   int bestmatchlength = 0;
   
   String nametofind = name;
   nametofind.lcase();

   while (parse)   //parse will be NULL when we reach the last link
   {
      Player *p = parse->item;   //item is the actual data stored in the link
      String pname = (String) p->name;
      pname.lcase();

      if (pname == nametofind)
         return p;
      if (!exactmatch)
      {
         int firstdifferent = FirstDifferentCharacter(nametofind, pname);
         if (bestmatchlength < firstdifferent)
         {
            bestmatchlength = firstdifferent;
            bestmatchplayer = p;
         }
      }
      parse = parse->next;   //set parse to the next link
   }
   
   return bestmatchplayer;
}


The playerlist is passed as parameter, but if you use this function inside the botInfo class, you could use playerlist and get rid of that parameter.

Your function would become something like:
Code: Show/Hide

void whatever(int greennum, String playername)
{
   //Find the target player; use 'true' as 2nd parameter if you don't want partial matches (i.e.  "sam" can return the player "Samapico")
   Player * target = FindPlayerByName(playername, false, playerlist);

   if (target != NULL)
   {
        sendPrivate(target, "*prize #" + String(greennum));
   }

}
Back to top
View users profile Send private message Add User to Ignore List
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1011
Offline

PostPosted: Mon Jun 30, 2008 3:43 pm    Post subject: Reply to topic Reply with quote

but where is FirstDifferentCharacter()? =S
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
k0zy
Server Help Squatter


Gender:Gender:Male
Joined: Jan 11 2003
Posts: 571
Location: Germany
Offline

PostPosted: Mon Jun 30, 2008 4:07 pm    Post subject: Reply to topic Reply with quote

Cheese wrote:
but where is FirstDifferentCharacter()? =S

http://forums.minegoboom.com/viewtopic.php?p=74429#74429
_________________
It's a shark! Oh my god! Unbelievable!
Back to top
View users profile Send private message Add User to Ignore List
Samapico
No, these DO NOT look like penises, ok?


Age:31
Gender:Gender:Male
Joined: May 08 2003
Posts: 1252
Location: Montreal, Canada
Offline

PostPosted: Mon Jun 30, 2008 4:22 pm    Post subject: Reply to topic Reply with quote

doh

lol

what he said
Back to top
View users profile Send private message Add User to Ignore List
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1011
Offline

PostPosted: Mon Jun 30, 2008 5:01 pm    Post subject: Reply to topic Reply with quote

ill copy it here for future reference =D

Code: Show/Hide

int FirstDifferentCharacter(const char *string1, const char *string2)
{
   int i;
   for (i = 0 ; *string1 != '\0' && *string2 != '\0' && tolower(*string1) == tolower(*string2) ; i++, string1++, string2++)
   {
   }
   return i;
}
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Bot Questions All times are GMT - 5 Hours
Page 1 of 1

 
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: 215 page(s) served in previous 5 minutes.

phpBB Created this page in 0.097846 seconds : 38 queries executed (50.9%): GZIP compression disabled