Page 1 of 2 1 2 LastLast
Results 1 to 10 of 19

Thread: Grief's Scripts,

  1. #1
    aaaaaaaaaaaaaaaaaaaaaaaaa Grief Hero's Avatar
    Join Date
    Jun 2013
    Location
    n/a
    Posts
    1,327

    Grief's Scripts,

    This is basically a thread about my scripts.

    So, I didn't have any ideas for something to script, so I was doing math, and it came to me, why not make an algebra solver?
    I then proceeded to create one in Java and GS2, but I wanted something that could support user input, and why not use BATCH for that? I know I can do user input with java and GS2, but I'm to lazy to try right now.
    Also, sorry for all the messiness.
    Here are all 3 scripts


    Java:Very fast
    PHP Code:

    package solver
    ;

    public class 
    main {
        public static 
    void main(String args[]) {
            
    float uk=0//unknown variable
            
    float thing 30//known variable
            
    float ans 2700;  //the answer the equation
            
    boolean tr;
            while(
    uk<ans) {
                 
    uk++;
                
    float solv uk;
                if (
    uk>100000//do not remove this unless your answer is larger than 10000
                

                    break;
                }
                if (
    solv/thing!=ans) { //change the / to whatever mathematical symbol you require
                     
    tr true;
                }
                if (
    tr=true) {
                 
    System.out.println(solv/thing);        
        }  
            }
       }
           } 
    GS2: Slower
    PHP Code:
    function onCreated() {  
       
    uk 0//leave this alone, can be a neg if desired.
        
    thing 10//then the known number
        
    equ ans/uk;
        
    ans 100//place the answer to your equation here.
        
    while(uk+1<=ans) {
          
    uk++;
          
    solve uk;
          
    sleep(0.05);
          if (
    ans/uk=thing) { //replace the / with the mathematical symbol you require.
             
    echo("The answer is" SPC uk);
          }
        } 
      } 
    and BATCH:Very slow if the number is large

    PHP Code:
    @echo off
    :TOP
    set x
    =0
    set solv
    =0
    set TEST
    =0
    echo User InputType in what is being added to X
    set 
    /p ADDER=
    cls

    echo User InputType in what the answer to the equation is:
    set /p ANS=
    cls

    :QUEST
    echo User InputWould you like your x to start as a negative number?
    set /p YES=
    cls
    if /"%YES%"=="yes" goto :NEG
    if /"%YES%"=="no" goto :Repeat
    goto :QUEST

    :NEG
    set 
    /a x=0-ANS-1000
    goto :Repeat




    :Repeat
    if "%solv%"=="1" goto :ANSWERED
    set 
    /a x=%x%+1
    set 
    /a TEST=%x%+"%ADDER%"
    if "%test%"=="%Ans%" goto :SETSOLVE
    echo %x%

    if 
    "%x%"=="100000" goto :Fail
    goto :Repeat

    :SETSOLVE
    set solv
    =1
    goto :Repeat

    :ANSWERED
    cls
    echo %x%
    pause
    cls
    goto :TOP

    :Fail
    cls
    color c0
    echo Fatal Error has occured:
    echo 
    Buffer Overflow Error
    pause
    color 07
    cls
    goto :TOP 
    Last edited by Grief Hero; 04-17-2014 at 05:01 AM.


    I saw. I conquered. I came.


  2. #2
    All I see is letters, Lol scripting is so complicated.

  3. #3
    Kingsman Chris Zephlyn's Avatar
    Join Date
    Aug 2013
    Location
    New York
    Posts
    250
    what do you mean by problem solver? You input something and you receive an output?
    ...
    Chris: he's done worse
    Chris: like harassing my poor dog
    Raul Zephlyn: That little **** is annoying
    Chris: it wouldnt be so annoying if u didnt touch its private
    Raul Zephlyn: Well my dog rolls over when I do that
    Dan!: ew
    Junz: what am i reading

  4. #4
    Same I just wanna learn to script to hard tho lol.

  5. #5
    aaaaaaaaaaaaaaaaaaaaaaaaa Grief Hero's Avatar
    Join Date
    Jun 2013
    Location
    n/a
    Posts
    1,327
    Quote Originally Posted by Chris Zephlyn View Post
    what do you mean by problem solver? You input something and you receive an output?
    Algebra solver, not problem solver. So, for instance I have a basic algebra question, 300/x=150. I'd input the answer, and the known number, and add the mathematical symbol "/" for division. I then proceed to click execute, and almost instantly recieve the unknown variable in Java. In GS2, same procedure but it takes a little while longer. Batch is even slower, as there is no repeat statement, but I can add user input without editing the code.

    Currently working on a better version which can support longer equations and more variables.
    Last edited by Grief Hero; 04-17-2014 at 05:55 AM.


    I saw. I conquered. I came.


  6. #6
    Street Boss John's Avatar
    Join Date
    Jun 2013
    Location
    Lebanon
    Posts
    825
    There's a way easier way to do that.

    - - - Updated - - -

    Plus your code is filled with logical errors.
    -Johnaudi

  7. #7
    Quote Originally Posted by John View Post
    There's a way easier way to do that. - - - Updated - - - Plus your code is filled with logical errors.
    Instead of saying that why don't you show him, he's obviously new to this and just by saying that you're not helping.

  8. #8
    Street Boss John's Avatar
    Join Date
    Jun 2013
    Location
    Lebanon
    Posts
    825
    There is so much I don't know where to get started...

    for example:
    PHP Code:
    while(uk+1<=ans) {
          
    uk++;
          
    solve uk;
          
    sleep(0.05);
          if (
    ans/uk=thing) { //replace the / with the mathematical symbol you require.
             
    echo("The answer is" SPC uk);
          }
        } 
    What's the point of having sleep() and what is solve = * used for?

    Plus, in the java code, why did you use float? You're adding an integer on each, this is not the solution, preferably it's better if you use a mathematical equation and not loop through numbers... What if an answer was decimal? Code won't help you here.
    -Johnaudi

  9. #9
    was Gona post what jhon said coz ima pr0 at coding but he beat me to it Cx

  10. #10
    Hey does a SPC work in functions othere than echo? such as PlayerChats?
    Noof was here.

Posting Permissions

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