Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

String appending only existing as last appended object

Featured Replies

So. 
You know. usual normal people code issues.
got a bunch of strings i'm bunging together, but for whatever reason when I go to use the final string it only seems to output the last thing I apended to the string.
tried doing contact() on each bit in a massive line, tried +'ing them all together raw, tried using a string builder but in the end it only prints out the last little string that I append to the whole thing.
Randomly does work though, even when nothings changed, just sometimes works.
wat do.
Also checked in every case if any substitute declared string was null and replaced with with another text incase that was it.
Every variable exists.
Fun fact: works when I copy the 1 line to another class and just get it to print out in main.
 

12 minutes ago, Isolate said:

So. 
You know. usual normal people code issues.
got a bunch of strings i'm bunging together, but for whatever reason when I go to use the final string it only seems to output the last thing I apended to the string.
tried doing contact() on each bit in a massive line, tried +'ing them all together raw, tried using a string builder but in the end it only prints out the last little string that I append to the whole thing.
Randomly does work though, even when nothings changed, just sometimes works.
wat do.
Also checked in every case if any substitute declared string was null and replaced with with another text incase that was it.
Every variable exists.
Fun fact: works when I copy the 1 line to another class and just get it to print out in main.
 

Because it works in the main class, you might wanna check if the variable is static.

 

  • Author
Just now, The Undefeated said:

Because it works in the main class, you might wanna check if the variable is static.

 

no boingo staticarino

  • Author
13 hours ago, Mysteryy said:

show dat code or dont expect anyone to be able to help you

I shouldn't have to,  I explained the situation
It's as simple as 
 

String example = "One" + " Two" + " Three";
prntln(example);

only printing out " Three
Regardless of specifically what i'm concatenating the logic is the same.

8 hours ago, Isolate said:

I shouldn't have to,  I explained the situation
It's as simple as 
 


String example = "One" + " Two" + " Three";
prntln(example);

only printing out " Three
Regardless of specifically what i'm concatenating the logic is the same.

I highly doubt it is as simple as that. Java isn't broken, it's your logic/code. If you aren't going to show what you have written, this thread seems pretty pointless

Edited by Explv

  • Author
2 minutes ago, Explv said:

I highly doubt it is as simple as that. Java isn't broken, it's your logic/code. If you aren't going to show what you have written, this thread seems pretty pointless

Well pointing out a pointless thread on osbot is a new level of special
 

//one .java file
public class SomeMainClass{

    public static void main(String[] args){
        SomeClass someClass = new SomeClass();
        if(someClass.someInheretedMethod()){
            //do something
        }
    }

}

//another seperate .java file
public class SomeClass implements SomeInterface{

    @Override
    public boolean someInheretedMethod(){
        String ohHeyAString = "Bacon and Cheese";
        println("Replacing");
        ohHeyAString.replace("Cheese", "Eggs");
        println("Replaced");
        println(ohHeyAString);
        return true;
    }


}

is outputting
"Replacing"
"Replaced"
"Bacon and Cheese"

code is running from start to end but randomly skipping shit. I wouldn't ask a place like this if it wasn't a genuinely confusing issue.
Note: code works fine if the SomeClass exists within the same .java file as the main method floating at the bottom.

1 hour ago, Isolate said:

is outputting
"Replacing"
"Replaced"
"Bacon and Cheese"

code is running from start to end but randomly skipping shit. I wouldn't ask a place like this if it wasn't a genuinely confusing issue.
Note: code works fine if the SomeClass exists within the same .java file as the main method floating at the bottom.

ohHeyAString.replace("Cheese", "Eggs");

Will not change the contents of the existing ohHeyAString, it will return a new one instead, as Strings in Java are immutable.

It should be:

ohHeyAString = ohHeyAString.replace("Cheese", "Eggs");

 

  • Author
9 minutes ago, Explv said:

ohHeyAString.replace("Cheese", "Eggs");

Will not change the contents of the existing ohHeyAString, it will return a new one instead, as Strings in Java are immutable.

It should be:


