Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-27-2005, 07:15 PM
talkingnoodle talkingnoodle is offline
Rapidwolve
talkingnoodle's Avatar
Join Date: Nov 2005
Location: Leominster, MA
Posts: 229
talkingnoodle is on a distinguished road
Send a message via AIM to talkingnoodle Send a message via MSN to talkingnoodle
getplayer

with(getplayer(params[1])) ..ive tried that and it doesnt work on gs2...is there another way instead of getplayer() now in GS2?
Reply With Quote
  #2  
Old 11-27-2005, 07:52 PM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
findplayer
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #3  
Old 11-27-2005, 07:58 PM
talkingnoodle talkingnoodle is offline
Rapidwolve
talkingnoodle's Avatar
Join Date: Nov 2005
Location: Leominster, MA
Posts: 229
talkingnoodle is on a distinguished road
Send a message via AIM to talkingnoodle Send a message via MSN to talkingnoodle
with(findPlayer(params[1])){

//

}

would work?
Reply With Quote
  #4  
Old 11-27-2005, 08:05 PM
talkingnoodle talkingnoodle is offline
Rapidwolve
talkingnoodle's Avatar
Join Date: Nov 2005
Location: Leominster, MA
Posts: 229
talkingnoodle is on a distinguished road
Send a message via AIM to talkingnoodle Send a message via MSN to talkingnoodle
its not working :'(
Reply With Quote
  #5  
Old 11-27-2005, 08:16 PM
Damix2 Damix2 is offline
RED SQUARE CLUB
Join Date: Nov 2003
Location: NY-what's better?
Posts: 3,577
Damix2 will become famous soon enough
Don't need to use with?

Code taken out by Damix =D

Ok Stefan, I'm still learning too
__________________

Last edited by Damix2; 11-28-2005 at 12:28 AM..
Reply With Quote
  #6  
Old 11-27-2005, 08:39 PM
talkingnoodle talkingnoodle is offline
Rapidwolve
talkingnoodle's Avatar
Join Date: Nov 2005
Location: Leominster, MA
Posts: 229
talkingnoodle is on a distinguished road
Send a message via AIM to talkingnoodle Send a message via MSN to talkingnoodle
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);
Reply With Quote
  #7  
Old 11-27-2005, 09:06 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
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 ++?
__________________
Skyld
Reply With Quote
  #8  
Old 11-27-2005, 09:39 PM
Fry Fry is offline
Registered User
Fry's Avatar
Join Date: Sep 2001
Location: Germany
Posts: 384
Fry has a spectacular aura about
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.
__________________
Graal Statistics

Top 3 servers at the moment (players):


Reply With Quote
  #9  
Old 11-28-2005, 12:16 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
findplayer/getplayer are quite fast though May be some mod should delete/edit the posts which contain all that bad code x-x
Reply With Quote
  #10  
Old 11-28-2005, 12:47 AM
CheeToS2 CheeToS2 is offline
That Guy
CheeToS2's Avatar
Join Date: Dec 2001
Location: Seattle, WA
Posts: 2,528
CheeToS2 will become famous soon enough
Send a message via AIM to CheeToS2
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
__________________

Reply With Quote
  #11  
Old 12-09-2005, 08:28 AM
jake13jake jake13jake is offline
Former Classic Staff
jake13jake's Avatar
Join Date: Dec 2002
Location: Northwest Vermont
Posts: 1,452
jake13jake will become famous soon enough
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;
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 08:51 PM.


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