Author Topic: WaterDamage Modification  (Read 1301 times)


holy stuff kid shut up
Best argument 2012. Just in time, too. I'm not going to stand here while you fling unintelligent stuff at people and discredit completely valid methods of checking. %obj.getType() & $TypeMasks::PlayerObjectType is JUST as valid as %obj.getClassname() $= "Player".

It's not "just as valid", you dolt. My way is better.

Code: [Select]
function sperglord(%obj)
{
// 5 runs of 100,000 iterations
for(%a = 0; %a < 5; %a++)
{
%startTime = getRealTime();

for(%b = 0; %b < 100000; %b++)
{
if(%obj.getClassName() $= "AIPlayer" || %obj.getClassName() $= "Player")
{

}
}

echo("\"function sperglord\" Runtime Cycle " @ %a @ ":" SPC (getRealTime() - %startTime) @ "ms");
}
}

function better(%obj)
{
// 5 runs of 100,000 iterations
for(%a = 0; %a < 5; %a++)
{
%startTime = getRealTime();

for(%b = 0; %b < 100000; %b++)
{
if(%obj.getType() & $TypeMasks::PlayerObjectType)
{

}
}

echo("\"function better\" Runtime Cycle " @ %a @ ":" SPC (getRealTime() - %startTime) @ "ms");
}
}

Code: [Select]
==>sperglord(findClientByName("Frontier").player);
"function sperglord" Runtime Cycle 0: 64ms
"function sperglord" Runtime Cycle 1: 62ms
"function sperglord" Runtime Cycle 2: 60ms
"function sperglord" Runtime Cycle 3: 59ms
"function sperglord" Runtime Cycle 4: 57ms
==>better(findClientByName("Frontier").player);
"function better" Runtime Cycle 0: 24ms
"function better" Runtime Cycle 1: 24ms
"function better" Runtime Cycle 2: 23ms
"function better" Runtime Cycle 3: 22ms
"function better" Runtime Cycle 4: 21ms

I don't know what sort of high you get off challenging what I've said, but you're wrong. You've completely lost this. Your way is almost three times slower than mine, and the more class names you add to that if statement the slower it goes.

It's not "just as valid", you dolt. My way is better.
Your way is better but the other way isn't invalid. You didn't say, "Yes, he is checking class name. That is slower, which is why I corrected him." You said it was "bad," which it really isn't.

I don't know what sort of high you get off challenging what I've said, but you're wrong. You've completely lost this. Your way is almost three times slower than mine, and the more class names you add to that if statement the slower it goes.
My way is none of the above. I didn't declare that getClassname() was faster, I didn't even take a side. I just said that getClassname() was valid. Speed was not even a factor in our prior argument. So, yeah, you're right, getType() is faster, but getClassname() is not under any circumstance invalid. I am not wrong.

So basically you're defending "the validity" of a method that is inarticulate and slow, just because it technically runs?

Please stop posting in Coding Help; you are a moron.
« Last Edit: December 09, 2012, 03:51:52 PM by Frontier Psychiatrist »

So basically you're defending a method that is inarticulate and slow, just because it technically runs?
I'm saying it's not invalid. Not to mention, yours only works if they are trying to net both AIPlayers and Players.
Quote
Trigun: well he's right in that you shouldn't ever use getClassName to check the object's type because a better method exists, hence getTYPE
Jailbot - RIP HPRC: it's not a better method
Jailbot - RIP HPRC: getType() will trigger for both players and aiplayers
Jailbot - RIP HPRC: as players
Jailbot - RIP HPRC: getClassname won't
Trigun: getType() and isObject(%obj.client) would be a faster check than even one getClassName, yet alone 2
Jailbot - RIP HPRC: that's not even the correct way to check if it's a player
Jailbot - RIP HPRC: what if it's a player that doesn't have a client
Jailbot - RIP HPRC: new player() { datablock=playerstandardarmor; }
Jailbot - RIP HPRC: ;
Jailbot - RIP HPRC: and it isn't two getClassNames
Jailbot - RIP HPRC: it is one
Trigun: if you want to have two operations for AIPlayer and Player, it is two
Jailbot - RIP HPRC: so in the scenario that you were trying to get both AIPlayers and Players, it would be faster to use getType
Jailbot - RIP HPRC: if you were checking for only actual players
Jailbot - RIP HPRC: it would be faster to use getClassName

Please stop posting in Coding Help; you are a moron.
I'm significantly more intelligent than you are; calling me a moron degrades you to the likes of a mongoloid.

I'm saying it's not invalid. Not to mention, yours only works if they are trying to net both AIPlayers and Players.
Quote
Trigun: well he's right in that you shouldn't ever use getClassName to check the object's type because a better method exists, hence getTYPE
Jailbot - RIP HPRC: it's not a better method
Jailbot - RIP HPRC: getType() will trigger for both players and aiplayers
Jailbot - RIP HPRC: as players
Jailbot - RIP HPRC: getClassname won't
Trigun: getType() and isObject(%obj.client) would be a faster check than even one getClassName, yet alone 2
Jailbot - RIP HPRC: that's not even the correct way to check if it's a player
Jailbot - RIP HPRC: what if it's a player that doesn't have a client
Jailbot - RIP HPRC: new player() { datablock=playerstandardarmor; }
Jailbot - RIP HPRC: ;
Jailbot - RIP HPRC: and it isn't two getClassNames
Jailbot - RIP HPRC: it is one
Trigun: if you want to have two operations for AIPlayer and Player, it is two
Jailbot - RIP HPRC: so in the scenario that you were trying to get both AIPlayers and Players, it would be faster to use getType
Jailbot - RIP HPRC: if you were checking for only actual players
Jailbot - RIP HPRC: it would be faster to use getClassName

