What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Random Numbers

Random Numbers
Author: Message:
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
35 / Male / Flag
Joined: Aug 2006
O.P. Random Numbers
I know that there must be a random function that I can use for my scripts, I just can't find it. I tried:
code:
myNum = Random(15);


It's for a colourful text program I made for a friend...
<Eljay> "Problems encountered: shit blew up" :zippy:
08-20-2006 10:51 PM
Profile PM Find Quote Report
Silentdragon
Full Member
***

Avatar
if(life==null && wrists) EmoAlert();

Posts: 148
Reputation: 2
34 / Male / –
Joined: Jun 2006
RE: Random Numbers
code:
myNum = Math.floor(Math.random()*15);
Should give you a random number between 0 and 15

If you want 1  to 15

code:
myNum = Math.floor(Math.random()*14+1);
Should work.

This post was edited on 08-20-2006 at 11:02 PM by Silentdragon.
08-20-2006 11:01 PM
Profile E-Mail PM Web Find Quote Report
KnRd_WC
Junior Member
**

Avatar
Florian PAQUET

Posts: 74
Reputation: 1
35 / Male / Flag
Joined: Aug 2006
RE: Random Numbers
Hi !

Try this ;)

code:
myNum = Math.floor(Math.random()*16);
// myNum will be between 0 and 15, if you don't want to have 0, use this one :
// myNum = Math.floor(Math.random()*15)+1;

;)

--------------
Lol Silentdragon, we don't say the same thing.... !! :D

This post was edited on 08-20-2006 at 11:11 PM by KnRd_WC.
08-20-2006 11:05 PM
Profile PM Web Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
35 / Male / Flag
Joined: Aug 2006
O.P. RE: Random Numbers
Thanks guys! Didn't work at first, but I'd missed off a closing bracket :$ 

Heres the finished script incase anybody is interested...

EDIT - Start the message with a space if you do not want it to be sent using the script to add colour.  Also, messages that start with "/" have colours disabled so you can still use commands. I caught that little glitch when I tried to get into my preferences :D

Before the colour was the same number as the i variable in the For loop

.plsc File Attachment: Colours.plsc (896 bytes)
This file has been downloaded 121 time(s).

This post was edited on 08-20-2006 at 11:20 PM by Spunky.
<Eljay> "Problems encountered: shit blew up" :zippy:
08-20-2006 11:17 PM
Profile PM Find Quote Report
KnRd_WC
Junior Member
**

Avatar
Florian PAQUET

Posts: 74
Reputation: 1
35 / Male / Flag
Joined: Aug 2006
Grin  RE: Random Numbers
Very funny script ;)

**Disco on messenger !!** lol
08-20-2006 11:25 PM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On