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 06-17-2006, 09:26 PM
Omini Omini is offline
Millenium Owner
Join Date: Feb 2006
Location: N.Ireland
Posts: 293
Omini is on a distinguished road
Send a message via AIM to Omini Send a message via MSN to Omini Send a message via Yahoo to Omini
Client.strings + GuiTextCtrl

How would I go about displaying a persons client(r) strings in a GUI?

Would it be something like

PHP Code:
function onActionserverside()
  {
  if (
params[0] == "findinfo") {
      
with (findplayer(params[1])) {
      
thiso.stat1 client.stat1;
      
thiso.stat2 client.stat2;
      
thiso.stat3 clientr.stat3;
      
NewGuiWindow();
    }
  }
}
//#CLIENTSIDE
function onCreated()
  {
  
NewGuiWindow();
  
triggeraction(0,0,"serverside",name,"findinfo",target);
}

function 
NewGuiWindow()
  {
  new 
GuiWindowCtrl(Window) {
    
awake true;
    
canmaximize false;
    
canresize false;
    
height 180;
    
profile "GuiRedTransWindowProfile";
    
text "Title";
    
visible true;
    
width 160;
    
0;
    
120;

    new 
GuiTextCtrl(Text) {
      
10;
      
25;
      
width 140;
      
height 20;
      
useownprofile true;
      
profile.fontcolor = {1,1,1};
      
text thiso.stat1;
    }
  }


If not, how would I be able to do it?
__________________



Reply With Quote
  #2  
Old 06-17-2006, 09:40 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
You should just be able to read them normally on the clientside if you're using your own strings at all, but for other peoples, I guess something like what you are doing is needed.
__________________
Skyld
Reply With Quote
  #3  
Old 06-17-2006, 09:54 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by Omini
How would I go about displaying a persons client(r) strings in a GUI?

Would it be something like

PHP Code:
... 

If not, how would I be able to do it?
You cannot call clientside functions from the serverside. Try something more along the lines of this:

PHP Code:
function onActionServerside() {
  if(
params[0] == "fetchinfo") {
    
with(findPlayer(params[1])) {
      
temp.statarray = { client.stat1client.stat2/* Etc */ };
    }

    
player.triggerclient("gui"this.name"retreiveinfo"temp.statarray);
  }
}

//#CLIENTSIDE
function onActionClientside() {
  if(
params[0] == "retreiveinfo") {
    
this.stat1 params[1][0];
    
this.stat2 params[1][1];
    
// etc
    
NewGuiWindow();
  }
}

function 
onCreated() {
  
triggerserver("gui"this.name"fetchinfo""KewlPlayer001");

__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #4  
Old 06-18-2006, 04:45 AM
Omini Omini is offline
Millenium Owner
Join Date: Feb 2006
Location: N.Ireland
Posts: 293
Omini is on a distinguished road
Send a message via AIM to Omini Send a message via MSN to Omini Send a message via Yahoo to Omini
Ooh, thanks very much.
__________________



Reply With Quote
  #5  
Old 06-18-2006, 05:50 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 ApothiX
You cannot call clientside functions from the serverside. Try something more along the lines of this:

PHP Code:
 bla bla a lot of **** here.. 
From you, I'd expect something 20 times better.. fool.. you are creating lag for him!

What you should do is reserve a few player.attr[ index]'s for stats, so that you can load them clientside.

Example:
--------
Every player has this in a clientside script:
PHP Code:
//#CLIENTSIDE
function statUpdate() {
  
temp.statarray = { client.stat1client.stat2};
  for ( 
0temp.statarray.size(); ++)
    
player.attr10 i] = temp.statarrayi];

The fact I did player.attr[ 10 + i] is because 1 - 5 could be reserved for custom bodies (in case you'd get those later).

A clientside script for loading:
PHP Code:
//#CLIENTSIDE
function loadStatsplr) {
  
temp.statarray2 = new[ 2];
  for ( 
02++) 
    
temp.statarray2i] = findPlayerplr).attr10 i];

__________________
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
  #6  
Old 06-18-2006, 09:52 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by contiga
From you, I'd expect something 20 times better.. fool.. you are creating lag for him!

What you should do is reserve a few player.attr[ index]'s for stats, so that you can load them clientside.

Example:
--------
Every player has this in a clientside script:
PHP Code:
//#CLIENTSIDE
function statUpdate() {
  
temp.statarray = { client.stat1client.stat2};
  for ( 
0temp.statarray.size(); ++)
    
player.attr10 i] = temp.statarrayi];

