Page 3 of 4 FirstFirst 1 2 3 4 LastLast
Results 21 to 30 of 40

Thread: To learn how to script.

  1. #21
    El Bacon Hombre Police Commissioner
    Join Date
    Jun 2013
    Location
    United States
    Posts
    247
    Quote Originally Posted by John View Post
    Replace break; with return, this was an example, that's why it's important to use loops instead of nub coding lol.
    Every time I look at it I wish you could have used at least a while loop but then I realize he probably doesn't know how to use those :<
    [email protected]
    *Stefan: You steal my cookies?

  2. #22
    Veteran Striker's Avatar
    Join Date
    Jul 2013
    Location
    Britian
    Posts
    283
    Quote Originally Posted by BboyEatsbacon View Post
    Serverside and clientside aren't even operated on the same things.
    Clientside is compiled then sent off to be executed on the client whilst serverside is compiled then sent off to be executed by the server.

    Therefore, this. variables will go through the whole script, but only on the size it's instanced on. So, a this.timer = 5; declaration on serverside will not set this.timer = 5; on clientside and vice versa.
    So I'll have to make a new variable on client side?
    Striker*
    -Have any question, concerns or problems?
    Message me on forums, click on the link if you need help: http://era-go.com/forum/member.php?410-Striker
    Need help on iEra P.M my nick name is Striker*
    -Need further help? My email is:[email protected]
    ENjOY PLAYING IERA!!!!!
    -Gani Artist

  3. #23
    Veteran Striker's Avatar
    Join Date
    Jul 2013
    Location
    Britian
    Posts
    283
    Quote Originally Posted by BboyEatsbacon View Post
    Every time I look at it I wish you could have used at least a while loop but then I realize he probably doesn't know how to use those :<
    HMM I really wanted to know though what switch() does and while........ and whats cmd? i won't go there until I finish what I need to learn before.
    Striker*
    -Have any question, concerns or problems?
    Message me on forums, click on the link if you need help: http://era-go.com/forum/member.php?410-Striker
    Need help on iEra P.M my nick name is Striker*
    -Need further help? My email is:[email protected]
    ENjOY PLAYING IERA!!!!!
    -Gani Artist

  4. #24
    You use while and do...while for conditional looping (you don't know how many times you have to loop). You use switch when you wanna compare 1 variable to a bunch of values (could also be done with a bunch of if...else if). You use break if you want to exit a loop early (I usually put those with a condition). You use return; when you want to exit a function early. I could give you java syntax, but you probably don't want that.

  5. #25
    Street Boss John's Avatar
    Join Date
    Jun 2013
    Location
    Lebanon
    Posts
    825
    Quote Originally Posted by BboyEatsbacon View Post
    Every time I look at it I wish you could have used at least a while loop but then I realize he probably doesn't know how to use those :<
    Well yes, this would've worked actually, but he isn't getting the for() loop so I doubt he'd know how a while loop works.
    PHP Code:
    while(temp.<= 5) {
      echo(
    temp.i);
      
    temp.i++;

    -Johnaudi

  6. #26
    Street Boss John's Avatar
    Join Date
    Jun 2013
    Location
    Lebanon
    Posts
    825
    Quote Originally Posted by bobo View Post
    You use while and do...while for conditional looping (you don't know how many times you have to loop). You use switch when you wanna compare 1 variable to a bunch of values (could also be done with a bunch of if...else if). You use break if you want to exit a loop early (I usually put those with a condition). You use return; when you want to exit a function early. I could give you java syntax, but you probably don't want that.
    He doesn't really need do{}, I even doubt anyone uses it on graal anyways: (if it works)
    PHP Code:
    do {
      echo(
    temp.i);
      
    temp.i++;
    } while (
    temp.<=5); 
    -Johnaudi

  7. #27
    Street Boss John's Avatar
    Join Date
    Jun 2013
    Location
    Lebanon
    Posts
    825
    Quote Originally Posted by Striker View Post
    HMM I really wanted to know though what switch() does and while........ and whats cmd? i won't go there until I finish what I need to learn before.
    cmd is just a variable you call it cmd...? It's short for command.
    Gs2 for the Noobs #3 will explain how loops, switch() and other stuff you want to learn, meanwhile, keep reading the #1 and #2.
    -Johnaudi

  8. #28
    Quote Originally Posted by John View Post
    He doesn't really need do{}, I even doubt anyone uses it on graal anyways: (if it works)
    PHP Code:
    do {
      echo(
    temp.i);
      
    temp.i++;
    } while (
    temp.<=5); 
    I like using do...while when I wanna make a loop but don't know the condition at the beginning. So I'll put a do{, put the stuff in, then figure out the condition on the end.

  9. #29
    Veteran Striker's Avatar
    Join Date
    Jul 2013
    Location
    Britian
    Posts
    283
    Quote Originally Posted by John View Post
    cmd is just a variable you call it cmd...? It's short for command.
    Gs2 for the Noobs #3 will explain how loops, switch() and other stuff you want to learn, meanwhile, keep reading the #1 and #2.
    I don't even understand the last bit in #2
    Striker*
    -Have any question, concerns or problems?
    Message me on forums, click on the link if you need help: http://era-go.com/forum/member.php?410-Striker
    Need help on iEra P.M my nick name is Striker*
    -Need further help? My email is:[email protected]
    ENjOY PLAYING IERA!!!!!
    -Gani Artist

  10. #30
    Street Boss John's Avatar
    Join Date
    Jun 2013
    Location
    Lebanon
    Posts
    825
    Quote Originally Posted by bobo View Post

    I like using do...while when I wanna make a loop but don't know the condition at the beginning. So I'll put a do{, put the stuff in, then figure out the condition on the end.
    do is not a loop, it's more of an enclosement, while is.

    Quote Originally Posted by Striker View Post
    I don't even understand the last bit in #2
    ask it in the thread!
    -Johnaudi

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •