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 03-30-2007, 11:40 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


Note how I use temp variables. It is something I began doing only recently and it makes the script look much more organized rather than using temp. repeatedly before all the temp variable names.
Um, you can't do that, when you say vars = something, you're actually assinging it to vars, not temp.vars
PHP Code:
function onCreated() {
  
temp.hello;
  
hello 2;
  
sendtorc("TEST:" temp.hello);
  
sendtorc("TEST2:" hello);

Yields the following:
The best idler is the (Server): TEST:
The best idler is the (Server): TEST2:2

note that temp.hello is still null. The only way to drop the temp is if the var was passed as a paremeter, it will take presedence over an already global var.

On another note, ziro, grey, and inver all have good styling imho
__________________
Reply With Quote
  #2  
Old 03-30-2007, 11:42 PM
Riot Riot is offline
Delteria Management
Join Date: Nov 2003
Location: Seminole County, Florida
Posts: 280
Riot is on a distinguished road
Quote:
Originally Posted by Kristi View Post
Um, you can't do that, when you say vars = something, you're actually assinging it to vars, not test vars

PHP Code:
function onCreated() {
  
temp.hello;
  
hello 2;
  
sendtorc("TEST:" temp.hello);
  
sendtorc("TEST2:" hello);

Yields the following:
The best idler is the (Server): TEST:
The best idler is the (Server): TEST2:2

note that temp.hello is still null.

On another note, ziro, grey, and inver all have good styling imho
I was about to comment on this too:
PHP Code:
function onCreated() {
  
temp.i;
  
  
34;
  echo(
"onCreated(): i =" SPC i SPC "temp.i=" SPC temp.i);
  
test();
  
  
this.setTimer(1);
}

function 
onTimeout() {
  echo(
"onTimeout(): i =" SPC i);
}

function 
test() {
  echo(
"test(): i =" SPC i);

Returns:
HTML Code:
onCreated(): i = 34 temp.i= 
test(): i = 34
onTimeout(): i = 34

Last edited by Riot; 03-30-2007 at 11:43 PM.. Reason: stupid word filter
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:31 AM.


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