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 04-04-2007, 08:24 AM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Clientside Classes

Having a bit of a problem. I'm having problems joining a class to a player when the log online.
Here's what I have so far, it just doesn't seem to interact with the player, at all.

HTML Code:
//#CLIENTSIDE 
function onCreated()
  {
  player.join("player_weapon");
  player.doAction({"drawMaps", "defaultStats"});
  }
Inside the "player_weapon"

HTML Code:
//#CLIENTSIDE   
function onCreated()
  echo("GOT THE MAIN CONTROL!");
  
public function doAction(actionNames)
  for (temp.currentAction: temp.actionNames)
    this.(@ temp.currentAction)();
Neither are being called... suggestions? thanks!
Reply With Quote
  #2  
Old 04-04-2007, 08:27 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
You can't, shouldn't, join classes on the Clientside, it needs to be done Serverside.

And if its done Serverside, I think the Clientside and Serverside player objects are not the same so It would only effect the serverside player.
__________________
Reply With Quote
  #3  
Old 04-04-2007, 08:31 AM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Quote:
Originally Posted by Inverness View Post
You can't, shouldn't, join classes on the Clientside, it needs to be done Serverside.

And if its done Serverside, I think the Clientside and Serverside player objects are not the same so It would only effect the serverside player.
That's what I thought!
So there isn't a way to use "player." clientside?
Reply With Quote
  #4  
Old 04-04-2007, 08:34 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Not that I know of
Set up global references on the clientside that lead to the object with the function.
__________________
Reply With Quote
  #5  
Old 04-04-2007, 08:41 AM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Thanks, I'll see what I can do!
Reply With Quote
  #6  
Old 04-04-2007, 05:16 PM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
You can always use attr's to access the information clientside and then send it over serverside when you're done to save or so.
Reply With Quote
  #7  
Old 04-04-2007, 05:33 PM
Kristi Kristi is offline
Bowie's Deciple
Kristi's Avatar
Join Date: Dec 2003
Location: Boston, MA
Posts: 748
Kristi has a spectacular aura aboutKristi has a spectacular aura about
Send a message via AIM to Kristi Send a message via MSN to Kristi
Quote:
Originally Posted by Chandler View Post
Having a bit of a problem. I'm having problems joining a class to a player when the log online.
Here's what I have so far, it just doesn't seem to interact with the player, at all.

HTML Code:
//#CLIENTSIDE 
function onCreated()
  {
  player.join("player_weapon");
  player.doAction({"drawMaps", "defaultStats"});
  }
Inside the "player_weapon"

HTML Code:
//#CLIENTSIDE   
function onCreated()
  echo("GOT THE MAIN CONTROL!");
  
public function doAction(actionNames)
  for (temp.currentAction: temp.actionNames)
    this.(@ temp.currentAction)();
Neither are being called... suggestions? thanks!
well, for the onCreated in the class, essentially you are creating player.onCreated(), so that just isnt going to be called.

as for the doAction, you are calling player.drawMaps() and player.defaultStats(), since you are joining the class to the player, the player now becomes the object, so "this" will refer to the player. Since the player does not have those functions, they are not being called. In this case, it shouldn't have been joined to the player in the first place.

Joining a class to a player clientside sure does work
__________________
Reply With Quote
  #8  
Old 04-04-2007, 07:03 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Quote:
Originally Posted by Kristi View Post
well, for the onCreated in the class, essentially you are creating player.onCreated(), so that just isnt going to be called.

as for the doAction, you are calling player.drawMaps() and player.defaultStats(), since you are joining the class to the player, the player now becomes the object, so "this" will refer to the player. Since the player does not have those functions, they are not being called. In this case, it shouldn't have been joined to the player in the first place.

Joining a class to a player clientside sure does work
I don't quite understand, could you show an example? thanks!!
Reply With Quote
  #9  
Old 04-04-2007, 07:13 PM
Kristi Kristi is offline
Bowie's Deciple
Kristi's Avatar
Join Date: Dec 2003
Location: Boston, MA
Posts: 748
Kristi has a spectacular aura aboutKristi has a spectacular aura about
Send a message via AIM to Kristi Send a message via MSN to Kristi
Quote:
Originally Posted by Chandler View Post
I don't quite understand, could you show an example? thanks!!
class: coolness
PHP Code:
//#CLIENTSIDE
public function pointlessChat() {
  
this.chat "takeover!";

someweapon
PHP Code:
//#CLIENTSIDE
function onCreated() {
  
player.join("coolness");
}

function 
onPlayerChats() {
  
// Take over chat... pointlessly
  
player.pointlessChat();

With this weapon on your person, if you talk, your chat will change to takeover!
__________________
Reply With Quote
  #10  
Old 04-04-2007, 07:24 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
...
Why would joining classes even work clientside, isn't that a security issue?
__________________

Last edited by Kristi; 04-04-2007 at 07:52 PM..
Reply With Quote
  #11  
Old 04-04-2007, 07:33 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by Inverness View Post
...
Why would joining classes even work clientside, isn't that a security issue?
What?O.o
Reply With Quote
  #12  
Old 04-04-2007, 07:34 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Quote:
Originally Posted by Crow View Post
What?O.o
With all those fancy hacks people come up with for Graal. And I don't really know how secure the client is. I'm just being paranoid.
__________________
Reply With Quote
  #13  
Old 04-04-2007, 07:42 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by Inverness View Post
With all those fancy hacks people come up with for Graal. And I don't really know how secure the client is. I'm just being paranoid.
You cant really edit classes ;o
And Graal is...well...not secure
Reply With Quote
  #14  
Old 04-04-2007, 07:53 PM
Kristi Kristi is offline
Bowie's Deciple
Kristi's Avatar
Join Date: Dec 2003
Location: Boston, MA
Posts: 748
Kristi has a spectacular aura aboutKristi has a spectacular aura about
Send a message via AIM to Kristi Send a message via MSN to Kristi
Quote:
Originally Posted by Inverness View Post
...
Why would joining classes even work clientside, isn't that a security issue?
Well, its not joining the serverside, so... anything that can be joined by a therodical hack could have just been hacked there in the first place.
__________________
Reply With Quote
  #15  
Old 04-04-2007, 10:48 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
Joining classes works on clientside, but with 4.20 the onCreated() thing is not necessary called when the script has not been loaded yet. In the next Graal version clientside classes work much better (I'm using it for customized gui controls and such stuff).
About security: client-side objects can join any class that have a clientside script. It shouldn't really be a problem because (1) you need to be able to write the script that calls "join", so you basicly need RC already, (2) in that case you could also easily call join on serverside, so you don't win anything, and (3) even if someone hacks the client and manages to join another class, he/she can only use scripts which are meant for clientside stuff anyway, (4) it might be possible to add a server option to restrict client-side joining to certain classes, although I don't see a case where that could be necessary
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:02 PM.


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