ohHeyAString = ohHeyAString.replace("Cheese", "Eggs");

 

Bad example was bad but that does rule out that option for me :P


    public static void main(String[] args){
        SomeClass someClass = new SomeClass();
        if(someClass.someInheretedMethod()){
            //do something
        }
    }

}

//another seperate .java file
public class SomeClass implements SomeInterface{

    @Override
    public boolean someInheretedMethod(){
       String temp = "java -jar \"" + JAR_PATH + "\" -debug 5005 -login " + OSBUSERNAME + ":" + OSBPASSWORD + " -world " + world + " -script " + script + ":null -bot " + username + ":" + password + ":0000";
       System.out.println(JAR_PATH +OSBUSERNAME+OSBPASSWORD+world+script+username+password);
        System.out.println(temp);
       exec(temp);
        return true;
    }


}


1. String temp = "java -jar \"" + JAR_PATH + "\" -debug 5005 -login " + OSBUSERNAME + ":" + OSBPASSWORD + " -world " + world + " -script " + script + ":null -bot " + username + ":" + password + ":0000";
2. System.out.println(JAR_PATH +OSBUSERNAME+OSBPASSWORD+world+script+username+password);
3. System.out.println(temp);
4. exec(temp);

Consider lines 1-4 
(don't complain about 1 being just +'ed, this issue occurs in any way I can think of putting a string together for me)

In the context i'm using this code
1. is called from a public String constructString(script, world, ect)
2. is logged inside of the construct method and successfully outputs a garbage string of all the declared details
3. on the other hand is a hoe and only outputs ":0000"
4. is where I get annoyed because it boots the client, skips the login UI but then tells me it can't login because my details aren't in format username:password:pin

On 4/19/2017 at 6:05 AM, Isolate said:

Bad example was bad but that does rule out that option for me :P



    public static void main(String[] args){
        SomeClass someClass = new SomeClass();
        if(someClass.someInheretedMethod()){
            //do something
        }
    }

}

//another seperate .java file
public class SomeClass implements SomeInterface{

    @Override
    public boolean someInheretedMethod(){
       String temp = "java -jar \"" + JAR_PATH + "\" -debug 5005 -login " + OSBUSERNAME + ":" + OSBPASSWORD + " -world " + world + " -script " + script + ":null -bot " + username + ":" + password + ":0000";
       System.out.println(JAR_PATH +OSBUSERNAME+OSBPASSWORD+world+script+username+password);
        System.out.println(temp);
       exec(temp);
        return true;
    }


}

1. String temp = "java -jar \"" + JAR_PATH + "\" -debug 5005 -login " + OSBUSERNAME + ":" + OSBPASSWORD + " -world " + world + " -script " + script + ":null -bot " + username + ":" + password + ":0000";
2. System.out.println(JAR_PATH +OSBUSERNAME+OSBPASSWORD+world+script+username+password);
3. System.out.println(temp);
4. exec(temp);

Consider lines 1-4 
(don't complain about 1 being just +'ed, this issue occurs in any way I can think of putting a string together for me)

In the context i'm using this code
1. is called from a public String constructString(script, world, ect)
2. is logged inside of the construct method and successfully outputs a garbage string of all the declared details
3. on the other hand is a hoe and only outputs ":0000"
4. is where I get annoyed because it boots the client, skips the login UI but then tells me it can't login because my details aren't in format username:password:pin

So your telling me that if you run

public class Test {
    public static void main(String[] args) {
        String JAR_PATH = "your/mom.jar";
        String OSBUSERNAME = "your";
        String OSBPASSWORD = "mom";
        String world = "123";
        String script = "smd incorporated";
        String username = "suck";
        String password = "it";

        String temp = "java -jar \"" + JAR_PATH + "\" -debug 5005 -login " + OSBUSERNAME + ":" + OSBPASSWORD + " -world " + world + " -script " + script + ":null -bot " + username + ":" + password + ":0000";
        System.out.println(JAR_PATH +OSBUSERNAME+OSBPASSWORD+world+script+username+password);
        System.out.println(temp);
    }
}

