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 08-12-2007, 08:04 PM
PrinceOfKenshin PrinceOfKenshin is offline
That guy with a beard
PrinceOfKenshin's Avatar
Join Date: May 2004
Location: Ontario, Canada
Posts: 819
PrinceOfKenshin has a spectacular aura aboutPrinceOfKenshin has a spectacular aura about
Nesting Statement?

Does the elseif statement work as a nesting statement? Here is an example it is nothing just showing kinda what i mean.

PHP Code:
Function onCreated(){
if (
rawr ==rawr){
blah;
} elseif (
rawr == 2){
woot;
} elseif (
rawr == 5){
woot;

The way it works is which ever if statement is true it will run first without stopping to look at the others
__________________


Quote:
Game Master (Server): Greetings PrinceOfKenshin, there are new posts on the forums that demand your urgent attention! God speed, the fate of the world is in your hands. If you fail, middle earth will forever be in the darkness and your children will be enslaved by McKain.
Reply With Quote
  #2  
Old 08-12-2007, 08:52 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
The answer is yes.

if can be used after else but they're not joined like you're doing.
PHP Code:
function onPlayerChats() {
  if (
player.chat == "/reconnect") {
    
System.reconnect();
    
player.chat "";
  }
  else if (
player.chat == "/disconnect") {
    
System.disconnect();
    
player.chat "";
  }
  else {
    
player.chat "ZOMG TEXT";
  }

__________________
Reply With Quote
  #3  
Old 08-12-2007, 10:24 PM
PrinceOfKenshin PrinceOfKenshin is offline
That guy with a beard
PrinceOfKenshin's Avatar
Join Date: May 2004
Location: Ontario, Canada
Posts: 819
PrinceOfKenshin has a spectacular aura aboutPrinceOfKenshin has a spectacular aura about
Thanks i wasn't sure if it was true. Because i know in Visual Basics it works like that and makes things easier = )
__________________


Quote:
Game Master (Server): Greetings PrinceOfKenshin, there are new posts on the forums that demand your urgent attention! God speed, the fate of the world is in your hands. If you fail, middle earth will forever be in the darkness and your children will be enslaved by McKain.
Reply With Quote
  #4  
Old 08-13-2007, 06:16 PM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Actually nesting is like this:
PHP Code:
if (blah == blah) {
  if (
foo == bar) {
    
doFooBar();
  }
  else if (
== b) {
    
doFoolessBar();
  }
}
else {
  
doOtherthings();

Notice the
PHP Code:
  if (foo == bar) {
    
doFooBar();
  }
  else if (
== b) {
    
doFoolessBar();
  } 
is nested inside the
PHP Code:
if (blah == blah) { 
?
__________________
Do it with a DON!
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 03:48 PM.


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