The fact I did player.attr[ 10 + i] is because 1 - 5 could be reserved for custom bodies (in case you'd get those later).

A clientside script for loading:
PHP Code:
//#CLIENTSIDE
function loadStatsplr) {
  
temp.statarray2 = new[ 2];
  for ( 
02++) 
    
temp.statarray2i] = findPlayerplr).attr10 i];

It's pointless to waste player.attr[] variables on something like this. There is little to no lag in a simple request for them. I'm pretty sure requesting player.attr[] variables from other players generates the same (if not more) lag, as they are sent to everyone all the time, instead of just being requested.

Also, don't call my script 'a lot of **** here..' until you fix your half-assed lame formatting.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #7  
Old 06-19-2006, 08:49 AM
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 ApothiX
It's pointless to waste player.attr[] variables on something like this. There is little to no lag in a simple request for them. I'm pretty sure requesting player.attr[] variables from other players generates the same (if not more) lag, as they are sent to everyone all the time, instead of just being requested.

Also, don't call my script 'a lot of **** here..' until you fix your half-assed lame formatting.
Then name me atleast 20 things YOU are going to use for player.attr[] variables, I bet you don't hit 15, so enough space for his 2 or 3 variables set as player.attr[ 10], 11 and so on.. and triggering a few times, creates more lag then loading player.attr[] variables in a 0.05 timeout.
__________________
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
  #8  
Old 06-19-2006, 08:00 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by contiga
Then name me atleast 20 things YOU are going to use for player.attr[] variables, I bet you don't hit 15, so enough space for his 2 or 3 variables set as player.attr[ 10], 11 and so on..
And how are you sure that he will only need 2 or 3 variables? IIRC, there are a lot of different stats that a character can have. player.attr[] variables are meant to be accessed with ganis, not to be used to save arbitrary information like this.

Quote:
Originally Posted by contiga
and triggering a few times, creates more lag then loading player.attr[] variables in a 0.05 timeout.
You just lost, nice try though.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #9  
Old 06-19-2006, 09:40 PM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
If the strings you want to obtain follow a pattern (i.e. clientr.stat_<whatever>), you can use getstringkeys(start).

getstringkeys() returns the suffix of all variables beginning with 'start'.
For example, if I have:
clientr.zomg_hp = 3
clientr.zomg_rawr = lawl
clientr.zomg_pi = 3.14something
temp.keys = getstringkeys("clientr.zomg_");

temp.keys will be an array containing the strings {hp,rawr,pi}

It's really useful.
Reply With Quote
  #10  
Old 06-21-2006, 12:18 PM
Omini Omini is offline
Millenium Owner
Join Date: Feb 2006
Location: N.Ireland
Posts: 293
Omini is on a distinguished road
Send a message via AIM to Omini Send a message via MSN to Omini Send a message via Yahoo to Omini
Uh, you do realize what Okie said works fine with little to no lag?...
__________________



Reply With Quote
  #11  
Old 06-21-2006, 02:00 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by Omini
Uh, you do realize what Okie said works fine with little to no lag?...
He's just being an idiot, pay no attention to him. If you're updating player.attr[] flags in a 0.05 timeout that's going to generate a lot more lag than just polling for the values once via triggeraction.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #12  
Old 06-21-2006, 02:54 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 ApothiX
He's just being an idiot, pay no attention to him. If you're updating player.attr[] flags in a 0.05 timeout that's going to generate a lot more lag than just polling for the values once via triggeraction.
I'm not saying I'm doing it =P It was just a guess lol..
__________________
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
  #13  
Old 06-21-2006, 04:36 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by contiga
I'm not saying I'm doing it =P It was just a guess lol..
Quote:
Originally Posted by contiga
From you, I'd expect something 20 times better.. fool.. you are creating lag for him!
*cough* ?
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #14  
Old 06-21-2006, 06:32 PM
ZeLpH_MyStiK ZeLpH_MyStiK is offline
Scripter
ZeLpH_MyStiK's Avatar
Join Date: May 2003
Location: NYC
Posts: 553
ZeLpH_MyStiK is on a distinguished road
Send a message via MSN to ZeLpH_MyStiK Send a message via Yahoo to ZeLpH_MyStiK
Quote:
Originally Posted by ApothiX
He's just being an idiot, pay no attention to him. If you're updating player.attr[] flags in a 0.05 timeout that's going to generate a lot more lag than just polling for the values once via triggeraction.
serverside doesn't allow .05 timeouts.
__________________
Reply With Quote
  #15  
Old 06-21-2006, 06:40 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
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
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
0.1 is minimum on serverside.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
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 02:17 AM.


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