You dont get:

your/mom.jaryourmom123smd incorporatedsuckit
java -jar "your/mom.jar" -debug 5005 -login your:mom -world 123 -script smd incorporated:null -bot suck:it:0000

??????????

On 4/19/2017 at 7:05 AM, Isolate said:

Bad example was bad but that does rule out that option for me :P



    public static void main(String[] args){
        SomeClass someClass = new SomeClass();
        if(someClass.someInheretedMethod()){
            //do something
        }
    }

}

//another seperate .java file
public class SomeClass implements SomeInterface{

    @Override
    public boolean someInheretedMethod(){
       String temp = "java -jar \"" + JAR_PATH + "\" -debug 5005 -login " + OSBUSERNAME + ":" + OSBPASSWORD + " -world " + world + " -script " + script + ":null -bot " + username + ":" + password + ":0000";
       System.out.println(JAR_PATH +OSBUSERNAME+OSBPASSWORD+world+script+username+password);
        System.out.println(temp);
       exec(temp);
        return true;
    }


}

1. String temp = "java -jar \"" + JAR_PATH + "\" -debug 5005 -login " + OSBUSERNAME + ":" + OSBPASSWORD + " -world " + world + " -script " + script + ":null -bot " + username + ":" + password + ":0000";
2. System.out.println(JAR_PATH +OSBUSERNAME+OSBPASSWORD+world+script+username+password);
3. System.out.println(temp);
4. exec(temp);

Consider lines 1-4 
(don't complain about 1 being just +'ed, this issue occurs in any way I can think of putting a string together for me)

In the context i'm using this code
1. is called from a public String constructString(script, world, ect)
2. is logged inside of the construct method and successfully outputs a garbage string of all the declared details
3. on the other hand is a hoe and only outputs ":0000"
4. is where I get annoyed because it boots the client, skips the login UI but then tells me it can't login because my details aren't in format username:password:pin

Idk what you're attempting to do but it seems like malicious code. However your someInheretedMethod is bad. It will always return true no matter what which leads to bad logic which was previously stated. As to why it isn't working. I don't even know what it is you're trying to do even after reading everything. When your posting a script/code issue, the main thing you should do is post the actual code that you need help with. Being vague and just giving us a explanation of whats happening and what should happen doesn't help us help you. We need to see the code to see the problem, cause it could be a million things.

  • Author
23 hours ago, Mysteryy said:

So your telling me that if you run


public class Test {
    public static void main(String[] args) {
        String JAR_PATH = "your/mom.jar";
        String OSBUSERNAME = "your";
        String OSBPASSWORD = "mom";
        String world = "123";
        String script = "smd incorporated";
        String username = "suck";
        String password = "it";

        String temp = "java -jar \"" + JAR_PATH + "\" -debug 5005 -login " + OSBUSERNAME + ":" + OSBPASSWORD + " -world " + world + " -script " + script + ":null -bot " + username + ":" + password + ":0000";
        System.out.println(JAR_PATH +OSBUSERNAME+OSBPASSWORD+world+script+username+password);
        System.out.println(temp);
    }
}

You dont get:


your/mom.jaryourmom123smd incorporatedsuckit
java -jar "your/mom.jar" -debug 5005 -login your:mom -world 123 -script smd incorporated:null -bot suck:it:0000

??????????

You do, but in the context i'm using this string specifically it doesn't work for no apparent reason, others can confirm i'm not insane.

13 minutes ago, godspower33 said:

Idk what you're attempting to do but it seems like malicious code. However your someInheretedMethod is bad. It will always return true no matter what which leads to bad logic which was previously stated. As to why it isn't working. I don't even know what it is you're trying to do even after reading everything. When your posting a script/code issue, the main thing you should do is post the actual code that you need help with. Being vague and just giving us a explanation of whats happening and what should happen doesn't help us help you. We need to see the code to see the problem, cause it could be a million things.

Dw this issue was solved under the Scripter/Dev sub section so it's all good now, turns out it's not just an Isolate moment it's an actual strange issue with a work around. :)
 

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.