Shoutbox

Variable + 1? - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: Variable + 1? (/showthread.php?tid=61723)

Variable + 1? by hpzone on 06-27-2006 at 10:42 AM

If the variable Sendmessageaway is declared like this:

var Sendmessageaway = "0";

How can I make it go up by 1 when I send a message to somebody?

Sendmessageaway++;
Sendmessageaway = Sendmessageaway + 1;
Sendmessageaway + 1;

Those didn't work! :)


RE: Variable + 1? by Eljay on 06-27-2006 at 10:44 AM

youre declaring it as a string and incrementing only works with numbers.

var Sendmessageaway = 0;
Sendmessageaway++;

will work


RE: Variable + 1? by Yomeh on 06-27-2006 at 10:46 AM

Its because you dont declare integers with "" just

code:
var Sendmessageaway = 0;
var Sendmessageaway++; // that should work


RE: Variable + 1? by Ezra on 06-27-2006 at 10:48 AM

Or use ParseInt(variable) to get the numbers from a string.

Also check out my script: http://shoutbox.menthix.net/showthread.php?tid=61...d=677157#pid677157

That is used to count the number of messages send, it might help you create yours.


RE: Variable + 1? by hpzone on 06-27-2006 at 10:48 AM

Thanks, it worked :)