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
Am I doing this right? My first plugin

 
Post new topic   Reply to topic Printable version
 View previous topic  Moving files to my ftp Post :: Post Spectator Kick Bot?  View next topic  
Author Message
Quan Chi2
Member of "Sexy Teenagers that Code" Group
Member of


Age:34
Gender:Gender:Male
Joined: Mar 25 2005
Posts: 860
Location: NYC
Offline

PostPosted: Sat Aug 06, 2005 8:36 pm    Post subject: Am I doing this right? My first plugin Reply to topic Reply with quote

Im making a plugin of my own. Its nothing too great. Just records staff data, staff updates and stuff.

Code: Show/Hide
   if (c->check("sysop"))
      sendPublic("*getfile sysop.txt");
      ifstream file("sysop.txt");
      char line[256];
      while (file.getline(line, 256))
      {
              if (CMPSTART("MAXBOXES=", line))
              {
                                           MAXBOXES = atoi(&(line[9]));
                                           break;
                                           }
                                           }
                                           
                                           file.close();
             
      }
      if (c->check("mods"))
      sendPublic("*getfile moderator.txt");
      ifstream file("moderator.txt");
      char line[256];
      while (file.getline(line, 256))
      {
              if (CMPSTART("MAXBOXES=", line))
              {
                                        MAXBOXES = atoi(&(line[9]));
                                        break;
                                        }
                                        }
                                       
                                        file.close();
  }
  if (c->("smods"))
  sendPublic("*getfile smod.txt");
  ifstream file("smod.txt");
  char line[256];
  while (file.getline(line 256))
  {
        if (CMPSTART("MATCHBOXES=", line))
                                    MAXBOXES = atoi(&(line[9]));
                                    break;
                                    }
                                    }
                                   
                                    file.close();
}
if (c->check("news"))
sendPublic("?getnews");
}
}
if (c->check("time"))
char u[100];
time_t t=time(NULL);
tm *tmp = localtime(&t);
strftime(u,99,"%c",tmp);
sendPublic("Current date and time: " + u);
}
}



I also made a part that tells the times.. I figured it would be cool. I got it from that wiki site.
lol I wasn't sure of the command for getting the news text. Just correct me if Im wrong please...
Im also now sure how to seperate commands. please help.
Thanx guys!
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
Underlord
Novice


Gender:Gender:Male
Joined: Feb 17 2004
Posts: 55
Offline

PostPosted: Sat Aug 06, 2005 10:00 pm    Post subject: Reply to topic Reply with quote

1) Downloaded files are put into the \get\ folder *EDITED*

2) You have to wait for them to be downloaded before opening the file. Bot should get a "File received: sysop.txt" when it's sent. You can detect that in spawns.cpp under case EVENT_Chat:, the MSG_Arena case.

3) file.close(); needs to be outside the while () loop.

4) The "if (CMPSTART("MATCHBOXES=", line))" and "MAXBOXES = atoi(&(line[9])); " code obviously isn't applicable to what you are doing.

5) (c->("smods")) should be c->check. } { 's are missing or reversed in several spots.

6) Here's how to seperate commands:
Code: Show/Hide

if (c->check("news"))
{
sendPublic("?getnews");
}

if (c->check("time"))
{
char u[100];
time_t t=time(NULL);
tm *tmp = localtime(&t);
strftime(u,99,"%c",tmp);
sendPublic("Current date and time: " + u);
}

7) You are obviously just copy/pasting things from the tutorial. Creating a bot requires basic programming knowledge.


Last edited by Underlord on Sun Aug 07, 2005 11:45 am, edited 1 time in total
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
CypherJF
I gargle nitroglycerin


Gender:Gender:Male
Joined: Aug 14 2003
Posts: 2582
Location: USA
Offline

PostPosted: Sat Aug 06, 2005 10:42 pm    Post subject: Reply to topic Reply with quote

actually, files are uploaded/downloaded to /get/.

LVL files are downloaded to /lvl/.
_________________
Performance is often the art of cheating carefully. - James Gosling
Back to top
View users profile Send private message Add User to Ignore List
Quan Chi2
Member of "Sexy Teenagers that Code" Group
Member of


Age:34
Gender:Gender:Male
Joined: Mar 25 2005
Posts: 860
Location: NYC
Offline

PostPosted: Sat Aug 06, 2005 10:45 pm    Post subject: Reply to topic Reply with quote

i didnt copy paste... purge helped me..
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
Purge
Episode I > Eposide III
Jar-Jar is kool


Age:35
Gender:Gender:Male
Joined: Sep 08 2004
Posts: 2019
Offline

PostPosted: Sat Aug 06, 2005 10:46 pm    Post subject: Reply to topic Reply with quote

Not really. I just linked you to the MGB Wiki on that.
Back to top
View users profile Send private message Add User to Ignore List
50% Packetloss
Server Help Squatter


Age:40
Gender:Gender:Male
Joined: Sep 09 2003
Posts: 561
Location: Santa Clarita, California
Offline

PostPosted: Sun Aug 07, 2005 12:50 am    Post subject: Reply to topic Reply with quote

Ok, give up now if you don't wish to put in the work to learn the language. That is a pathetic attempt at C++.