Trigun: getType() and isObject(%obj.client) would be a faster check than even one getClassName, yet alone 2

Jailbot - RIP HPRC: so in the scenario that you were trying to get both AIPlayers and Players, it would be faster to use getType
Jailbot - RIP HPRC: if you were checking for only actual players
Jailbot - RIP HPRC: it would be faster to use getClassName


lmfao I cannot even believe how intentionally ignorant you are


I'm significantly more intelligent than you are; calling me a moron degrades you to the likes of a mongoloid.
"You know someone is losing an argument when they start talking like a James Bond villain."


I'm done here. Go create a drama about me so even the TorqueScript Illiterate can laugh at how daft you are.

Sorry OP that this kid decided to cigarette up your topic.

Trigun: getType() and isObject(%obj.client) would be a faster check than even one getClassName, yet alone 2

Jailbot - RIP HPRC: so in the scenario that you were trying to get both AIPlayers and Players, it would be faster to use getType
Jailbot - RIP HPRC: if you were checking for only actual players
Jailbot - RIP HPRC: it would be faster to use getClassName


lmfao I cannot even believe how intentionally ignorant you are
I don't think you understood what I said. Do you need a code example?

Code: [Select]
function isItAPlayer(%obj)
{
if(%obj.getClassname() $= "Player")
return 1;
return 0;
}

function isItAPlayerWithGetType(%obj)
{
if(%obj.getType() & $TypeMasks::PlayerObjectType && %obj.getClassname() $= "Player")
return 1;
return 0;
}
"You know someone is losing an argument when they start talking like a James Bond villain."
What? That's how I always talk.

I'm done here. Go create a drama about me so even the TorqueScript Illiterate can laugh at how daft you are.

Sorry OP that this kid decided to cigarette up your topic.
Why would I drama you? Because you decided to classify a method that is slower as invalid and wrong? getType() is definitely loving better, but getClassname() is not wrong.

Do you even know how to read?

Holy stuff I can't help but correct this because you're still completely ignorant.

Trigun himself said that it's faster to use isObject and getType in conjunction to eliminate AIPlayer/Player when pulling the TypeMask PlayerObjectType. That's what I was laughing at in that quote, because he had JUST SAID IT and you STILL GOT IT WRONG. Unless you're checking for an object that has no type (GameConnection for instance), it is never faster to use getClassName.

That means you're still wrong and that this method is still invalid.

Code: [Select]
// This is faster than getClassName.
function isPlayer(%obj) { return (%obj.getType() & $TypeMasks::PlayerObjectType) && isObject(%obj.client); }
function isBot(%obj) { return (%obj.getType() & $TypeMasks::PlayerObjectType) && !isObject(%obj.client); }

If you have any further questions about why what you're doing is wrong, please PM me. This is seriously problematic when I have you spreading false information to new scripters. I really want this confusion to be settled, and you obviously need more 1-on-1 coding help.

Do you even know how to read?

Holy stuff I can't help but correct this because you're still completely ignorant.

Trigun himself said that it's faster to use isObject and getType in conjunction to eliminate AIPlayer/Player when pulling the TypeMask PlayerObjectType. That's what I was laughing at in that quote, because he had JUST SAID IT and you STILL GOT IT WRONG. Unless you're checking for an object that has no type (GameConnection for instance), it is never faster to use getClassName.
It is faster to use isObject and getType in conjunction however it will not cover the scenario where there is a player object without a client attached to it.

That means you're still wrong and that this method is still invalid.
Do you know what invalid means? It is not invalid. The only scenario where it makes a perceivable difference in speed is where you spam check thousands of times in a row, which should never be done in a mod regardless. The difference is exceptionally negligible, it is not invalid. The code you posted past this relates to the comment above, it will not cover the scenario where there is a player object without a client.

If you have any further questions about why what you're doing is wrong, please PM me. This is seriously problematic when I have you spreading false information to new scripters. I really want this confusion to be settled, and you obviously need more 1-on-1 coding help.
I'm not spreading ANY false information.

Ladies, please. Take it somewhere else.

holy stuff you guys
why dont you loving set up a time comparison
run it like 1,000 million loving stuffty times
see which one is faster
then it would be settled.

holy stuff you guys
why dont you loving set up a time comparison
run it like 1,000 million loving stuffty times
see which one is faster
then it would be settled.
I did that literally 8 posts above yours and he still insists that his way is "equally valid".

It's like you people refuse to read or something.

I did that literally 8 posts above yours and he still insists that his way is "equally valid".
I never said equally valid, that is false. getType() is better. getClassName() however is also valid, just slower. It appears you are not any better with reading than others.