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 12-07-2006, 07:20 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
clientr strings?

Let's see, I've had a quite annoying problem, sometimes I can't read clientr. strings serverside, some cleintr strings are readable, and some are not.
Here's some examples of my problem:

PHP Code:
function onCreated()
  echo( 
findplayer"Chompy").clientr.mud_maxhp); 
returns 5 (clientr.mud_maxhp is setted to 5 in player attributes)

PHP Code:
function onCreated()
  echo( 
player.clientr.mud_maxhp); 
or
PHP Code:
function onCreated()
  echo( 
clientr.mud_maxhp); 
Returns nothing...
the clientr string is setted serverside in a class..


Well, any thoughts?
__________________
Reply With Quote
  #2  
Old 12-07-2006, 08:05 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
The *.mud* strings are protected, they are reserved for GK. Better use md_ for example.
__________________
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
  #3  
Old 12-07-2006, 08:35 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 contiga View Post
The *.mud* strings are protected, they are reserved for GK. Better use md_ for example.
Hmm, weird. I can recieve them by using findplayer(), but I'll try rename the strings
__________________
Reply With Quote
  #4  
Old 12-08-2006, 03:18 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Quote:
Originally Posted by Chompy View Post
PHP Code:
function onCreated()
  echo( 
player.clientr.mud_maxhp); 
or
PHP Code:
function onCreated()
  echo( 
clientr.mud_maxhp); 
Is it safe to assume you did these clientside?

I've come to use
PHP Code:
function onCreated()
{
  
temp.findplayer("Twinny");
  
temp.e.clientr.hp temp.e.clientr.maxhp;
  echo(
temp.e.clientr.mudregion);

Reply With Quote
  #5  
Old 12-08-2006, 03:54 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 Twinny View Post
Is it safe to assume you did these clientside?

I've come to use
PHP Code:
function onCreated()
{
  
temp.findplayer("Twinny");
  
temp.e.clientr.hp temp.e.clientr.maxhp;
  echo(
temp.e.clientr.mudregion);

I did use them serverside, they were fine readable clientside,
but I changed the start of the string (it was .mud_), and now it works quite fine..
dunno why.. might be with what contiga said
__________________
Reply With Quote
  #6  
Old 12-08-2006, 06:34 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 Chompy View Post
I did use them serverside, they were fine readable clientside,
but I changed the start of the string (it was .mud_), and now it works quite fine..
dunno why.. might be with what contiga said
It indeed is what I said
__________________
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
  #7  
Old 12-08-2006, 06: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 contiga View Post
It indeed is what I said
Thanks
__________________
Reply With Quote
  #8  
Old 12-08-2006, 11:27 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
I don't think mud_ strings are sent to the client.
Reply With Quote
  #9  
Old 12-09-2006, 02:45 AM
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
clientr.mud_ strings are just not saved and not accepted by the npcserver (you cannot set them with RC as far as I know), but they should work fine.

I guess the problem of the original poster lies in the placement of the code, it would be interesting to know in what class/object that onCreated() function is put. When it is an npc, then it is normal that there is no player. object. If the player has joined a class and onCreated() is placed in that class, then it is better to use "this.clientr...". The code in the original post should still work in that case though, it might not be called at all though if the player already joined some other class before and is so not "created" a second time (onCreated() is only called when the script object is initialized).
Reply With Quote
  #10  
Old 12-09-2006, 04:24 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 Stefan View Post
clientr.mud_ strings are just not saved and not accepted by the npcserver (you cannot set them with RC as far as I know), but they should work fine.

I guess the problem of the original poster lies in the placement of the code, it would be interesting to know in what class/object that onCreated() function is put. When it is an npc, then it is normal that there is no player. object. If the player has joined a class and onCreated() is placed in that class, then it is better to use "this.clientr...". The code in the original post should still work in that case though, it might not be called at all though if the player already joined some other class before and is so not "created" a second time (onCreated() is only called when the script object is initialized).
Hmm, I setted the strings inside a class, serverside (player.join())

example of how I did it:

+Initialize
PHP Code:

player
.join"initialize");

function 
onActionServerside() {
  switch( 
params0]) {
    case 
"init":
      
player.mud_initialize();
    break;
  }
}

//#CLIENTSIDE
function onCreated() {
  
onPlayerEnters();
}

function 
onPlayerEnters() {
  if ( !( 
clientr.mud_player_joined)) {
    
triggerserver"gui""+Initialize""init");
  }

class: initialize
PHP Code:

public function mud_initialize() {
  
// setting of strings here
  
clientr.mud_player_joined true;

When player logs on, and clientr.mud_player_joined is false,
it triggers and do a player join on serverside, inside the class
the strings are setted.. Is this method correct, or should I use an other way?
__________________

Last edited by Chompy; 12-09-2006 at 04:43 PM..
Reply With Quote
  #11  
Old 12-09-2006, 05:16 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
Better let the player join the class directly at login, in the control-npc in onActionPlayerOnline() or by using the event onPlayerLogin(playerobject) in any other script. In your example it would call the thing several times and would still not guarantee that its working. Also use this.clientr.flagname in the initialize class instead of clientr.flagname.
Reply With Quote
  #12  
Old 12-09-2006, 06:55 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 Stefan View Post
Better let the player join the class directly at login, in the control-npc in onActionPlayerOnline() or by using the event onPlayerLogin(playerobject) in any other script. In your example it would call the thing several times and would still not guarantee that its working. Also use this.clientr.flagname in the initialize class instead of clientr.flagname.
In the originally script, it has an echo in the class, and
it always echo up to 2-3 times, so.. I'll set it with
this.client.flagname when setting it, and join on logon. I'll try that :]

Btw, onPlayerLogin() works in every wnpcs (serverside) ?
And onActionPlayerLogin() would work in al dnpcs?
__________________
Reply With Quote
  #13  
Old 12-09-2006, 07:10 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
onActionPlayerOnline(): for the Control-NPC only
onPlayerLogin(playerobject): for all server-side npcs (including weapon-npcs), do playerobject.join() etc. instead of player.join()
Reply With Quote
  #14  
Old 12-09-2006, 08:40 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 Stefan View Post
onActionPlayerOnline(): for the Control-NPC only
onPlayerLogin(playerobject): for all server-side npcs (including weapon-npcs), do playerobject.join() etc. instead of player.join()
Thanks

btw, do onActionPlayerOnline() return any objects/params?
__________________
Reply With Quote
  #15  
Old 12-10-2006, 02:18 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
I don't think, it's just an parameter-less event like onPlayerChats and similar
Reply With Quote
  #16  
Old 12-10-2006, 02:50 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 Stefan View Post
I don't think, it's just an parameter-less event like onPlayerChats and similar
Hmm ok :] Thanks
Now I just need to figure out something else (related to loadvars and such)
__________________
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:37 PM.


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