Along with all the errors Underlord found,

8) You have not checked if the file was even actually opened by the open() member function (sometimes it fails).

9) Commands are usually seperated by if(...){}else if(...){} statements.

10) char u[100]; sendPublic("Current date and time: " + u); is the fucking stupidest thing I've ever seen. Here is the function prototype, someone who actually understands C will know exactly why you are a retard.
void sendPublic(char *msg);


I suggest you give up now, and preform a post-pregnancy abortion on yourself to save you the trouble of reading anything else I have to say.
_________________
Current Terror Alert Level
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
Bak
?ls -s
0 in


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

PostPosted: Sun Aug 07, 2005 4:02 am    Post subject: Reply to topic Reply with quote

yeah you want sendPublic("Current date and time: " + (String)u);

instead of sendPublic("Current date and time: " + u);
_________________
SubSpace Discretion: A Third Generation SubSpace Client
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Maverick
broken record


Age:40
Gender:Gender:Male
Joined: Feb 26 2005
Posts: 1521
Location: The Netherlands
Offline

PostPosted: Sun Aug 07, 2005 4:56 am    Post subject: Reply to topic Reply with quote

what im seeing is some attempt to get ahold of the staff files (sysop.txt, smod.txt, etc) with one command. But for the rest, 50% was 100% right icon_smile.gif
_________________
Nickname: Maverick (I changed my name!)
TWCore developer | Subspace statistics
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Quan Chi2
Member of "Sexy Teenagers that Code" Group
Member of


Age:34
Gender:Gender:Male
Joined: Mar 25 2005
Posts: 860
Location: NYC
Offline

PostPosted: Sun Aug 07, 2005 7:32 pm    Post subject: Reply to topic Reply with quote

AH FUCK YOU!

The nerve of you people. Yea, I don't know C++, but I'll be damned if thats going to stop me
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
Quan Chi2
Member of "Sexy Teenagers that Code" Group
Member of


Age:34
Gender:Gender:Male
Joined: Mar 25 2005
Posts: 860
Location: NYC
Offline

PostPosted: Sun Aug 07, 2005 7:33 pm    Post subject: Reply to topic Reply with quote

I'm going to learn C++ from a book. I just haven't brought the book yet from the store. I thought it would be fun to try and code my own bot. SO FUCK YOU FLAMMERS
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
Bak
?ls -s
0 in


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

PostPosted: Sun Aug 07, 2005 9:35 pm    Post subject: Reply to topic Reply with quote

Don't start with something that elaborate. Start with a message bot, then a warp bot, maybe lvz bot.
Back to top
View users profile Send private message Add User to Ignore List AIM Address
50% Packetloss
Server Help Squatter


Age:40
Gender:Gender:Male
Joined: Sep 09 2003
Posts: 561
Location: Santa Clarita, California
Offline

PostPosted: Sun Aug 07, 2005 9:37 pm    Post subject: Reply to topic Reply with quote

Ok, quan, you are officially crazy. Have a nice day.
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:41
Gender:Gender:Male
Joined: Aug 01 2002
Posts: 3615
Location: Las Vegas
Offline

PostPosted: Mon Aug 08, 2005 2:29 am    Post subject: Reply to topic Reply with quote

Bak wrote:
Don't start with something that elaborate. Start with a message bot, then a warp bot, maybe lvz bot.

My first real project, beyond editing the Pro League bot and making a recorder bot, was to create my own bot core, from scratch, and figuring out almost all the packets by printing out packet logs and figuring out what each packet did. Only later when I got to some of the checksums/timers did I need assistance from Ekted.

If you have the time and determined, you can learn and create things pretty fast.
Back to top
View users profile Send private message Add User to Ignore List Send email
Bak
?ls -s
0 in


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

PostPosted: Mon Aug 08, 2005 3:59 am    Post subject: Reply to topic Reply with quote

you did that without knowing c++ / c / what packets are?
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Contempt+
Server Help Squatter


Age:36
Gender:Gender:Male
Joined: May 15 2005
Posts: 682
Location: Home
Offline

PostPosted: Mon Aug 08, 2005 12:01 pm    Post subject: Reply to topic Reply with quote

I've been editing catid's biller without knowing C++.

I just looked at the other code, and learn from that.
_________________
SSE Network Administrator
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
Mine GO BOOM
Hunch Hunch
What What
Hunch Hunch<br>What What


Age:41
Gender:Gender:Male
Joined: Aug 01 2002
Posts: 3615
Location: Las Vegas
Offline

PostPosted: Mon Aug 08, 2005 12:05 pm    Post subject: Reply to topic Reply with quote

Bak wrote:
you did that without knowing c++ / c / what packets are?

I learned C++ by trial and error. Seriously. I knew perl, Ghost Ship sent me the source code for the Pro League bots, and I randomly tried things that looked right, and saw if it compiled. As for packets, I had an idea how they are and how big-endian systems stored bytes.

Of course, all this comes back when Ekted yells at me for my coding system, which was learned from random other people's styles.
Back to top
View users profile Send private message Add User to Ignore List Send email
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: 241 page(s) served in previous 5 minutes.

phpBB Created this page in 0.462297 seconds : 40 queries executed (91.6%): GZIP compression disabled