Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Client.strings + GuiTextCtrl (https://forums.graalonline.com/forums/showthread.php?t=66729)

Omini 06-17-2006 09:26 PM

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?

Skyld 06-17-2006 09:40 PM

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.

ApothiX 06-17-2006 09:54 PM

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");



Omini 06-18-2006 04:45 AM

Ooh, thanks very much.

contiga 06-18-2006 05:50 PM

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];



ApothiX 06-18-2006 09:52 PM

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.

contiga 06-19-2006 08:49 AM

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.

ApothiX 06-19-2006 08:00 PM

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.

Yen 06-19-2006 09:40 PM

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. :)

Omini 06-21-2006 12:18 PM

Uh, you do realize what Okie said works fine with little to no lag?...

ApothiX 06-21-2006 02:00 PM

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.

contiga 06-21-2006 02:54 PM

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..

ApothiX 06-21-2006 04:36 PM

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* ?

ZeLpH_MyStiK 06-21-2006 06:32 PM

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.

xXziroXx 06-21-2006 06:40 PM

0.1 is minimum on serverside.

contiga 06-21-2006 07:35 PM

Quote:

Originally Posted by xXziroXx
0.1 is minimum on serverside.

I'm not talking about setting the attr's serverside, fool.. I'm talking about clientside..

ApothiX 06-21-2006 08:47 PM

What contiga said. It would still cause lag because the attr[] flags need to be sent to everyone when they are updated. If you're doing it in a 0.05 timeout, Lookout Jesus.

Omini 06-22-2006 12:08 PM

Quote:

Originally Posted by contiga
I'm not saying I'm doing it =P It was just a guess lol..

Didn't I read somewhere that if you didn't know what you were talking about, you were not meant to say anything?

ApothiX 06-22-2006 07:10 PM

Quote:

Originally Posted by Omini
Didn't I read somewhere that if you didn't know what you were talking about, you were not meant to say anything?

The rules perhaps?

contiga 06-22-2006 07:31 PM

Lmao ^^


All times are GMT +2. The time now is 07:00 AM.

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