Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

Closed Thread
 
Thread Tools Search this Thread Display Modes
  #16  
Old 10-07-2010, 06:45 AM
Cubical Cubical is offline
Banned
Join Date: Feb 2007
Posts: 1,348
Cubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant future
Quote:
Originally Posted by fowlplay4 View Post
You can do that like this..

PHP Code:
  switch(blah){
    case 
"blah": case "blah2":
      
doStuff();
      break;
    case 
"blah3": default:
      
doStuff();
      break;
  } 
Drops read-ability quite a bit imo though.
It was mainly just for my curiosity because I don't even have Graal installed right now. I was wondering for something along the lines of this.
PHP Code:
switch(cmd){
  case 
"command1":
    break;
  case 
"command2":
    break;
  case 
"help": default:  // if help or no params are given then continue
    
sendtorc("commandlist");
    break;

  #17  
Old 10-07-2010, 08:02 AM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Quote:
Originally Posted by Cubical View Post
It was mainly just for my curiosity because I don't even have Graal installed right now. I was wondering for something along the lines of this.
PHP Code:
switch(cmd){
  case 
"command1":
    break;
  case 
"command2":
    break;
  case 
"help": default:  // if help or no params are given then continue
    
sendtorc("commandlist");
    break;

Best way is to do it like this, as suggested in original post:

PHP Code:
switch (cmd) {
  case 
"command1":
  case 
"command2":
    
dostuff;
  break;
  
  default:
    
domorestuff;

either command1 or command2 will activate "dostuff;" and doesn't really hurt readability.
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
  #18  
Old 10-07-2010, 07:30 PM
Cubical Cubical is offline
Banned
Join Date: Feb 2007
Posts: 1,348
Cubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant future
I assumed that was just part of the example, I read it forever ago. Should have reread it.
  #19  
Old 10-08-2010, 03:55 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
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
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Sticky the thread already!
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
  #20  
Old 10-08-2010, 05:15 PM
MrOmega MrOmega is offline
One More Time
MrOmega's Avatar
Join Date: Aug 2010
Location: TN, USA
Posts: 631
MrOmega is an unknown quantity at this point
Send a message via AIM to MrOmega Send a message via MSN to MrOmega Send a message via Yahoo to MrOmega
Quote:
Originally Posted by xXziroXx View Post
Sticky the thread already!
Second and this should be added to the bible as well.
__________________
Time is the fire in which we burn...
Up, Up, Down, Down, Left, Right, Left, Right, B, A, Select, Start! Now I got 99 LIVES!!!
  #21  
Old 03-01-2012, 09:18 PM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
Seriously, is it possible to change the title of this to Switch and Case?
So then when I google Switch, or Case, I won't have to be redirected from another forum spot to here, and come here at the start?
__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz



  #22  
Old 03-01-2012, 09:32 PM
Cubical Cubical is offline
Banned
Join Date: Feb 2007
Posts: 1,348
Cubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant future
You know the title now so you can use the forums search button
  #23  
Old 03-01-2012, 11:01 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Devil_Lord2 View Post
Seriously, is it possible to change the title of this to Switch and Case?
So then when I google Switch, or Case, I won't have to be redirected from another forum spot to here, and come here at the start?
Try using a bookmark; modern web browsers are very good at navigating the web, and, surprisingly, you're not the first person who has ever needed to save a page for later.

Also keep this page handy.
__________________
  #24  
Old 03-02-2012, 05:24 PM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
Quote:
Originally Posted by Cubical View Post
You know the title now so you can use the forums search button
I do not use the forums, I use google since it usually has more value then people telling others who are asking in the forums how to do something to search the forums. The searches, which by the way don't always turn up what you are looking for, aren't very great nor are they organized.

Then you can get into the many people who tell you to use the wikia and the bible which are even more horrible than the forums lol...

Also, you could have said that the first three times I had to search for it, not everyone remembers every single thing they find. ;]
I for one have horrible memory, and would rather look for "GS2 Graal Cases" on google. In turn that would send me to Astrams post about Switches on here, which you then have to scroll down to see someone saying to go to the spoils of switch... Redundant clicks which could be simplified by naming something correctly.


Quote:
Originally Posted by cbk1994 View Post
Try using a bookmark; modern web browsers are very good at navigating the web, and, surprisingly, you're not the first person who has ever needed to save a page for later.

Also keep this page handy.
I'm probably not the first person who has had to replace my hard drive in the last four weeks twice either.

And I highly doubt myself bookmarking it is going to help the others who might need this as well...








Thank you both for your help, you have both changed my life in some way. :]
I'd appreciate it if the question that was asked was actually answered instead of veering off topic next time however..

I can't say I appreciate the person who spammed my Green, Red, and Neutral bar comment thing though. At least comment in something relating to the reason of the picking...
__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz




Last edited by Devil_Lord2; 03-02-2012 at 05:28 PM.. Reason: Thanks. :p
  #25  
Old 03-03-2012, 05:22 AM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
Lol... I am told I am being an ass, because selfishly people are telling me to do things, when I'd like something done for everyone else to have easier access to this..

I'm welcome to more red bars if anyone likes.
And I'd still like the name to be changed so many people can find this easier.
__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz



  #26  
Old 03-03-2012, 05:24 AM
MattKan MattKan is offline
the KattMan
Join Date: Aug 2010
Location: United States
Posts: 1,325
MattKan is a splendid one to beholdMattKan is a splendid one to beholdMattKan is a splendid one to beholdMattKan is a splendid one to beholdMattKan is a splendid one to behold
Send a message via AIM to MattKan
Quote:
Originally Posted by Devil_Lord2 View Post
Lol... I am told I am being an ass, because selfishly people are telling me to do things, when I'd like something done for everyone else to have easier access to this..

I'm welcome to more red bars if anyone likes.
And I'd still like the name to be changed so many people can find this easier.
Just bookmark it. The title is fine. Isn't this page bookmarked on the graal bible too?

Edit: It is! Bookmark this page: http://wiki.graal.net/index.php/Crea...rol_Structures
  #27  
Old 03-03-2012, 05:29 AM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
Quote:
Originally Posted by MattKan View Post
Just bookmark it. The title is fine. Isn't this page bookmarked on the graal bible too?

Edit: It is! Bookmark this page: http://wiki.graal.net/index.php/Crea...rol_Structures
I try not to use Graal Bible unless I absolutely have to, if you go to table of contents there is basically nothing when one should expect a list from A-Z of commands or topics lol... Also, searching for things on it doesn't seem reliable either... D:

Eventually I'd like to make a list of commands GS2 and 'better' details how to make everything. Thank you though..


Quote:
Originally Posted by cbk1994 View Post
Also keep this page handy.
By the way, I missed this, still not relating to my question, I'm glad you posted it. This does look like it has some useful things!

I might be turning my computer in for another due to the Lemon Law which I will have to look up on.. So I can just search for this page to find this lol..
__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz



  #28  
Old 03-03-2012, 05:41 AM
MattKan MattKan is offline
the KattMan
Join Date: Aug 2010
Location: United States
Posts: 1,325
MattKan is a splendid one to beholdMattKan is a splendid one to beholdMattKan is a splendid one to beholdMattKan is a splendid one to beholdMattKan is a splendid one to behold
Send a message via AIM to MattKan
Quote:
Originally Posted by Devil_Lord2 View Post
By the way, I missed this, still not relating to my question
  #29  
Old 03-03-2012, 05:42 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Dear mod who changed the thread title,

Since you're renaming it, please rename it to 'switch case statement' not 'switch and case statements'. What you've done is just wrong, considering no one (excluding special_lord2) around here has ever referred to it as a case statement.
__________________
Quote:
  #30  
Old 03-03-2012, 08:17 AM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
Quote:
Originally Posted by fowlplay4 View Post
Dear mod who changed the thread title,

Since you're renaming it, please rename it to 'switch case statement' not 'switch and case statements'. What you've done is just wrong, considering no one (excluding special_lord2) around here has ever referred to it as a case statement.
Isn't name calling a little uncalled for? And if you'd like to check around the posts, you are actually the only one who has used the word statement(s).

I have only said Switch and Case, and Switch, or Case.
If you are going to make fun of me, at least do it with a little bit more dignity lol...

Quote:
Originally Posted by Devil_Lord2 View Post
Seriously, is it possible to change the title of this to Switch and Case?
So then when I google Switch, or Case, I won't have to be redirected from another forum spot to here, and come here at the start?

Since the question is not registering through anyone's head, the question as stated basically asks to rename a thread. Renaming a thread on http://forums.graalonline.com/ has absolutely nothing to do with Graal Bible (Or so I believe).

Once again, is it possible that this thread get renamed to something a little more relevant?

---

Also, fowlplay4, I believe either you are seeing something that I am not, or if I am correct, the name was never changed and has always been "The Spoils of the Switch and Case". I'm not sure if statements were ever in it though..
__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz



Closed Thread


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 09:19 AM.


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