Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   player.attr serverside (https://forums.graalonline.com/forums/showthread.php?t=71826)

Chompy 01-31-2007 12:36 AM

player.attr serverside
 
quick question, is player.attr's readable serverside?

ToNy_W 01-31-2007 12:42 AM

just tested it and it worked :P

Chompy 01-31-2007 12:45 AM

hmm,

PHP Code:

function onActionServerisdeacct)
{
  
plyr findplayer( @ temp.acct);
  
withplyr)
    
temp.array = { player.attr1], player.attr2]};


this doesn't seem to work for me..
reading an others player.attr's

Skyld 01-31-2007 12:48 AM

Quote:

Originally Posted by Chompy (Post 1271508)
hmm,

PHP Code:

function onActionServerisdeacct)
{
  
plyr findplayer( @ temp.acct);
  
withplyr)
    
temp.array = { player.attr1], player.attr2]};


this doesn't seem to work for me..
reading an others player.attr's

Can I suggest:
PHP Code:

function onActionserverside(temp.acct)
{
  
temp.plyr findPlayer(temp.acct);
  
temp.array = {temp.plyr.attr[1], temp.plyr.attr[2]};


Also what's with this awful style of putting spaces at the beginning of function parameters and such? :/

Chompy 01-31-2007 12:52 AM

Quote:

Originally Posted by Skyld (Post 1271512)
Can I suggest:
PHP Code:

function onActionserverside(temp.acct)
{
  
temp.plyr findPlayer(temp.acct);
  
temp.array = {temp.plyr.attr[1], temp.plyr.attr[2]};


Also what's with this awful style of putting spaces at the beginning of function parameters and such? :/

I'll try that method,

and my styling, I like the spacing, gives more readability when having alot of parametres, well thats what I think :o

xXziroXx 01-31-2007 05:03 AM

Ugh, we have another Contiga styler..

Chandler 01-31-2007 09:52 AM

Quote:

Originally Posted by Chompy (Post 1271508)
hmm,

PHP Code:

function onActionServerisde(curAcct)
{
  
temp.curPlyr findplayer(temp.curAcct);
  
temp.array = {temp.curPlyr.attr[1], temp.curPlyr.attr[2]};


this doesn't seem to work for me..
reading an others player.attr's

You was reading your own attributes... you found the player, but you decided to also find your own attributes...

Skyld 01-31-2007 10:14 AM

Quote:

Originally Posted by Chandler (Post 1271641)
You was reading your own attributes... you found the player, but you decided to also find your own attributes...

That makes no sense?

Chandler 01-31-2007 10:48 AM

Quote:

Originally Posted by Skyld (Post 1271651)
That makes no sense?

It made sense to me! :>
Ah wait, I forgot that ''with'' doesn't need to be addressed again with the temp.curAccount, as you've already found the player.

HTML Code:

temp.curAccount = findPlayer("cHANDLER");
with(temp.curAccount)
{
  temp.array = {player.attr[1], player.attr[2]};
}


Chompy 01-31-2007 03:42 PM

Quote:

Originally Posted by Chandler (Post 1271654)
It made sense to me! :>
Ah wait, I forgot that ''with'' doesn't need to be addressed again with the temp.curAccount, as you've already found the player.

HTML Code:

temp.curAccount = findPlayer("cHANDLER");
with(temp.curAccount)
{
  temp.array = {player.attr[1], player.attr[2]};
}


:]

Well, I got it to work, thanks to Skyld :D

Now this is my other question, why can you read an other players 'player.' vars, but not strings like 'clientr.' (This is what I experienced)

contiga 01-31-2007 04:41 PM

Quote:

Originally Posted by xXziroXx (Post 1271590)
Ugh, we have another Contiga styler..

I don't style like;
PHP Code:

function onCreated() 
{
  
//stuff


I do;
PHP Code:

function onCreated() {
  
//stuff


:D

JkWhoSaysNi 01-31-2007 05:04 PM

Ditto! I can't stand the extra line just for the {

though one thing that does irk me is seeing

PHP Code:

...
} else {
... 


xXziroXx 01-31-2007 05:23 PM

I always does a new line for brackets BUT only on a new function, NEVER in other places in the script.

Chompy 01-31-2007 06:06 PM

I do it because (the line break for bracet) so that if the script is like, huge,
I can hover my mouse over the bracet and scroll the mouse down to see where it ends :]

Quote:

Originally Posted by contiga (Post 1271687)
I don't style like;
PHP Code:

function onCreated() 
{
  
//stuff


I do;
PHP Code:

function onCreated() {
  
//stuff


:D

:D

Admins 01-31-2007 08:36 PM

Quote:

Originally Posted by Chompy (Post 1271680)
Now this is my other question, why can you read an other players 'player.' vars, but not strings like 'clientr.'

You can - otherplayer.clientr.var

Andy0687 01-31-2007 08:55 PM

Quote:

Originally Posted by contiga (Post 1271687)
.

he means the weird spacing

zokemon 01-31-2007 09:15 PM

Did you try player.clientr.foo while in another player?

Chompy 01-31-2007 09:36 PM

Quote:

Originally Posted by zokemon (Post 1271746)
Did you try player.clientr.foo while in another player?

yup, it readed stuff like player.headimg perfectly, but when I did player.clientr.foo etc.., it didn't work

Edit:

Well, I can't get this to work

PHP Code:

array.clear();
withfindplayertemp.acct))
  array = { 
player.clientr.mud.stats2.strengthplayer.clientr.mud.stats2.dexterityplayer.clientr.mud.stats2.intelligenceplayer.clientr.mud.stats2.luckplayer.clientr.mud.stats.maxhpplayer.clientr.mud.stats.curhpplayer.clientr.mud.stats.maxmpplayer.clientr.mud.stats.curmpplayer.clientr.mud.stats.levelplayer.clientr.mud.class_nameplayer.clientr.mud.race_nameplayer.clientr.mud.weapon, { player.headimgplayer.bodyimgplayer.colors0], player.colors1], player.colors2], player.colors3], player.colors4], player.shieldimgplayer.attr2]}}; 

