Author Topic: Script_Advert - announce anything server-wide  (Read 2544 times)

That could still return string values? If %val = "hello";
Please at least open up Blockland and test things out before claiming said things.

Alright, will re-write

Please at least open up Blockland and test things out before claiming said things.
You're right.
Code: [Select]
//Code value test
function serverCMDCheckInt(%client,%val)
{
if(%val * 1 = %val)
echo("\c6 Value is \c4" @ %val @ " ");
else
echo("\c0 Value Error");
}

That code doesn't work at all, so it returns nothing
« Last Edit: May 30, 2015, 01:40:46 PM by Goth77 »

You're right.
Code: [Select]
//Code value test
function serverCMDCheckInt(%client,%val)
{
if(%val * 1 = %val)
echo("\c6 Value is \c4" @ %val @ " ");
else
echo("\c0 Value Error");
}

That code doesn't work at all, so it returns nothing
It'd need to be
Code: [Select]
if(%val * 1 == %val)But it doesn' t work as a check for numbers anyways. Try the below code with anything as %val:
%val = "h"; if(%val * 1 == %val) { echo("it's a number"); }
Now try out this code:
%val = "545"; if(%val * 1 $= %val) { echo("it's a number"); }
It actually seems to to exactly as intended, until INTEGER numbers exceed negative or positive 1 million as the number string is changes to 1.0000e+006.
EDIT: It'll only take 6 digits total, whether it be -53.6353, 535632, -0.157845, or -1.52453, so you'd probably want to ensure this isn't exceeded if you use this code for other purposes.
« Last Edit: May 30, 2015, 02:51:28 PM by QuadStorm »

It'd need to be
Code: [Select]
if(%val * 1 == %val)But it doesn' t work as a check for numbers anyways. Try the below code with anything as %val:
%val = "h"; if(%val * 1 == %val) { echo("it's a number"); }
Now try out this code:
Code: [Select]
(%val * 1 $= %val)It actually seems to work exactly as intended, until numbers exceed negative or positive 1 million as the number string is changes to 1.0000e+006.
This actually works, and is a nice shortcut; The only reason I prefer the stripChar over this is because it "cuts out" the string characters and keeps the numbers, whereas this method prevents any characters except - (and only counts it if it's the first character). I guess they are both beneficial in their own way. Thanks for the info, QuadStorm  :cookie: