User Control Panel
Advertisements

HELP US, HELP YOU!

Random number

 
Post new topic   Reply to topic    Bot Depot Forum Index -> Commands
View unanswered posts
Author Message
JoeX
Agent
Agent


Joined: 02 Jan 2004
Posts: 2153

Reputation: 72.7

PostPosted: Fri Apr 09, 2004 1:00 pm    Post subject: Reply with quote

You will have to type the number you want. e.g: !rand 9 and it will return a number under 9, You can put any number there
Code:
# COMMAND NAME:<br />#   Random Number<br /># DESCRIPTION:<br />#   Chooses  A Number<br /># COMPATIBILITY:<br />#   MSN<br /><br />sub rand {<br />my ($self,$client,$msg,$listener) = @_;<br />my $random = int(rand($msg));<br />if ($listener eq "MSN") {<br />$self->sendmsg ("Random Number:$random");<br />}<br />}<br />1;

_________________
Heroes NBC
Back to top
night
Not Yet a God
Not Yet a God


Joined: 06 Jan 2004
Posts: 498

Reputation: 38.4Reputation: 38.4Reputation: 38.4Reputation: 38.4

PostPosted: Fri Apr 09, 2004 1:47 pm    Post subject: Reply with quote

very nice work joe
Back to top
jeanhub
Almost An Agent
Almost An Agent


Joined: 14 Feb 2004
Posts: 1138

Reputation: 50.7

PostPosted: Fri Apr 09, 2004 1:48 pm    Post subject: Reply with quote

Lol Basic but nice Good work Wink
Back to top
Cer
Upgraded Agent
Upgraded Agent


Joined: 03 Feb 2004
Posts: 3776
Location: Michigan
Reputation: 146.9
votes: 4

PostPosted: Fri Apr 09, 2004 2:47 pm    Post subject: Reply with quote

QUOTE(JoeX @ Apr 9 2004, 08:00 AM)
Code:
$self->sendmsg ("Random Number:$random");<br />

Do NOT use sendmsg to give the reply for the command!

That is HORRIBLE Perl form!

Use return instead!
____________

Sendmsg/Send_IM is used ONLY when the command is to return more than one response, or if you have to return the reply with a different font than your normal font (i.e. monospaced font Courier New)

_________________
Current Site (2008) http://www.cuvou.com/
Back to top
Calum
Not Yet a God
Not Yet a God


Joined: 21 Feb 2004
Posts: 373
Location: england
Reputation: 34.7Reputation: 34.7Reputation: 34.7

PostPosted: Fri Apr 09, 2004 5:25 pm    Post subject: Reply with quote

Code:
# COMMAND NAME:<br /># Random Number<br /># DESCRIPTION:<br /># Chooses  A Number<br /># COMPATIBILITY:<br /># MSN<br /><br />sub rand {<br />my ($self,$client,$msg,$listener) = @_;<br />my $random = int(rand($msg));<br />if ($listener eq "MSN") {<br />$return Random Number:$random;<br />}<br />}<br />1;
Back to top
Keenie
Almost An Agent
Almost An Agent


Joined: 31 Oct 2003
Posts: 1071

Reputation: 52.4

PostPosted: Fri Apr 09, 2004 5:30 pm    Post subject: Reply with quote

i dont see why these lame commands are even checking the listener, why cant random numbers work on aim? thats kinda stupid.

Code:
sub rand <br />{<br />   my ($self,$client,$msg,$listener) = @_;<br />   return int(rand($msg));<br />}<br />1;


you will also need to add one if you want it between 1 and message
and not 0 and (message -1)
Back to top
Cer
Upgraded Agent
Upgraded Agent


Joined: 03 Feb 2004
Posts: 3776
Location: Michigan
Reputation: 146.9
votes: 4

PostPosted: Fri Apr 09, 2004 5:46 pm    Post subject: Reply with quote

People are dense and can't understand how Juggernaut works.

I myself only check for listeners on a minority of commands, most of which include away statuses and messaging third parties.

Other than that, all my commands should work on all messengers as they usually just return replies.

