Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   join() & public function (https://forums.graalonline.com/forums/showthread.php?t=66366)

xXziroXx 05-31-2006 09:23 PM

join() & public function
 
Cant say im a bad scripter, yet several threads in this "scripting help" forum has been created by me lately..


Anyways, Ive been trying to get a public function to work - without success.


Example on class (named "className" in this test):

PHP Code:

public function funcName()
{
  
player.chat "foo";



Example on Control-NPC:

PHP Code:

function onCreated()
{
  
player.join"className");



Example on Weapon:

PHP Code:

function onPlayerEnters()
{
  
player.funcName();




If you can tell me what im doing wrong/tell me how to do it properly - I would greatly appriciate it.

Skyld 05-31-2006 09:25 PM

Inside player.join'd classes, it is best to refer to the player using this., so:
PHP Code:

this.chat "foo"

Also, I might be mistaken but I think that player. joining only works serverside, and so the function call also has to be serverside.

ApothiX 06-01-2006 01:32 AM

Quote:

Originally Posted by Skyld
Inside player.join'd classes, it is best to refer to the player using this., so:
PHP Code:

this.chat "foo"


using player.chat would not break the script, though. If you know this. is always going to be a player, I don't know why you'd want to use this. instead of player. (player. is easier to read, because you know what you are modifying)

Quote:

Originally Posted by Skyld
Also, I might be mistaken but I think that player. joining only works serverside, and so the function call also has to be serverside.

Indeed


All times are GMT +2. The time now is 12:04 PM.

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