
Moderator: Phades
_Gunnar wrote:Sorry, my bots achieved sentience and started writing other bots...
Pjotr84 wrote:Arcanist wrote:Pjotr84 wrote:Fixed it already: Replace jSelectPopupMenu with jSelectContextMenu and you're good to go. Now I just have to find a way to let the script
_Gunnar wrote:Sorry, my bots achieved sentience and started writing other bots...
liamw1986 wrote:im saving them with .jbot extension, all files, and UTF-8. Prehaps my java needs an update but I only got java a few months ago on this so I doubt that is the problem. And my runstarve works just fine. Although I do get an error when I run the client:
This error has never caused any problems for me before though.
public String waitButtonClick() {
return waitButtonClick(2,147,483,647); //This is the biggest integer in the world, it will take 25 days for this menu to go away
}
//#! name = Demonstration for getAreaByUserInputWindow(String Text) Function
//#! tooltip = You will probable want to remove the demonstration section and copy this into your .japi's or make this a .japi if you like the way it works
//////////////////////////////////////////////////////////////////////////
///////////////////////Just For Demonstration/////////////////////////////
function SelectAreaDemonstration(){
this.displayFrontEnd = new DisplayFrontEnd();
this.aArea = this.displayFrontEnd.getAreaByUserInputWindow("Demonstration Area");
}
SelectAreaDemonstration.prototype.run = function(){
jPrint(String(this.aArea));
var GobArray = this.aArea.getTilesInArea();
for(var j = 0; j < GobArray.length; j++)
{
jPrint(String(GobArray[j]))
}
jPrint("Tiles in Array: " + String(GobArray.length));
}
///////////////////////Just For Demonstration/////////////////////////////
/////////////////////////////////////////////////////////////////////////
// Area Class, Parameters: northWestCoord - jCoord The Northwest Corner of the Area
// areaSize - jCoord The Size of the Area
function Area(northWestCoord, areaSize){
this.northWestCoord = northWestCoord;
this.southEastCoord = northWestCoord.add(areaSize.sub(jCoord(11,11)));
if(areaSize.x < 0 || areaSize.y < 0)
{
jPrint("Tried to Create an Area that is Smaller than 0 - In Area Constructor - Area Set to Zero")
this.areaSize = jCoord(0,0);
}
else
{
this.areaSize = areaSize;
}
}
Area.prototype.toString = function(){
return "Area Size: " + String(this.areaSize) + "North West Coord: " + String(this.southEastCoord) + "Bottom Left Coord: " + String(this.northWestCoord);
}
// Area.getTilesInArea - Returns the Tile Types in the Area
Area.prototype.getTilesInArea = function(){
var tileArray = [];
var positionInArea = jCoord(0,0);
var arrayIndex = 0;
var gettingTiles = true;
//I'm sorry I didnt want to give out my movement function as I spent alot of time on it, you will probably want to replace the crappy jAbsClick with your movement function
//lmMoveToCoord(this.northWestCoord)
jAbsClick(this.northWestCoord , 1, 0)
jWaitMove(10000)
while(gettingTiles)
{
if(positionInArea.x < (this.areaSize.x) / 11)
{
tileArray[arrayIndex] = new Tile(jGetTileType(jCoord(positionInArea.x, positionInArea.y)), this.northWestCoord.add(positionInArea.mul(11)))
arrayIndex++;
positionInArea.x++;
}
else
{
if(positionInArea.y < (this.areaSize.y - 11)/11)
{
positionInArea.x = 0;
positionInArea.y++;
}
else
{
return tileArray;
}
}
}
}
// Area.getTilesInArea - Returns the Gobs in the Area
Area.prototype.getGobsInArea = function(){
return jGetObjectsInRect(this.northWestCoord, this.areaSize.div(11), 0, "");
}
// The DisplayFrontEnd - You may want to delete this and make straight up functions, this class serves a point in some of my other bots but not here
function DisplayFrontEnd(){
this.menuUIPlacementCoord = jCoord(200,100);
}
DisplayFrontEnd.prototype.getAreaByUserInputWindow = function(textAreaName){
var areaSize = this.getCoordByByUserInputWindow("Enter the Size of the " + textAreaName);
jDrawGroundRect(jCoord(0,0), areaSize);
areaSize = areaSize.mul(11);
var topCornerCoord = jTilify(this.getCharCoordinantesByUserInput("Move to the " + textAreaName));
jDrawGroundRect(jCoord(0,0), jCoord(0,0));
area = new Area(topCornerCoord, areaSize);
return area;
}
DisplayFrontEnd.prototype.getCoordByByUserInputWindow = function(text){
var window = jGUIWindow(this.menuUIPlacementCoord, jCoord(200, 85), "Enter XY Coordinate");
jGUILabel(window, jCoord(15, 0), text);
var invalidResponceLabel = jGUILabel(window, jCoord(0, 80), "");
var entryBoxX = jGUIEntry(window, jCoord(35, 25), jCoord(50, 20), "0");
jGUILabel(window, jCoord(20, 27), "X:");
var entryBoxY = jGUIEntry(window, jCoord(115, 25), jCoord(50, 20), "0");
jGUILabel(window, jCoord(100, 27), "Y:");
jGUIButton(window, jCoord(75, 55), 50, "Ok");
var gettingInput = true;
while(gettingInput)
{
window.waitButtonClick(240000);
if(isNaN(parseInt(entryBoxX.getText()), 10) && isNaN(parseInt(entryBoxY.getText()), 10))
{
invalidResponceLabel.setText("Invalid Entry for both X and Y - Enter a Number")
}
else if(isNaN(parseInt(entryBoxX.getText()), 10))
{
invalidResponceLabel.setText("Invalid Entry for X - Enter a Number")
}
else if(isNaN(parseInt(entryBoxY.getText()), 10))
{
invalidResponceLabel.setText("Invalid Entry for Y - Enter a Number")
}
else
{
window.destroy();
return jCoord(parseInt(entryBoxX.getText()), parseInt(entryBoxY.getText()));
}
}
}
DisplayFrontEnd.prototype.getCharCoordinantesByUserInput = function(text) {
var gettingUserCoords = true;
while(gettingUserCoords)
{
var messageWindow = jGUIWindow(this.menuUIPlacementCoord, jCoord(170, 50), "Move To Location");
jGUILabel(messageWindow, jCoord(0 , 0), text)
jGUIButton(messageWindow, jCoord(40 , 25), 100, "Ok")
messageWindow.waitButtonClick(240000);
messageWindow.destroy();
return jMyCoords();
}
}
// The Tile Class - Im tired of typing this ones self explanatory
function Tile(type, coord){
this.type = type;
this.coord = coord;
}
Tile.prototype.toString = function(){
return "Tile Type: " + this.type + " Tile Coord: " + this.coord;
}
var selectAreaDemonstration = new SelectAreaDemonstration().run();
killerdude54 wrote:How come when I run the grape bot on the farmer it doesn't work? I select the LC, Winepress, and Barrel, but when I input the area and run it, it does nothing. It just stands there, although it did go to the harvest tool.
^ It's inventory.
Users browsing this forum: Claude [Bot] and 0 guests