Results 1 to 18 of 18

Thread: Ok, what?

  1. #1
    Join Date
    Mar 2013
    Posts
    49
    Mentioned
    0 Post(s)
    Quoted
    17 Post(s)

    Default Ok, what?

    This is probably my ignorance with lape and shit but honestly what the fuck

    Heres my code:
    Code:
        getMousePos(mouseX, mouseY);
        writeln(mouseX);
        writeln(mouseY);
        writeln(mouseX >= 0);
        writeln(mouseX <= 765);
        writeln(mouseY >= 0);
        writeln(mouseY <= 503);
        writeln((mouseX >= 0 and mouseX <= 765 and mouseY >= 0 and mouseY <= 503));
    It outputs
    400
    400
    true
    true
    true
    true
    false

    SERIOUSLY WHAT THE FUCK!?!?!?

  2. #2
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    What the!
    Simba Code:
    writeln(((mouseX >= 0) and (mouseX <= 765) and (mouseY >= 0) and (mouseY <= 503)));

  3. #3
    Join Date
    Mar 2013
    Posts
    49
    Mentioned
    0 Post(s)
    Quoted
    17 Post(s)

    Default

    Quote Originally Posted by Olly View Post
    What the!
    Simba Code:
    writeln(((mouseX >= 0) and (mouseX <= 765) and (mouseY >= 0) and (mouseY <= 503)));
    ty, i hate this language

  4. #4
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    Quote Originally Posted by JJordan View Post
    ty, i hate this language
    Don't use it then... ?

  5. #5
    Join Date
    Mar 2013
    Posts
    49
    Mentioned
    0 Post(s)
    Quoted
    17 Post(s)

    Default

    Quote Originally Posted by Olly View Post
    Don't use it then... ?
    What are the other options to script in simba?

  6. #6
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    Quote Originally Posted by JJordan View Post
    What are the other options to script in simba?
    None, but you seem to get pretty mad when you have to do something that is a standard across most languages (boolean comparison with parentheses...)

  7. #7
    Join Date
    Mar 2013
    Posts
    49
    Mentioned
    0 Post(s)
    Quoted
    17 Post(s)

    Default

    Quote Originally Posted by Olly View Post
    None, but you seem to get pretty mad when you have to do something that is a standard across most languages (boolean comparison with parentheses...)
    Not in java, not in python, not in c++. This language is just the opposite of intuitive and is honestly the hardest one I've attempted to learn.

  8. #8
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    Quote Originally Posted by JJordan View Post
    Not in java, not in python, not in c++. This language is just the opposite of intuitive and is honestly the hardest one I've attempted to learn.
    *Goes to any docs*

    http://codingbat.com/doc/java-if-boolean-logic.html
    http://www.cplusplus.com/doc/tutorial/operators/

    They all use parentheses!

  9. #9
    Join Date
    Mar 2013
    Posts
    49
    Mentioned
    0 Post(s)
    Quoted
    17 Post(s)

    Default

    Quote Originally Posted by Olly View Post
    They aren't required and are only used for order of operation... * goes to my injection client to make sure its still compiling *

  10. #10
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    Quote Originally Posted by JJordan View Post
    They aren't required and are only used for order of operation... * goes to my injection client to make sure its still compiling *
    Injection client? you badass!

    fyi I did say it was a standard (possibly not required) across most languages.

  11. #11
    Join Date
    Mar 2013
    Posts
    49
    Mentioned
    0 Post(s)
    Quoted
    17 Post(s)

    Default

    Quote Originally Posted by Olly View Post
    Injection client? you badass!

    fyi I did say it was a standard (possibly not required) across most languages.
    Thank,

    I don't think its laid out in java's conventions (haven't read the others)

  12. #12
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    Quote Originally Posted by Olly View Post
    Injection client? you badass!

    fyi I did say it was a standard (possibly not required) across most languages.
    That's actually not true.

  13. #13
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    Quote Originally Posted by tls View Post
    That's actually not true.
    Seems like all the examples & docs guide us wrong!

  14. #14
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    Quote Originally Posted by Olly View Post
    Seems like all the examples & docs guide us wrong!
    I mean there is an order of operations for a reason. It is recommended to wrap individual conditional expressions just to make the order unambiguous and easier to visually grep. Unless you are trying to change the order, it isn't standard(if by standard you mean according to the language spec, and not "best practice").

  15. #15
    Join Date
    Feb 2012
    Location
    Norway
    Posts
    995
    Mentioned
    145 Post(s)
    Quoted
    596 Post(s)

    Default

    Quote Originally Posted by JJordan View Post
    ....
    The "and"-operator has two purposes in Pascal, unlike C inspired languages, it servers as BOTH a bitwise, and a logical boolean operator, which is why you got that result. That isn't very intuitive, most people learning pascal seem to fall into that "trap".
    Bitwise operators has higher precedence than logical operators, so "and" is solved before the comparison operator, and treated as a bitwise "and", like "&" in most C inspired languages.

    So, it's a common mistake to make for "inexperienced scripters", here are a few cases I found in SRL-6:
    + https://github.com/SRL/SRL-6/blob/ma...lor.simba#L718
    + https://github.com/SRL/SRL-6/blob/ma...lor.simba#L767
    + https://github.com/SRL/SRL-6/blob/ma...nfo.simba#L149
    + https://github.com/SRL/SRL-6/blob/ma...ban.simba#L649
    Those should perhaps be fixed as well, we welcome any pull-request that corrects those errors
    Last edited by slacky; 06-26-2016 at 12:57 PM.
    !No priv. messages please

  16. #16
    Join Date
    May 2012
    Posts
    499
    Mentioned
    23 Post(s)
    Quoted
    228 Post(s)

    Default

    Quote Originally Posted by slacky View Post

    So, it's a common mistake to make for "inexperienced scripters", here are a few cases I found in SRL-6:
    + https://github.com/SRL/SRL-6/blob/ma...lor.simba#L718
    + https://github.com/SRL/SRL-6/blob/ma...lor.simba#L767
    + https://github.com/SRL/SRL-6/blob/ma...nfo.simba#L149
    + https://github.com/SRL/SRL-6/blob/ma...ban.simba#L649
    Those should perhaps be fixed as well, we welcome any pull-request that corrects those errors
    As those are pretty much all my edits ill create a pull request shortly...

  17. #17
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default


  18. #18
    Join Date
    Jul 2016
    Posts
    2
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by rj View Post
    -IMG-
    Image is actually wrong. Multiply and divide are on the same tier and their order of interpretation should be from left to right and have no precedence over each other. Same is true for addition and subtraction; and exponents and roots..

    en.wikipedia.org/wiki/Order_of_operations
    exponents[1] and roots
    multiplication[1] and division[1]
    addition[1] and subtraction[1]
    On topic: Use as many parenthesis as you can without adding ones that are redundant. This goes well in math too.
    Last edited by Ice Poseidon; 07-06-2016 at 06:16 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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