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 02-03-2013, 03:49 AM
Jiroxys7 Jiroxys7 is offline
Hazard to Graal
Jiroxys7's Avatar
Join Date: Apr 2009
Posts: 343
Jiroxys7 will become famous soon enough
Retrieving another player's variables within a clientside loop..

So I'm working on a script where I need to get an attacking player's stats. The problem is, it doesn't seem like I have a choice but to figure out some way to get this information from within a clientside for loop. Is there any way to get this information? doing a triggerserver() with a return <data>; on the other end doesn't seem to be possible. And while findplayer(acct) works, only player.vars are accessible.

Are there any workarounds? or is this some kind of hopeless endeavor?
__________________
MY POSTS ARE PRONE TO EDITS!
Reply With Quote
  #2  
Old 02-03-2013, 04:00 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
You can't access arbitrary variables (e.g. clientr) of another player on clientside. That would require an enormous amount of data to be constantly synced to every player on the server (or at least in the same level).

Without knowing what your end goal is (would it make sense to do this stuff serverside?), you can always store the data you need in players' "attr" arrays. Those are accessible by other players in the same level (globally if you configure it in server options), although there are restrictions on the amount and format of data you can store.

If you want to ask the server explicitly for the data, you can use triggerServer, but instead of using "return" to send back data, you use triggerClient. There are some examples [here](http://forums.graalonline.com/forums...17&postcount=4).
__________________
Reply With Quote
  #3  
Old 02-03-2013, 04:15 AM
Jiroxys7 Jiroxys7 is offline
Hazard to Graal
Jiroxys7's Avatar
Join Date: Apr 2009
Posts: 343
Jiroxys7 will become famous soon enough
Quote:
Originally Posted by cbk1994 View Post
You can't access arbitrary variables (e.g. clientr) of another player on clientside. That would require an enormous amount of data to be constantly synced to every player on the server (or at least in the same level).

Without knowing what your end goal is (would it make sense to do this stuff serverside?), you can always store the data you need in players' "attr" arrays. Those are accessible by other players in the same level (globally if you configure it in server options), although there are restrictions on the amount and format of data you can store.

If you want to ask the server explicitly for the data, you can use triggerServer, but instead of using "return" to send back data, you use triggerClient. There are some examples [here](http://forums.graalonline.com/forums...17&postcount=4).
Well I'm working on Zodiac's server, and this particular script plays a pretty major role. I can't exactly go changing everything up without everything breaking. I usually do the triggerserver -> triggerclient thing for stuff like this, but considering this is in a loop, which is triggered by another player's attack, means that I need to have some way to get this variable without leaving the loop. Unless there's a way to stop the loop where it is, access that information, and then resume the loop, the effect would only kick in after the next player attacks.

Quote:
Originally Posted by cbk1994 View Post
That would require an enormous amount of data to be constantly synced to every player on the server (or at least in the same level).
I mean like something that's accessed only when it's called for. e.g. temp.thing = findplayer("Dude").client.stuff; would basically do it's own triggerserver to determine the variable, then go back to the client again to set temp.thing. wouldn't that be feasible? I recall something like that being possible in one of the C languages.
__________________
MY POSTS ARE PRONE TO EDITS!
Reply With Quote
  #4  
Old 02-03-2013, 05:41 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Sounds like the attr solution would work fine for you.

Quote:
Originally Posted by Jiroxys7 View Post
but considering this is in a loop, which is triggered by another player's attack
Why not just send the data whenever you're letting the player know they've been attacked?

Quote:
I mean like something that's accessed only when it's called for. e.g. temp.thing = findplayer("Dude").client.stuff; would basically do it's own triggerserver to determine the variable, then go back to the client again to set temp.thing. wouldn't that be feasible? I recall something like that being possible in one of the C languages.
You could rig something up but it would probably be impractical due to high latency.
__________________
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 11:23 PM.


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