Jump to content

Yusi

Members
  • Posts

    12
  • Joined

  • Last visited

  • Feedback

    0%

Posts posted by Yusi

  1. On 6/10/2023 at 9:08 AM, Malcolm said:

    here is a custom one I made ages ago. Feel free to edit it.

     

    import java.awt.Color;
    import java.awt.Component;
    import java.awt.Dimension;
    import java.awt.GridLayout;
    import java.sql.Timestamp;
    import java.text.SimpleDateFormat;
    
    import javax.swing.DefaultListCellRenderer;
    import javax.swing.DefaultListModel;
    import javax.swing.JFrame;
    import javax.swing.JList;
    import javax.swing.JPanel;
    import javax.swing.JScrollBar;
    import javax.swing.JScrollPane;
    import javax.swing.JTabbedPane;
    
    public class UltimateLogger {
    
       public UltimateLogger() {
          createLogger();
       }
    
       public void close() {
          loggerFrame.setVisible(false);
          loggerFrame.dispose();
       }
    
       public void open() {
          loggerFrame.setVisible(true);
       }
    
       private void createLogger() {
          JTabbedPane loggerTab = getTabbedPane();
          loggerFrame = getFrame();
          loggerFrame.add(loggerTab);
          open();
       }
    
       private JFrame getFrame() {
          JFrame frame = new JFrame("Ultimate Logger");
          final Dimension frameDimention = new Dimension(650, 350);
          frame.setSize(frameDimention);
          frame.setMinimumSize(frameDimention);
          return frame;
       }
    
       private JTabbedPane getTabbedPane() {
          JPanel scrollPanel = new JPanel();
          scrollPane = new JScrollPane(scrollPanel);
          list = new JList<String>(listModel);
          scrollPanel.add(list);
          scrollPanel.setLayout(new GridLayout(1, 0));
          JTabbedPane tab = new JTabbedPane();
          tab.addTab("Ultimate Bot Debug", scrollPane);
          return tab;
       }
    
       public void log(String loggedString) {
          listModel.addElement(getOkHeader() + loggedString);
          list.setCellRenderer(new CellRender());
          setMaximumScroll();
       }
    
       public void logError(String loggedString) {
          listModel.addElement(getErrorHeader() + loggedString + "\n");
          list.setCellRenderer(new CellRender());
          setMaximumScroll();
       }
    
       public void logWarning(String loggedString) {
          listModel.addElement(getWarningHeader() + loggedString + "\n");
          list.setCellRenderer(new CellRender());
          setMaximumScroll();
       }
    
       private void setMaximumScroll() {
          JScrollBar vertical = scrollPane.getVerticalScrollBar();
          vertical.setValue(vertical.getMaximum());
       }
    
       private String getOkHeader() {
          return "[OKAY][UltimateLogger][" + getTimeStamp() + "]: ";
       }
    
       private String getErrorHeader() {
          return "[ERROR][UltimateLogger][" + getTimeStamp() + "]: ";
       }
    
       private String getWarningHeader() {
          return "[WARN][UltimateLogger][" + getTimeStamp() + "]: ";
       }
    
       public boolean isVisible() {
          return loggerFrame.isVisible();
       }
    
       public static String getTimeStamp() {
          Timestamp timestamp = new Timestamp(System.currentTimeMillis());
          return SDF.format(timestamp);
       }
       
       private final static SimpleDateFormat SDF = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
    
       private JFrame loggerFrame;
       private JScrollPane scrollPane;
       private final DefaultListModel<String> listModel = new DefaultListModel<String>();
       private JList<String> list;
    
       private static class CellRender extends DefaultListCellRenderer {
          @Override
          public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
             super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
             if (value.toString().contains("ERROR")) {
                setForeground(Color.RED);
             } else if (value.toString().contains("WARN")) {
                setForeground(Color.ORANGE);
             } else {
                setForeground(Color.GREEN);
             }
             return this;
          }
       }
    }
    public enum LoggerSeverity {
       
       OKAY, WARN, ERROR;
    
    }

    Damn thank you thats a lot❤️

  2. 44 minutes ago, Khaleesi said:

    You check the Y coordinate to be in the actual visible rectangle :)

     

    I have made this and its working properly thank you 🙂

     

    if (ernestTheChickenQuest != null && ernestTheChickenQuest.isVisible() && ernestTheChickenQuest.getAbsY() > 254 && ernestTheChickenQuest.getAbsY() < 415) {

    log("koyashScript");
    }
  3. Hello, I want to make the map bigger until the icon that symboling my player on map interface is visible

    so the point is even if widget is not visible on main screen osbot dedects it as visible. It works more like != null than isVisible()

    even if i use something like this:



    randomQuestWidget = Quests.Quest.Doric's_Quest

    if (randomQuestWidget != null && randomQuestWidget.isVisible()) {

        randomQuestWidget.hover();
    }

     

    it hovers the mouse on invisible quest -> https://prnt.sc/ROEan6Kj0oZH

    how can i check if a widget actually isVisible or not?

  4. 10 hours ago, faketesco said:

    I have noticed that interact and webwalker can sometimes break when you have your client on resizable and the one that isn't fixed , for me it tries to interact / click on the inventory (and the object/player is under that interface)

     

    39 minutes ago, Khaleesi said:

    I didn't even see it was in resizeable :D

    @Yusi Fixed is always recommended, unless you full screen the client

    Thanks to y'all ill try it

    • Like 1
  5. On 5/15/2023 at 8:26 AM, Khaleesi said:

    Never had any issues regarding this, might want to show the client logger for more info. or maybe a logic issue in the script?
    Also missclicks are always possible, should not matter since it fixes itself within a few seconds :)

     

    I didn't see any error log while it stucked

    about the missclick it happening oftenly and it happens the same way everytime also waits until it almost reached at the point it missclicked so it takes a little bit time

    and i don't think its an script issue im not doing anything that possibly cause that problem

    btw love your scripts🫠

    public void webWalkEventArea(Area targetArea) {

    WebWalkEvent webWalkEventArea = new WebWalkEvent(targetArea);
    webWalkEventArea.setMinDistanceThreshold(0);
    webWalkEventArea.setEnergyThreshold(random(11,36));
    webWalkEventArea.setBreakCondition(new Condition() {
    @Override
    public boolean evaluate() {
    return myPlayer().isUnderAttack();
    }
    });
    execute(webWalkEventArea);
    }
  6. 3 hours ago, Zackaery said:
    int count = 0;
    int counterRandom = random(1, 15);
    ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
    
    @Override
    public int onLoop() throws InterruptedException {
        if (myPlayer().isMoving()) {
            count += 1;
            sleep(1000);
            log(count);
        }
    
        if (count == counterRandom) {
            log("Done");
            counterRandom = random(1, 15);
            count = 0;
        }
    
        return 0;
    }
    
    // separate thread
    public void startCounter() {
        executor.scheduleAtFixedRate(new Runnable() {
            public void run() {
                if (!myPlayer().isMoving()) {
                    count = 0;
                }
            }
        }, 0, 1, TimeUnit.SECONDS);
    }
    
    // stop counter
    public void stopCounter() {
        executor.shutdown();
    }
    
    // call start counter method before starting webwalking
    startCounter();
    
    // perform webwalk
    
    // call stop counter method after webwalking is finished
    stopCounter();
    

    So basically, what you need to do is start a counter before you begin the webwalk. This counter will run in the background while you're moving. It will keep track of the count every second. If your player stops moving, the counter will reset back to zero.

    Thank you ill try it out

  7. 10 minutes ago, FushigiBot said:

    You don't have to count for that. Just write a separate thread where you check for random events and sleep every 5 secs or so.

     
     
    random events especially for walking like customized camera movements or missclicks
  8. Hello, i'm tryng to make a counter while webwalk but it never works. I guess no other process is running until the webwalk is finished.

     

    Can anyone tell me how can i make a counter while walking?

     

    Here's the code example:

     

    int count = 0;

    int counterRandom = random(1,15);

    @Override
    public int onLoop() throws InterruptedException {

    if (myPlayer().isMoving()) {

        count += 1;
        sleep(1000);
        log(count);
    }

    if (count == counterRandom) {

        log("Done");
        counterRandom = random(1,15);
        count = 0;
    }

    return 0;
    }
     
×
×
  • Create New...