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
8ball - build 2

 
Post new topic   Reply to topic Printable version
 View previous topic  Need help with a simple bot Post :: Post TM Vex Source code anyone?  View next topic  
Author Message
CypherJF
I gargle nitroglycerin


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

PostPosted: Thu Jun 17, 2004 5:08 am    Post subject: 8ball - build 2 Reply to topic Reply with quote

Was going through my old plugin files, and found this and updated it...

Added Support for sayings to be read from an INI file.

Commands added in build 2:
!reloadsayings - reloads the INI file.

Have fun.
_________________
Performance is often the art of cheating carefully. - James Gosling




8ball build2

8ball.b2.zip - 21.96 KB
File downloaded or viewed 19 time(s)
Back to top
View users profile Send private message Add User to Ignore List
SuSE
Me measures good


Joined: Dec 02 2002
Posts: 2307
Offline

PostPosted: Thu Jun 17, 2004 5:14 am    Post subject: Reply to topic Reply with quote

OMFG <SPURT>
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website
CypherJF
I gargle nitroglycerin


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

PostPosted: Thu Jun 17, 2004 5:14 am    Post subject: Reply to topic Reply with quote

$$
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: Thu Jun 17, 2004 11:12 am    Post subject: Reply to topic Reply with quote

Where's the source code?
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: Thu Jun 17, 2004 3:04 pm    Post subject: Reply to topic Reply with quote

got command 8ball->

random numner n = (0-numersponses-1)

sendPrivate(p,resonses[n]);


there's your source
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Thu Jun 17, 2004 8:00 pm    Post subject: Reply to topic Reply with quote

I think that source will always negatively index the array, dude.
_________________
This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
50% Packetloss
Server Help Squatter


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

PostPosted: Thu Jun 17, 2004 8:52 pm    Post subject: Reply to topic Reply with quote

lol 0 - numberofresponces -1
yah that will be real nice negative result

better would probably be
int range=numberofresponces+1;
responces[int(range * rand()/(RAND_MAX + 1.0));];
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
CypherJF
I gargle nitroglycerin


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

PostPosted: Thu Jun 17, 2004 9:40 pm    Post subject: Reply to topic Reply with quote

If anyone really needs the src, they can email or PM me; but...


int temp = rand()%max_resp;

and it's seeded on the first !8ball request...
Back to top
View users profile Send private message Add User to Ignore List
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Thu Jun 17, 2004 11:11 pm    Post subject: Reply to topic Reply with quote

I'd recommend seeding ahead of time and throwing away one rand(), because I've noticed mysterious duplicates on the first rand() called from a similar seed.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
50% Packetloss
Server Help Squatter


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

PostPosted: Fri Jun 18, 2004 2:20 pm    Post subject: Reply to topic Reply with quote

if there are 0 responces, rand()%0 will crash the program
yah and seed rand() in spawn.h
srand(static_cast<unsigned>(time(0)));
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
CypherJF
I gargle nitroglycerin


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

PostPosted: Fri Jun 18, 2004 10:00 pm    Post subject: Reply to topic Reply with quote

max_resp is hard-coded to 9 responces. If a responce is blank in the INI it uses the programs' default.

and is seeded w/ the current time... when the first !8ball is done.




w/ src.

8ball.b2.zip - 28.78 KB
File downloaded or viewed 12 time(s)
Back to top
View users profile Send private message Add User to Ignore List
Bak
?ls -s
0 in


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

PostPosted: Fri Jun 18, 2004 10:48 pm    Post subject: Reply to topic Reply with quote

Quote:
0 - numberofresponces -1
yah that will be real nice negative result


it was meant as a "to" rather than a minus... like if i say I have 5-10 minutes to get to the store I don't mean I have negative 5 minutes.

so 0 to numberofresponces-1
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Sat Jun 19, 2004 12:16 pm    Post subject: Reply to topic Reply with quote

static_cast is totally unnecessary. A time_t is a perfectly good argument for srand()
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 Jun 19, 2004 9:00 pm    Post subject: Reply to topic Reply with quote

$$
Back to top
View users profile Send private message Add User to Ignore List
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: 108 page(s) served in previous 5 minutes.

phpBB Created this page in 0.512431 seconds : 41 queries executed (93.3%): GZIP compression disabled