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
help with creating a dll for mervbot
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic Printable version
 View previous topic  ASSS Bot Post :: Post mervbot and .40  View next topic  
Author Message
hellzlaker
Registered Cap Buster
Popping men in the ass since Oct 2005


Gender: NEVER ENOUGH!
Joined: Oct 27 2005
Posts: 34
Offline

PostPosted: Sun Mar 30, 2008 11:32 am    Post subject: help with creating a dll for mervbot Reply to topic Reply with quote

I am trying to make the bot to private message you this, "Hello <player name>" and <player name> = players name biggrin.gif

but how do i do that?

my guess it was
Code: Show/Hide
sendPrivate(p,"Hello "p);
but that didn't compile... anyone know how?
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address MSN Messenger
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Sun Mar 30, 2008 11:52 am    Post subject: Reply to topic Reply with quote

p isn't the player's name. 'p' is a pointer to a whole structure containing all the player's data. To get the name of the player, you have to type p->name. p-> lets you access each member of the player's structure. p->pos is a vector containing the player's position, for example.

I suggest you get some plugin examples and try to understand them. Even the empty command.cpp file has a line containing exactly what you need, the !about and !help commands are already coded in there.

Also, if you have no experience with c++, do some tutorials first; Understanding pointers, classes and structs is a big plus.
_________________
(Insert a bunch of dead links here)
Back to top
View users profile Send private message Add User to Ignore List
hellzlaker
Registered Cap Buster
Popping men in the ass since Oct 2005


Gender: NEVER ENOUGH!
Joined: Oct 27 2005
Posts: 34
Offline

PostPosted: Sun Mar 30, 2008 12:01 pm    Post subject: Reply to topic Reply with quote

i already got the default dll template and i know basic c++ (enough to code a dll) and i already made a bot that just says stuff when you say hi to it,

i just wanted to know how to make it say players name

and i tried
Code: Show/Hide
sendPrivate(p,p->name" hi!");
and it didnt work,

and also the p struct, in which source file is it?
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address MSN Messenger
Purge
Episode I > Eposide III
Jar-Jar is kool


Age:34
Gender:Gender:Male
Joined: Sep 08 2004
Posts: 2018
Offline

PostPosted: Sun Mar 30, 2008 12:45 pm    Post subject: Reply to topic Reply with quote

Code: Show/Hide
sendPrivate(p, "Hello, " + (String)p->name);


That should locally PM a player 'p' "Hello, playername". p->name is stored as char name[20] I believe, so you may also manipulate it as a string.

You can find the player struct in player.h.
Back to top
View users profile Send private message Add User to Ignore List
hellzlaker
Registered Cap Buster
Popping men in the ass since Oct 2005


Gender: NEVER ENOUGH!
Joined: Oct 27 2005
Posts: 34
Offline

PostPosted: Sun Mar 30, 2008 2:53 pm    Post subject: Reply to topic Reply with quote

thanks purge, thats exacty what i needed biggrin.gif
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address MSN Messenger
hellzlaker
Registered Cap Buster
Popping men in the ass since Oct 2005


Gender: NEVER ENOUGH!
Joined: Oct 27 2005
Posts: 34
Offline

PostPosted: Sun Mar 30, 2008 6:59 pm    Post subject: Reply to topic Reply with quote

i ran into another problem this is the code
Code: Show/Hide
sendPrivate(p,"I rolled a "(int)odice1", "(int)odice2", and a "(int)odice3);


and this is the compile error that VC++ gave me
Code: Show/Hide
1>c:\documents and settings\owner\desktop\programing\c++\a3 dll\tutorial\default\command.cpp(215) : error C2144: syntax error : 'int' should be preceded by ')'
1>c:\documents and settings\owner\desktop\programing\c++\a3 dll\tutorial\default\command.cpp(215) : error C2064: term does not evaluate to a function taking 0 arguments
1>c:\documents and settings\owner\desktop\programing\c++\a3 dll\tutorial\default\command.cpp(215) : error C2059: syntax error : ')'


