What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [?] Pow... err, triggering some function on certain convo events?

[?] Pow... err, triggering some function on certain convo events?
Author: Message:
phalanxii
Full Member
***


Posts: 146
Reputation: 5
32 / Male / Flag
Joined: Aug 2006
Status: Away
RE: RE: RE: [?] Pow... err, triggering some function on certain convo events?
quote:
Originally posted by CookieRevised
quote:
Originally posted by phalanxii
Next, you define your own functions like this (these are a few of mine):
code:
var Custom = {
   "base" : function (Number, FromBase, ToBase) {
             ...much stuff...
      }


objectname.toString([radix])
(convert to a base)

and

parseInt(numString, [radix])
(convert from a base)

?


Oh, cool. Never knew about that :$. Thanks, Cookie!



PS. Using Shondoit's way to make functions is much better and easier now... :)

EDIT: Here are my new and improved functions. :D
code:
function base (x, fromBase, toBase) {
   return parseInt(x, fromBase).toString(toBase).toUpperCase()
}
function choose (n, k) {
   if (n != Math.floor(n) || k != Math.floor(k) || n < 0 || k < 0 || k > n) return 0
   if (n == k || n == 0 || k == 0) return 1
   if (n > 170) return Number.POSITIVE_INFINITY
   return eval(Factorial(n) + "/(" + Factorial(n - k) + "*" + Factorial(k) + ")")
   function Factorial (x) {
      var Factorial = ""
      for (var i = 1; i < x; i++) {
         Factorial += i + "*"
      }
      Factorial += x
      return Factorial
   }
}
function gcd (a, b) {
   if (a != Math.floor(a) || b != Math.floor(b)) return undefined
   if (b == 0) return Math.abs(a)
   else return Math.abs(gcd(b, a % b))
}
function isprime (n) {
   if (n != Math.floor(n) || n < 0) return undefined
   if (n == 0 || n == 1) return false
   if (n == 2 || n == 3) return true
   if (n % 2 == 0 || n % 3 == 0) return false
   for (var k = 1; 6 * k <= Math.sqrt(n); k++) {
      if (n % (6 * k - 1) == 0 || n % (6 * k + 1) == 0) return false
   }
   return true
}
function lcm (a, b) {
   if (a != Math.floor(a) || b != Math.floor(b)) return undefined
   return Math.abs(a * b / gcd(a, b))
}
function root (b, n) {
   if (n == undefined) n = 2
   return Math.pow(b, 1 / n)
}

This post was edited on 09-20-2006 at 09:12 AM by phalanxii.
09-19-2006 06:48 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[?] Pow... err, triggering some function on certain convo events? - by Matti on 09-16-2006 at 11:41 AM
RE: [?] Powers - by markee on 09-16-2006 at 11:51 AM
RE: [?] Powers - by Matti on 09-16-2006 at 12:06 PM
RE: [?] Powers - by markee on 09-16-2006 at 12:23 PM
RE: [?] Powers - by CookieRevised on 09-16-2006 at 01:27 PM
RE: [?] Powers - by Matti on 09-16-2006 at 02:02 PM
RE: [?] Powers - by CookieRevised on 09-16-2006 at 02:11 PM
RE: [?] Pow... err, triggering some function on certain convo events? - by Matti on 09-16-2006 at 02:25 PM
RE: [?] Pow... err, triggering some function on certain convo events? - by deAd on 09-16-2006 at 08:00 PM
RE: [?] Pow... err, triggering some function on certain convo events? - by Matti on 09-17-2006 at 09:19 AM
RE: [?] Pow... err, triggering some function on certain convo events? - by phalanxii on 09-17-2006 at 10:18 AM
RE: [?] Pow... err, triggering some function on certain convo events? - by Plik on 09-17-2006 at 12:30 PM
RE: [?] Pow... err, triggering some function on certain convo events? - by Matti on 09-17-2006 at 12:38 PM
RE: [?] Pow... err, triggering some function on certain convo events? - by markee on 09-17-2006 at 12:46 PM
RE: [?] Pow... err, triggering some function on certain convo events? - by Matti on 09-17-2006 at 01:04 PM
RE: [?] Pow... err, triggering some function on certain convo events? - by Shondoit on 09-17-2006 at 03:30 PM
RE: RE: [?] Pow... err, triggering some function on certain convo events? - by CookieRevised on 09-17-2006 at 11:03 PM
RE: RE: RE: [?] Pow... err, triggering some function on certain convo events? - by deAd on 09-17-2006 at 11:18 PM
RE: [?] Pow... err, triggering some function on certain convo events? - by CookieRevised on 09-17-2006 at 11:42 PM
RE: [?] Pow... err, triggering some function on certain convo events? - by phalanxii on 09-18-2006 at 03:54 AM
RE: [?] Pow... err, triggering some function on certain convo events? - by Shondoit on 09-18-2006 at 05:57 AM
RE: [?] Pow... err, triggering some function on certain convo events? - by phalanxii on 09-18-2006 at 08:02 AM
RE: [?] Pow... err, triggering some function on certain convo events? - by Shondoit on 09-18-2006 at 11:09 AM
RE: [?] Pow... err, triggering some function on certain convo events? - by Matti on 09-18-2006 at 06:35 PM
RE: [?] Pow... err, triggering some function on certain convo events? - by Shondoit on 09-18-2006 at 08:07 PM
RE: [?] Pow... err, triggering some function on certain convo events? - by phalanxii on 09-18-2006 at 11:15 PM
RE: RE: [?] Pow... err, triggering some function on certain convo events? - by CookieRevised on 09-19-2006 at 06:34 AM
RE: RE: RE: [?] Pow... err, triggering some function on certain convo events? - by phalanxii on 09-19-2006 at 06:48 AM
RE: [?] Pow... err, triggering some function on certain convo events? - by Shondoit on 09-19-2006 at 05:20 AM
RE: [?] Pow... err, triggering some function on certain convo events? - by CookieRevised on 09-19-2006 at 10:50 AM
RE: [?] Pow... err, triggering some function on certain convo events? - by phalanxii on 09-19-2006 at 12:16 PM
RE: [?] Pow... err, triggering some function on certain convo events? - by Matti on 09-19-2006 at 06:33 PM
RE: [?] Pow... err, triggering some function on certain convo events? - by Shondoit on 09-19-2006 at 08:53 PM
RE: [?] Pow... err, triggering some function on certain convo events? - by phalanxii on 09-20-2006 at 12:31 AM
RE: [?] Pow... err, triggering some function on certain convo events? - by Shondoit on 09-20-2006 at 05:06 AM


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