should I not use the player.*?

PHP Code:

plyr findplayertemp.acct);
array = { 
plyr.clientr.*}; 

didn't work :[

Chompy 01-31-2007 10:27 PM

sorry for double post, but

doing this clientside;
PHP Code:

echo( findplayertemp.acct).clientr.mud.stats.curhp); 

output nothing, but
PHP Code:

echo( findplayertemp.acct).headimg); 

works...

Anyone know how to fix this, because I don't want to go serverside..



Also, (this is clientside)
PHP Code:

  plyr findplayertemp.acct);
  echo( 
plyr.account

works perfectly, but (also clientside)
PHP Code:

  plyr findplayertemp.acct);
  echo( 
plyr.clientr.mud.stats.maxhp); 

doesn't work..

I am beginning to think that you can just read a other players 'player.*' vars, and vars like clientr,
but, findplayer recieves the 'player.*' object, so maybe thats why it only can do player.' vars..

arrh, confusing, anyone know how to get this to work? (reading a player clientr strings clientside (an other player))

xXziroXx 02-01-2007 06:38 AM

You can NOT read player strings clientsided, only his attributes.

Chandler 02-01-2007 12:07 PM

HTML Code:

temp.mudStats = {
  {"clientr.mud.stats2", {"strength", "dexterity", "intelligence", "luck"}},
  {"clientr.mud.stats", {"maxhp", "curhp", "maxmp", "curmp"}},
  {"player", {"headimg", "bodyimg", "shieldimg", "colors[0]", "colors[1]"}}
};
temp.curPlayer = findPlayer(temp.curAcc);
for (temp.curData: temp.mudStats)
{
  for (temp.curVar: temp.curData[1])
  {
    makevar("temp.curPlayer." @ temp.curData[0]) = makevar("temp.curPlayer." @ temp.curData[0] @ "." @ temp.curVar);
  }
}

Should work... havn't tested though I'm afraid!


All times are GMT +2. The time now is 10:09 PM.

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