any one help?
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address MSN Messenger
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1017
Offline

PostPosted: Sun Mar 30, 2008 7:26 pm    Post subject: Reply to topic Reply with quote

you have to remember that
1+2+1+2+1+2+1=10
and
1212121 doesnt = 10

=/
_________________
SSC Distension Owner
SSCU Trench Wars Developer
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
hellzyeeeeee
Guest


Offline

PostPosted: Sun Mar 30, 2008 8:36 pm    Post subject: Reply to topic Reply with quote

oh so i have to add +, but how come like in cout u just do

Code: Show/Hide
cout<<"You rolled "<<number;

and not
Code: Show/Hide
cout<<"You rolled"<<+number;
Back to top
Bak
?ls -s
0 in


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

PostPosted: Sun Mar 30, 2008 9:41 pm    Post subject: Reply to topic Reply with quote

the << operator for ostream does it for you like the + operator does it for you with the String class

if you really want to know what's going on look for String::operator+ in the mervbot source
_________________
SubSpace Discretion: A Third Generation SubSpace Client
Back to top
View users profile Send private message Add User to Ignore List AIM Address
hellzlaker
Registered Cap Buster
Popping men in the ass since Oct 2005


Gender: NEVER ENOUGH!
Joined: Oct 27 2005
Posts: 34
Offline

PostPosted: Mon Mar 31, 2008 4:46 pm    Post subject: Reply to topic Reply with quote

every time i fix one thing i get another problem ...

i tried this and it didnt compile
Code: Show/Hide
sendPrivate(p,"I rolled a "+(int)odice1+(string)", "+(int)odice2+(string)", and a "+(int)odice3);


