Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   What is the difference? (https://forums.graalonline.com/forums/showthread.php?t=134263354)

callimuc 05-26-2011 06:55 PM

What is the difference?
 
Hey there.

While I where making scripts (so when I´m gold again I can upload them) I realized something and wanted to ask it.

What is the difference between
PHP Code:

function onCreated() {
this.bla = ...;
thiso.bla = ...;
temp.bla = ...;


and all that :confused:

Like I said on top I´m currently Trial again so I can´t test stuff. Maybe someone can explain me the differences :)

Skyld 05-26-2011 06:57 PM

Take a look at http://gscript.graal.net/CategoryVariablePrefix, it contains some explanations and examples of usage.

0PiX0 05-26-2011 07:10 PM

Quote:

Originally Posted by callimuc (Post 1651599)
PHP Code:

function onCreated() {
this.bla = ...;
thiso.bla = ...;
temp.bla = ...;



this. prefix points to the current object.
PHP Code:

with (object) {
  
this.somevar 2;
}
echo(
object.somevar); 

thiso. prefix points to the object that is running the script.
PHP Code:

thiso.someothervar 4;
with (object) {
  
this.somevar thiso.someothervar;
}
echo(
object.somevar); 

temp. prefixed vars will be destroyed once the function that contains them has run.

callimuc 05-26-2011 07:16 PM

thanks :) saw that in the link


All times are GMT +2. The time now is 01:24 AM.

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