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 05-31-2006, 09:23 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
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
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.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #2  
Old 05-31-2006, 09:25 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
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.
__________________
Skyld
Reply With Quote
  #3  
Old 06-01-2006, 01:32 AM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
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
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
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 06:11 PM.


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