also i tried this (it didn't compile either :S)
Code: Show/Hide
sendPrivate(p,"I rolled a "+(int)odice1+", "+(int)odice2+", and a "+(int)odice3);
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address MSN Messenger
Dr Brain
Flip-flopping like a wind surfer


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

PostPosted: Mon Mar 31, 2008 6:13 pm    Post subject: Reply to topic Reply with quote

change your ints to strings.
_________________
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
Bak
?ls -s
0 in


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

PostPosted: Mon Mar 31, 2008 7:15 pm    Post subject: Reply to topic Reply with quote

and then change your strings to Strings
Back to top
View users profile Send private message Add User to Ignore List AIM Address
hellzlaker
Registered Cap Buster
Popping men in the ass since Oct 2005


Gender: NEVER ENOUGH!
Joined: Oct 27 2005
Posts: 34
Offline

PostPosted: Tue Apr 01, 2008 4:47 pm    Post subject: Reply to topic Reply with quote

Ok, i finished that bot and fixed all the problems but im going to do something else and i have few questions

is there a source code the rampage.dll or any one sprees? or atleast is theree a way to access thee spree from your dll, like if you get a spree 3:0 the rampage.dll does whatever it wants like says you got a spree, while your DLL gives you like a thousand points if you got that spree

how to access flag game, like if you win a flag game say freq 0 won the flag game and give them points (i dont want the existing flag.dll i want to learn how to make my own so thats why im asking)
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address MSN Messenger
Purge
Episode I > Eposide III
Jar-Jar is kool


Age:34
Gender:Gender:Male
Joined: Sep 08 2004
Posts: 2018
Offline

PostPosted: Tue Apr 01, 2008 4:51 pm    Post subject: Reply to topic Reply with quote

I think 50% Packetloss created the rampage that prizes based on sprees. It should be out somewhere, a lot of zones use it.

For flag game stuff, check spawn.cpp in the plugin source file. There should be a flag event somewhere for victories.
Back to top
View users profile Send private message Add User to Ignore List
hellzlaker
Registered Cap Buster
Popping men in the ass since Oct 2005


Gender: NEVER ENOUGH!
Joined: Oct 27 2005
Posts: 34
Offline

PostPosted: Tue Apr 01, 2008 7:10 pm    Post subject: Reply to topic Reply with quote

Is it open source? I want to get the source code or if any one can come with quick example how to make one like if you get 1 kill and thats it

also another thing i tried to do this code
Code: Show/Hide
            while (p->bounty!=(Uint16)neededbty||c->check("abortmission"));

            if (c->check("abortmission"))
            {
               sendPrivate(p, "aborted");
            }


it does compile but the bot just leaves game when this happens, and every time i make a while statement the bot leaves the game for some reason
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address MSN Messenger
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Wed Apr 02, 2008 1:09 am    Post subject: Reply to topic Reply with quote

that's pretty much an infinite loop you created there...

It just endlessly checks the conditions. But for the player's bounty to change, other parts of the code have to be executed.

What you want to do is put an 'if' statement that checks your condition everytime the bounty of the player is changed. You can catch that with the PlayerDeath event (the killer's bounty increased) and the PlayerPrize event (player grabbed a green)
Not sure of the exact event names, but you get the idea...


Usually, a while loop will look like:

while (condition)
{
//do stuff
}
You have to make sure that the 'do stuff' part can have an impact on the conditions... Else, you will get an infinite loop if the condition is true.
Back to top
View users profile Send private message Add User to Ignore List
Maverick
broken record


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

PostPosted: Wed Apr 02, 2008 1:16 am    Post subject: Reply to topic Reply with quote

hellzlaker wrote:
is there a source code the rampage.dll or any one sprees?

Rampage 2.5 and Rampage 3.0 (with customizable spree messages) is available to download from mervbot.com.
Both plugins have source code included.
_________________
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
hellzlaker
Registered Cap Buster
Popping men in the ass since Oct 2005


Gender: NEVER ENOUGH!
Joined: Oct 27 2005
Posts: 34
Offline

PostPosted: Wed Apr 02, 2008 6:15 pm    Post subject: Reply to topic Reply with quote

Code: Show/Hide

Uint16 neededbty = 16;
            while (p->bounty!=(Uint16)neededbty||!c->check("abortmission"));
            {
               c->check("abortmission");
               p->bounty;
            }


I tried that and it still doesn't work and the bot leaves continuum when i run it

This is what im trying to do, bot check players bounty and keeps checking until its 30, and checks if player typed .abortmission
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address MSN Messenger
Bak
?ls -s
0 in


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

PostPosted: Wed Apr 02, 2008 8:52 pm    Post subject: Reply to topic Reply with quote

your model of how you think mervbot execution occurs is wrong. There is only one thread of execution that handles sending and receiving packets, updating the player bounty when appropriate, and running your code. If your loop runs until the bounty is changed, the bot will never get a chance to update the player bounty (as execution is stuck looping in your function waiting for it to change) or send/receive packets (which is why it disconnects, by the way).

Even if the player types .abortmission at some point, the bot can't receive that packet since it's again, looping in your function.
Back to top
View users profile Send private message Add User to Ignore List AIM Address
hellzlaker
Registered Cap Buster
Popping men in the ass since Oct 2005


Gender: NEVER ENOUGH!
Joined: Oct 27 2005
Posts: 34
Offline

PostPosted: Thu Apr 03, 2008 4:17 pm    Post subject: Reply to topic Reply with quote

ok but will i be able to do something like this

if player type !mission do the following:
wait until player collects 30 bounty and then say you beated the mission
or if player types !abortmission it cancells the "mission"

from what i think its impossible to do without a loop
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address MSN Messenger
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Thu Apr 03, 2008 4:55 pm    Post subject: Reply to topic Reply with quote

You have to think of it like this...

if a player types !mission, set a tag on him that indicates he typed it
Code: Show/Hide

//Tag of index 0 is for the Mission value
set_tag(p, 0, 1);


and with !abortmission, you can simply reset the tag to 0.

In the events where the player's bounty changes (playerdeath, playerprize), get the tag, if it's set to 1, check if he collected 30.

Actually, you could set the tag to the player's current bounty, so you would know what bounty he had when he typed !mission, if you want the mission to stop when he gets 30 bounty more. Might have a problem if it is possible to have a bounty of 0 though... You'd need to use 2 tags, one that just says if he's on a mission or not, and another that tells his bounty when he got on mission.

Have fun.


On a side note, these lines:
Code: Show/Hide
               c->check("abortmission");
               p->bounty;

Don't do anything... p->bounty only returns the player's bounty. It doesn't update it or whatever. The bot has to receive a packet before modifying that value.
c->check("commandname") only returns true or false depending if the current command fits or not the command you want. Then again, the function doesn't do anything.
You can always right-click on a function, and Go To Definition to see what a function does. If it only returns you something, it's useless to use it in a loop like that. And as Bak said, most loops are useless anyway.
Back to top
View users profile Send private message Add User to Ignore List
hellzlaker
Registered Cap Buster
Popping men in the ass since Oct 2005


Gender: NEVER ENOUGH!
Joined: Oct 27 2005
Posts: 34
Offline

PostPosted: Thu Apr 03, 2008 8:45 pm    Post subject: Reply to topic Reply with quote

thanks samapico this helped allot ,nice quick tutorial biggrin.gif
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address MSN Messenger
hellzlaker
Registered Cap Buster
Popping men in the ass since Oct 2005


Gender: NEVER ENOUGH!
Joined: Oct 27 2005
Posts: 34
Offline

PostPosted: Fri Apr 04, 2008 5:48 pm    Post subject: Reply to topic Reply with quote

shit i got confused with all this, how does a tag exactly work? like is exactly index and data?
(Player *p, int index, int data)

and what do you mean by get the tag? like
Code: Show/Hide
if (set_tag(p,0,1)){}
?[/code]
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address MSN Messenger
Purge
Episode I > Eposide III
Jar-Jar is kool


Age:34
Gender:Gender:Male
Joined: Sep 08 2004
Posts: 2018
Offline

PostPosted: Fri Apr 04, 2008 6:34 pm    Post subject: Reply to topic Reply with quote

Tags pretty much just mark a player for reference using an integer "int data" as defined by the "int index".

To set a tag, you have to use the set_tag(Player *p, int index, int data) function. To read/get a tag you have to use the get_tag(Player *p, int index) function, where you will be checking for "int data".

Example - Setting a tag when a player calls command !sneeze checking if they have not triggered the command beforehand:

spawn.h:
Code: Show/Hide

#define INDEX 2         // This is your "int index". Call it whatever you want.

command.cpp
Code: Show/Hide

if (c->check("sneeze"))
{
      if (get_tag(p, INDEX) != 1) // This checks to see if '1' isn't stored for this player, meaning he didn't call !sneeze before.
            set_tag(p, INDEX, 1); // This will set the player's tag to '1', meaning he is calling !sneeze for the first time.
}


To clear all tags from a player, use the function killTags(Player *p).
Back to top
View users profile Send private message Add User to Ignore List
hellzlaker
Registered Cap Buster
Popping men in the ass since Oct 2005


Gender: NEVER ENOUGH!
Joined: Oct 27 2005
Posts: 34
Offline

PostPosted: Fri Apr 04, 2008 7:51 pm    Post subject: Reply to topic Reply with quote

i kinda get it just need to clear some things up ( divided into 2 steps so its easier to explain what i tried to say)
STEP 1
Code: Show/Hide
if (get_tag(p, INDEX) != 1)
this checks if INDEX doesn't = to 1 (we defined it to 2 before..) so it does the following

STEP2
Code: Show/Hide
set_tag(p, INDEX, 1);
by what i understand it doesn't change INDEX and creates a new int data which = to 1 so as i understand INDEX is still exactly the same so if someone !sneezes second time it will go to STEP1 and it will check if INDEX != to 1, and it wont since as i understood we did not change INDEX in STEP 1 ..

so by what i understand it wont do anything but i know I am wrong I just want to know why ?
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address MSN Messenger
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, 3  Next
Page 1 of 3

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

phpBB Created this page in 0.520897 seconds : 50 queries executed (89.9%): GZIP compression disabled