_________________
Current Site (2008) http://www.cuvou.com/
Back to top
eric256
The Keymaker
The Keymaker


Joined: 03 May 2006
Posts: 2292
Location: Colorado
Reputation: 47Reputation: 47Reputation: 47Reputation: 47Reputation: 47

PostPosted: Fri Apr 09, 2004 6:04 pm    Post subject: Reply with quote

You could also add a sendmsg command that determines the listener so that commands don't have to Smile


update: i know you still need to check the listener for certain other things

_________________
Eric256
Proud previous owner and current admin of Bot-depot.com
Back to top
Cer
Upgraded Agent
Upgraded Agent


Joined: 03 Feb 2004
Posts: 3776
Location: Michigan
Reputation: 146.9
votes: 4

PostPosted: Fri Apr 09, 2004 9:34 pm    Post subject: Reply with quote

Yeah . . .

I might make a kind of universal in-between kind of module, where you send it a command like.. "send a message", "block", etc., and the module will do the right command for whatever messenger or something.

_________________
Current Site (2008) http://www.cuvou.com/
Back to top
GrimReaper
Young One
Young One


Joined: 26 Mar 2004
Posts: 86

Reputation: 27.5Reputation: 27.5Reputation: 27.5

PostPosted: Fri Apr 09, 2004 10:21 pm    Post subject: Reply with quote

hm... not that im saying its bad code, but whats the point of this? i guess some people like random numbers then...
Back to top
Cer
Upgraded Agent
Upgraded Agent


Joined: 03 Feb 2004
Posts: 3776
Location: Michigan
Reputation: 146.9
votes: 4

PostPosted: Sat Apr 10, 2004 3:27 am    Post subject: Reply with quote

Ohhh I have an idea for the next release of Juggernaut!

isCommand.pl - command checker
Code:
$reply = &{$key} ($self,$client,$msg,$listener) || "The creator of this command is a terrible newbie who does not know how to properly return a single reply from a command.";


So what do you think? Like it? Very Happy

_________________
Current Site (2008) http://www.cuvou.com/
Back to top
JoeX
Agent
Agent


Joined: 02 Jan 2004
Posts: 2153

Reputation: 72.7

PostPosted: Sat Apr 10, 2004 8:25 am    Post subject: Reply with quote

QUOTE(Cer @ Apr 9 2004, 07:27 PM)
Ohhh I have an idea for the next release of Juggernaut!

isCommand.pl - command checker
Code:
$reply = &{$key} ($self,$client,$msg,$listener) || "The creator of this command is a terrible newbie who does not know how to properly return a single reply from a command.";


So what do you think? Like it? Very Happy

Cer, I think is is a good command, Since I have never coded Juggernaut before, Why do you always have something bad to post alongside with everypost I do?

_________________
Heroes NBC
Back to top
eric256
The Keymaker
The Keymaker


Joined: 03 May 2006
Posts: 2292
Location: Colorado
Reputation: 47Reputation: 47Reputation: 47Reputation: 47Reputation: 47

PostPosted: Sat Apr 10, 2004 4:29 pm    Post subject: Reply with quote

JoeX you need to learn to program and not whine. We try to help you learn to make better code and you whine. Learn from you mistakes or just stop whineing. Yes i know i'm a mean horrible person.
_________________
Eric256
Proud previous owner and current admin of Bot-depot.com
Back to top
JoeX
Agent
Agent


Joined: 02 Jan 2004
Posts: 2153

Reputation: 72.7

PostPosted: Sun Apr 11, 2004 10:22 pm    Post subject: Reply with quote

lol eric, I had one quick look at Juggernaut, Then made 2 commands, Sorry, If I know you wouldnt like it, I wouldnt post it.
_________________
Heroes NBC
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> Commands All times are GMT
Page 1 of 1

 



Protected by phpBB Security phpBB-TweakS
phpBB Security Has Blocked 9 Exploit Attempts.
Antispam Captcha Mod by phpbb-security.com
Powered by phpBB © 2001, 2005 phpBB Group