Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   getplayer (https://forums.graalonline.com/forums/showthread.php?t=62524)

talkingnoodle 11-27-2005 07:15 PM

getplayer
 
with(getplayer(params[1])) ..ive tried that and it doesnt work on gs2...is there another way instead of getplayer() now in GS2?

napo_p2p 11-27-2005 07:52 PM

findplayer

talkingnoodle 11-27-2005 07:58 PM

with(findPlayer(params[1])){

//

}

would work?

talkingnoodle 11-27-2005 08:05 PM

its not working :'(

Damix2 11-27-2005 08:16 PM

Don't need to use with?

Code taken out by Damix =D

Ok Stefan, I'm still learning too ^^

talkingnoodle 11-27-2005 08:39 PM

NPC Code:
if (params[0] == "kills"){
findplayer(params[1]).player.chat = "You have killed "@params[2]@"";
findplayer(params[1]).setstring("clientr.kills",player.clientr.kills+1 );
}



Message in RC:

Quote:

error: setstring(varname,string) is not an object function at line 10: findplayer(params[1]).setstring(clientr.kills,player.clientr.kills+1);

Skyld 11-27-2005 09:06 PM

Quote:

Originally Posted by Damix2
Don't need to use with?

NPC Code:
findplayer(account).say2="heya";


Huh. That's findPlayer(account).say2("Heya").
Quote:

Originally Posted by talkingnoodle
Message in RC:

That means that you're using setstring() as an object function (in this case, the object being the player you're findplayer()ing), where it isn't applicable.

Why not just use findPlayer(account).clientr.kills ++?

Fry 11-27-2005 09:39 PM

Additionally,
temp.player = findplayer(params[1]);
temp.player.chat = "foo";
temp.player.clientr.kills ++;

Certainly findplayer acts internally like getplayer in GS1, which, as we know, can produce quite some lag if used too often.

Admins 11-28-2005 12:16 AM

findplayer/getplayer are quite fast though :) May be some mod should delete/edit the posts which contain all that bad code x-x

CheeToS2 11-28-2005 12:47 AM

Quote:

Originally Posted by Stefan
findplayer/getplayer are quite fast though :) May be some mod should delete/edit the posts which contain all that bad code x-x

I am curious; if you call findplayer() multiple times for the same person, will there be any difference than when you store the result in an object? I'm guessing there is, but I want to know for sure. Example:

Would
plyr = findplayer("Stefan");
plyr.rupees++;
plyr.bombs++;

be faster than

findplayer("Stefan").rupees++;
findplayer("Stefan").bombs++;

The first looks nicer anyway :)

jake13jake 12-09-2005 08:28 AM

Quote:

Originally Posted by Fry
Additionally,
temp.player = findplayer(params[1]);
temp.player.chat = "foo";
temp.player.clientr.kills ++;

Certainly findplayer acts internally like getplayer in GS1, which, as we know, can produce quite some lag if used too often.

really.. you can do object.var = object? didn't know that!

I wonder how many times i've done t = temp;


All times are GMT +2. The time now is 07:07 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.