Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-31-2007, 12:36 AM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
player.attr serverside

quick question, is player.attr's readable serverside?
__________________
Reply With Quote
  #2  
Old 01-31-2007, 12:42 AM
ToNy_W ToNy_W is offline
Registered User
Join Date: Aug 2003
Location: Quebec
Posts: 130
ToNy_W is on a distinguished road
Send a message via AIM to ToNy_W
just tested it and it worked :P
Reply With Quote
  #3  
Old 01-31-2007, 12:45 AM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
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
__________________
Reply With Quote
  #4  
Old 01-31-2007, 12:48 AM
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 Chompy View Post
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? :/
__________________
Skyld
Reply With Quote
  #5  
Old 01-31-2007, 12:52 AM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Skyld View Post
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
__________________
Reply With Quote
  #6  
Old 01-31-2007, 05:03 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Ugh, we have another Contiga styler..
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #7  
Old 01-31-2007, 09:52 AM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Quote:
Originally Posted by Chompy View Post
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...
Reply With Quote
  #8  
Old 01-31-2007, 10:14 AM
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 Chandler View Post
You was reading your own attributes... you found the player, but you decided to also find your own attributes...
That makes no sense?
__________________
Skyld
Reply With Quote
  #9  
Old 01-31-2007, 10:48 AM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Quote:
Originally Posted by Skyld View Post
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]};
}
Reply With Quote
  #10  
Old 01-31-2007, 03:42 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Chandler View Post
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

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)
__________________

Last edited by Chompy; 01-31-2007 at 04:08 PM..
Reply With Quote
  #11  
Old 01-31-2007, 04:41 PM
contiga contiga is offline
Graal2001 Administration
contiga's Avatar
Join Date: Jul 2004
Location: Netherlands
Posts: 419
contiga is an unknown quantity at this point
Send a message via ICQ to contiga Send a message via AIM to contiga Send a message via MSN to contiga Send a message via Yahoo to contiga
Quote:
Originally Posted by xXziroXx View Post
Ugh, we have another Contiga styler..
I don't style like;
PHP Code:
function onCreated() 
{
  
//stuff

I do;
PHP Code:
function onCreated() {
  
//stuff

__________________
AIM: Contiga122
MSN: [email protected]
Status:
Quote:
Originally Posted by unixmad View Post
I am also awake 3AM to help correct problems.
Quote:
Originally Posted by Bomy Island RC people
Daniel: HoudiniMan is a bad guy =p
*Bell: rofl. I first read that as houdini is a bad man. like the little kid that wants his mommy to keep her away from that boogie man
Daniel: xD
*Rufus: I wouldn't want my kids around him.
Reply With Quote
  #12  
Old 01-31-2007, 05:04 PM
JkWhoSaysNi JkWhoSaysNi is offline
Ruler of the graalaxy
Join Date: Feb 2005
Location: Great Britain
Posts: 488
JkWhoSaysNi is on a distinguished road
Send a message via ICQ to JkWhoSaysNi
Ditto! I can't stand the extra line just for the {

though one thing that does irk me is seeing

PHP Code:
...
} else {
... 
__________________

Coming soon (Hopefully:P)
Reply With Quote
  #13  
Old 01-31-2007, 05:23 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
I always does a new line for brackets BUT only on a new function, NEVER in other places in the script.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #14  
Old 01-31-2007, 06:06 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
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 View Post
I don't style like;
PHP Code:
function onCreated() 
{
  
//stuff

I do;
PHP Code:
function onCreated() {
  
//stuff

__________________
Reply With Quote
  #15  
Old 01-31-2007, 08:36 PM
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
Quote:
Originally Posted by Chompy View Post
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
Reply With Quote
  #16  
Old 01-31-2007, 08:55 PM
Andy0687 Andy0687 is offline
Enigma
Join Date: Feb 2002
Posts: 1,072
Andy0687 is on a distinguished road
Quote:
Originally Posted by contiga View Post
.
he means the weird spacing
__________________
Reply With Quote
  #17  
Old 01-31-2007, 09:15 PM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Did you try player.clientr.foo while in another player?
__________________
Do it with a DON!
Reply With Quote
  #18  
Old 01-31-2007, 09:36 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by zokemon View Post
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 :[
__________________

Last edited by Chompy; 01-31-2007 at 10:11 PM..
Reply With Quote
  #19  
Old 01-31-2007, 10:27 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
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))
__________________
Reply With Quote
  #20  
Old 02-01-2007, 06:38 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
You can NOT read player strings clientsided, only his attributes.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #21  
Old 02-01-2007, 12:07 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
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!

Last edited by Chandler; 02-01-2007 at 08:12 PM..
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 10:11 PM.


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