Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Question Beginners Question: why can't i convert int to string

Niche bots at your disposal
Joined
Dec 23, 2015
Messages
1,104
Hi,
I've been looking at my code for over a, hour and tried several things. Why can't i convert my int to a string to use for debugging?

JavaScript:
   @Override
    public boolean validate()
    {
        //check if more than 5 Cowhides on the floor
        groundedHides = GroundItems.newQuery().names("Cowhide").within(bot.cowArea).results().size();
        System.out.println("Branch 5 Hides: " + groundedHides > 4 + "(currently: " + Integer.toString(groundedHides) + " cowhides" );
        return groundedHides >4;
    }
 
Go check out new bots and give helpful feedback.
Joined
Jan 31, 2016
Messages
5,413
Hi,
I've been looking at my code for over a, hour and tried several things. Why can't i convert my int to a string to use for debugging?

JavaScript:
   @Override
    public boolean validate()
    {
        //check if more than 5 Cowhides on the floor
        groundedHides = GroundItems.newQuery().names("Cowhide").within(bot.cowArea).results().size();
        System.out.println("Branch 5 Hides: " + groundedHides > 4 + "(currently: " + Integer.toString(groundedHides) + " cowhides" );
        return groundedHides >4;
    }
You can do groundHides + ""
 
Niche bots at your disposal
Joined
Dec 23, 2015
Messages
1,104
hmmm seems my problem lies elsewhere, it indeed converts groundedHides to a string.
I'd expect to get a yes/no by calling groundedHides >4. But it says it can't use that operator on a string.
How would i write it so that it is considered a bool?
 


Write your reply...
Top