Jump to content

Turn run on snippet


Recommended Posts

Posted (edited)
	public boolean enableRun(boolean on)	{
		if (!script.settings.isDataOrbsActive())
			return script.settings.setRunning(on);
		else{
			if (script.interfaces.getChild(548, 93) != null)
				return script.interfaces.getChild(548, 93).interact();
			else
				return false;
		}		
	}

Its nothing much to it, support both the orbs or using settings.

 

edit: i updated op to support enabling method

Edited by josedpay
Posted

How is posting code improvements 'pointless'?

wtf, the only thing you changed was making it into one line -.-, I want my code to be readable. For those new scripters. 

 

Also, your code will never return true if someone has the data orbs on because of 

return !script.settings.isDataOrbsActive() && (blah);

so if this is improving code, i dont know what java is facep.gif

Posted (edited)

It's kinda redundant adding a null check for the 548 widget, since it's what makes up the main game screen. Have it take a boolean for enable/disable run and rename it to enableRun or something to make the method more versatile.

 

 

public boolean turnRunOn() {
        return !script.settings.isDataOrbsActive() && (script.interfaces.getChild(548, 93) != null ? script.interfaces.getChild(548, 93).interact(): script.settings.setRunning(true));
    }

8da4667e20a6fbf865fb191e74c48a07.png

 

Should be:

public boolean turnRunOn() {
    return script.configs.get(RUN_CONFIG) > 0 || (!script.settings.isDataOrbsActive() && script.settings.setRunning(true)) || script.interfaces.getChild(548, 93).interact();
}
Edited by Swizzbeat
Posted

 

It's kinda redundant adding a null check for the 548 widget, since it's what makes up the main game screen. Have it take a boolean for enable/disable run and rename it to enableRun or something to make the method more versatile.

 

 

i was checking the widgets child to see if it contains the the orb to interact with it. Since the api doesnt contain a method.

 

Also i only supplying the basic, the get run energy and stuff they could add it in there self. 

 

edit op too

Posted

i was checking the widgets child to see if it contains the the orb to interact with it. Since the api doesnt contain a method.

 

Also i only supplying the basic, the get run energy and stuff they could add it in there self. 

 

edit op too

I'm 99% sure the widget child is always there, despite whether orbs are enabled or not. Just a suggestion :p

Posted

 

It's kinda redundant adding a null check for the 548 widget, since it's what makes up the main game screen. Have it take a boolean for enable/disable run and rename it to enableRun or something to make the method more versatile.

 

 

8da4667e20a6fbf865fb191e74c48a07.png

 

Should be:

public boolean turnRunOn() {
    return script.configs.get(RUN_CONFIG) > 0 || (!script.settings.isDataOrbsActive() && script.settings.setRunning(true)) || script.interfaces.getChild(548, 93).interact();
}

I don't even Osbot, xHE001C.png. Just posting dat ternary.

  • Like 1
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...