What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Release] Enhanced PSM (Version 2.1)

[Release] Enhanced PSM (Version 2.1)
Author: Message:
phalanxii
Full Member
***


Posts: 146
Reputation: 5
32 / Male / Flag
Joined: Aug 2006
Status: Away
RE: RE: [Release] Enhanced PSM (Version 1.0)
I know you fixed this, but just to give you some extra knowledge. :) According to MSDN, the "+" operator concatenates all expressions (joins two strings) unless "both expressions are numeric or Boolean". This does not apply to any other mathematical operators though, including the multiplication operator (which can therefore be used to convert strings to numbers). For example:
code:
var Number = "123"; //Number is not a number, but a string with "123"
Number = Number + 56; //The addition operator has concatenated the strings "123" and "56" into "12356", not "179"
Number = Number * 1; //The multiplication operator has converted Number into a Number object
Number = Number + 25; //Number is a Number object, so the addition operator results in 12356 + 25 = 12381
This means that you could alternately have converted your string into a Number by doing this:
code:
if(ControlId=="arrow_left2"){
   nudge=10; //just so you know the value
   current = ConfigWnd.GetControlText("txt_width")*1
   ConfigWnd.SetControlText("txt_width",current+nudge);
   OnConfigEvent_CtrlClicked("", "btn_apply");
}
Note that in the original code, ConfigWnd.GetControlText("txt_width") is actually a string, thereby concatenating current+nudge, instead of adding. By adding the *1, current becomes a Number and the addition works normally.

The reason why current-(-nudge) also works is because the subtraction operator functions mathematically regardless of whether either expression is a string (like the multiplication), so when you use it, the current string is automatically converted to a Number object. The addition operator, on the other hand, tried to join the current string with the nudge number into one long string, instead of adding them like numbers.

Hope this helps make it easier for you to script with numbers! :P(Y)

NOTE: I haven't looked through the script, but if the nudge variable is a string as well, that also needs to be converted into a number! Be careful to note that nudge=10 is different to nudge="10"! The first is a number, the second is a string!

EDIT: Hehe... missed by a minute, Mattike! :P

This post was edited on 11-18-2006 at 09:43 AM by phalanxii.
11-18-2006 09:37 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[Release] Enhanced PSM (Version 2.1) - by Spunky on 10-25-2006 at 06:16 PM
RE: [Release] Enhanced PSM (Version 1.0) - by MoonGoose on 10-25-2006 at 06:42 PM
RE: [Release] Enhanced PSM (Version 1.0) - by Spunky on 10-25-2006 at 07:24 PM
RE: [Release] Enhanced PSM (Version 1.0) - by Jimbo on 10-25-2006 at 07:31 PM
RE: [Release] Enhanced PSM (Version 1.0) - by Spunky on 10-25-2006 at 07:32 PM
RE: [Release] Enhanced PSM (Version 1.0) - by Thor on 10-25-2006 at 07:35 PM
RE: [Release] Enhanced PSM (Version 1.0) - by Jimbo on 10-25-2006 at 07:35 PM
RE: [Release] Enhanced PSM (Version 1.0) - by Spunky on 10-25-2006 at 07:42 PM
RE: [Release] Enhanced PSM (Version 1.0) - by Jimbo on 10-25-2006 at 07:45 PM
RE: [Release] Enhanced PSM (Version 1.0) - by Spunky on 10-25-2006 at 07:47 PM
RE: [Release] Enhanced PSM (Version 1.0) - by Jimbo on 10-25-2006 at 07:50 PM
RE: [Release] Enhanced PSM (Version 1.0) - by Spunky on 10-25-2006 at 07:53 PM
RE: [Release] Enhanced PSM (Version 1.0) - by Jimbo on 10-25-2006 at 07:53 PM
RE: [Release] Enhanced PSM (Version 1.0) - by Spunky on 10-25-2006 at 07:56 PM
RE: [Release] Enhanced PSM (Version 1.0) - by Jimbo on 10-25-2006 at 07:57 PM
RE: [Release] Enhanced PSM (Version 1.0) - by Solar_custom on 10-27-2006 at 09:11 PM
RE: [Release] Enhanced PSM (Version 1.0) - by Spunky on 10-27-2006 at 10:38 PM
RE: [Release] Enhanced PSM (Version 1.0) - by elektra on 11-12-2006 at 07:04 PM
RE: [Release] Enhanced PSM (Version 1.0) - by Spunky on 11-13-2006 at 08:37 PM
RE: [Release] Enhanced PSM (Version 1.0) - by Jimbo on 11-13-2006 at 08:41 PM
RE: [Release] Enhanced PSM (Version 1.0) - by elektra on 11-13-2006 at 08:47 PM
RE: [Release] Enhanced PSM (Version 1.0) - by vaccination on 11-13-2006 at 08:47 PM
RE: [Release] Enhanced PSM (Version 1.0) - by Spunky on 11-13-2006 at 08:48 PM
RE: [Release] Enhanced PSM (Version 1.0) - by Jimbo on 11-13-2006 at 08:49 PM
RE: [Release] Enhanced PSM (Version 1.0) - by Spunky on 11-13-2006 at 08:52 PM
RE: [Release] Enhanced PSM (Version 1.0) - by Jimbo on 11-13-2006 at 08:53 PM
RE: [Release] Enhanced PSM (Version 1.0) - by Spunky on 11-13-2006 at 09:00 PM
RE: [Release] Enhanced PSM (Version 1.0) - by Spunky on 11-13-2006 at 09:36 PM
RE: [Release] Enhanced PSM (Version 1.0) - by elektra on 11-13-2006 at 09:57 PM
RE: [Release] Enhanced PSM (Version 1.0) - by Jimbo on 11-14-2006 at 07:52 AM
RE: [Release] Enhanced PSM (Version 1.0) - by Spunky on 11-14-2006 at 11:48 AM
RE: [Release] Enhanced PSM (Version 1.0) - by Jimbo on 11-14-2006 at 03:26 PM
RE: [Release] Enhanced PSM (Version 1.0) - by Psychotic-Retard on 11-14-2006 at 05:18 PM
RE: [Release] Enhanced PSM (Version 1.0) - by Spunky on 11-14-2006 at 05:35 PM
RE: [Release] Enhanced PSM (Version 1.0) - by duck! on 11-14-2006 at 06:33 PM
RE: [Release] Enhanced PSM (Version 1.0) - by Spunky on 11-18-2006 at 02:25 AM
RE: [Release] Enhanced PSM (Version 1.0) - by Plan-1130 on 11-18-2006 at 07:41 AM
RE: RE: [Release] Enhanced PSM (Version 1.0) - by phalanxii on 11-18-2006 at 09:37 AM
RE: [Release] Enhanced PSM (Version 1.0) - by Matti on 11-18-2006 at 09:38 AM
RE: [Release] Enhanced PSM (Version 1.0) - by Spunky on 11-18-2006 at 07:04 PM
RE: [Release] Enhanced PSM (Version 1.0) - by elektra on 11-19-2006 at 10:44 AM
RE: [Release] Enhanced PSM (Version 1.0) - by Spunky on 11-19-2006 at 02:04 PM
RE: [Release] Enhanced PSM (Version 2.1) - by elektra on 11-19-2006 at 03:49 PM


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