Raised This Month: $32 Target: $400
 8% 

Bot Apology for TK


Post New Thread Reply   
 
Thread Tools Display Modes
Vet
Veteran Member
Join Date: Jul 2006
Location: I|O wa
Old 02-23-2009 , 10:53   Re: Bot Apology for TK
Reply With Quote #21

FYI, we run this plugin on our server and it appears to do the job quite well.

Programming wise, like I always say, there's many ways to skin a cat (I prefer pliers). So unless the code is in a critical routine (like a prethink), 'to each his own'.
__________________
=====================================
- My Plugins -
=====================================
Vet is offline
Send a message via MSN to Vet
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-23-2009 , 11:07   Re: Bot Apology for TK
Reply With Quote #22

Apparently you have not run my plugin with bots yet. . I guaruntee it will work on DOD with Shrikebot. It's running on a public server right now.

Ham :::
I had a bit of trouble with Ham. I was required to check a alot more stuff (maybe not alot, but enough to be annoying). I was getting killerids like 59, 639, 520, . . . (59 is electric ally on dod_caen). If you are saying Ham is quicker to the draw, it doesn't matter, the response is delayed anyways. Also, if it can be done with only one include and I don't need to do anything like supercede this way is great afaik.

is_user_bot(id) :::
Go back and read arkshine's comments. (minimize native calls)

Random :::
No. For the phrases I want random (just plain random, well, pseudorandom ).

chance(prob) :::

chance(100) returns true 100% of the time.
chance(50) returns true 50% of the time (statistically).
chance(1) returns true 1% of the time (statistically).
chance(0) returns true 0% of the time (i.e. always returns false.)

engclient_cmd() :::

You can't send a client command to a bot (i.e. can't use client_cmd) afaik. engclient_cmd sends a command to the server as if it is coming from the client and it works great!

Why would I use a case structure if I can just assign a variable and pass that variable to the command?

Quote:
overall i think you make it way more complicated then it have to be...
As far as I'm concerned this code is very simple (Once I got things straightened out).

Quote:
Did that bot just apologiz to me?

Last edited by fysiks; 02-23-2009 at 11:12.
fysiks is offline
Meathead~MBG~
Junior Member
Join Date: Mar 2009
Old 03-01-2009 , 01:41   Re: Bot Apology for TK
Reply With Quote #23

That would be my server. Working fine.

From HLSW
Quote:
(Allies) Pvt.*LiTTleKings : sory
(Allies) Pvt.*LiTTleKings : sory
(Allies) Pvt.*naTurAlliGht : sorry
( Axis) Pvt.*mOOsEheaD : sorry
(Allies) Pvt.*naTurAlliGht : sorry!
(Allies) Pvt.*CaN : sry
( Axis) Pvt.*BoTTle : sry!
( Axis) Pvt.*st.paulyGURL : sry
(Allies) Pvt.*HEINEken : oops sorry
( Axis) Pvt.*BoTTle : sry
( Axis) Pvt.*sChLitZ : sory
(Allies) Pvt.*KEGGER : oops sorry
( Axis) Pvt.*sChLitZ : sorry!
(Allies) Pvt.*KEGGER : sory
__________________
Meathead~MBG~ is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-29-2009 , 15:34   Re: Bot Apology for TK
Reply With Quote #24

1. Would be better to have a .ini file so they could put their own apology messages.

2.
Code:
new chat_method[9] // chat_method = chance(get_pcvar_num(cvar_chat_method)) ? "say_team" : "say"; // Does not work :(; runtime error 5:memory access; line 90,72 if(chance(get_pcvar_num(cvar_chat_method))) // Is it said in public or team chat? {   chat_method = "say_team"; } else {   chat_method = "say"; }
Use copy() instead.

3.
Code:
// Given the probability, does it happen? bool:chance(probability) {     // return ( clamp(probability,0,100) > random_num(0,99) )     return ( probability > random_num(0,99) )  // Faster without pointless native call. }
If it is something like this that can be made with one line, it's better to make it a define and place it at the top of the plugin.
Also, random numbers should be 1-100
Code:
#define chance(%1) ( probability >= random_num(1, 100) )

Approval pending upon changes.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-29-2009 , 15:56   Re: Bot Apology for TK
Reply With Quote #25

I greatly appreciate your input.

ini file: Should I use dynamic arrays for retrieving the apology messages or should I hard code a cap (max) (with a #define probably)?

Chance: If using '>=' you must use 1-100 but if using only the '>' 0-99 is correct.

I'll get to work on this.
__________________
fysiks is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-29-2009 , 15:59   Re: Bot Apology for TK
Reply With Quote #26

I would suggest dynamic arrays, but it's however you wish.

As for the chance calculation, you are correct. I just use 1-100 because it's more readable.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-29-2009 , 16:56   Re: Bot Apology for TK
Reply With Quote #27

Updated. Let me know if I can improve it anymore. I will look into using dynamic arrays for phrases sometime in the near future.

I have a max of 10 phrases (this can be changed in the code: "SORRYS_MAX").

Thanks everybody.
__________________

Last edited by fysiks; 03-29-2009 at 18:28. Reason: typo: or -> of
fysiks is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 03-29-2009 , 18:19   Re: Bot Apology for TK
Reply With Quote #28

Quote:
Originally Posted by fysiks View Post
Updated. Let me know if I can improve it anymore. I will look into using dynamic arrays for phrases sometime in the near future.

I have a max or 10 phrases (this can be changed in the code: "SORRYS_MAX").

Thanks everybody.
Congratulations fysiks.
__________________
joaquimandrade is offline
Vet
Veteran Member
Join Date: Jul 2006
Location: I|O wa
Old 03-29-2009 , 21:54   Re: Bot Apology for TK
Reply With Quote #29

GJ my man
__________________
=====================================
- My Plugins -
=====================================
Vet is offline
Send a message via MSN to Vet
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-30-2009 , 19:06   Re: Bot Apology for TK
Reply With Quote #30

Wahooo! Thanks guys.
__________________
fysiks is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:53.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode