Jump to content

ai's ability to help create scripts


BananaTown

Recommended Posts

has anyone here used ai to help them write a script yet? I asked google bard to write me one and it made this lol

import org.osbot.rs07.api.Client;
import org.osbot.rs07.api.model.Player;
import org.osbot.rs07.api.model.Skill;

public class Script extends Client {

    public static void main(String[] args) {
        // Create a client
        Client client = new Client();

        // Log in to an account
        Player player = client.login("username", "password");

        // Get the skill that you want to train
        Skill skill = client.skills().getSkill("SkillName");

        // Start training the skill
        skill.startTraining();

        // Train the skill for a certain amount of time
        skill.trainFor(1000);

        // Stop training the skill
        skill.stopTraining();

        // Log out
        player.logout();
    }
}
 

vs chat-gtp script

 

import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.model.RS2Object;
import org.osbot.rs07.script.Script;

public class VarrockTreeChopper extends Script {

    private Area treeArea = new Area(3180, 3448, 3192, 3462);

    @Override
    public int onLoop() throws InterruptedException {
        // Move to the tree area
        if (!treeArea.contains(myPosition())) {
            getWalking().webWalk(treeArea);
        }

        // Chop trees
        RS2Object tree = getObjects().closest("Tree");
        if (tree != null && tree.interact("Chop down")) {
            sleepUntil(() -> myPlayer().isAnimating(), 5000);
            sleepUntil(() -> !myPlayer().isAnimating(), 15000);
        }

        return random(1000, 1500);
    }
}

 

Edited by BananaTown459
Link to comment
Share on other sites

  • BananaTown changed the title to ai's ability to help create scripts
1 hour ago, BananaTown459 said:

has anyone here used ai to help them write a script yet? I asked google bard to write me one and it made this lol

import org.osbot.rs07.api.Client;
import org.osbot.rs07.api.model.Player;
import org.osbot.rs07.api.model.Skill;

public class Script extends Client {

    public static void main(String[] args) {
        // Create a client
        Client client = new Client();

        // Log in to an account
        Player player = client.login("username", "password");

        // Get the skill that you want to train
        Skill skill = client.skills().getSkill("SkillName");

        // Start training the skill
        skill.startTraining();

        // Train the skill for a certain amount of time
        skill.trainFor(1000);

        // Stop training the skill
        skill.stopTraining();

        // Log out
        player.logout();
    }
}
 

vs chat-gtp script

 

import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.model.RS2Object;
import org.osbot.rs07.script.Script;

public class VarrockTreeChopper extends Script {

    private Area treeArea = new Area(3180, 3448, 3192, 3462);

    @Override
    public int onLoop() throws InterruptedException {
        // Move to the tree area
        if (!treeArea.contains(myPosition())) {
            getWalking().webWalk(treeArea);
        }

        // Chop trees
        RS2Object tree = getObjects().closest("Tree");
        if (tree != null && tree.interact("Chop down")) {
            sleepUntil(() -> myPlayer().isAnimating(), 5000);
            sleepUntil(() -> !myPlayer().isAnimating(), 15000);
        }

        return random(1000, 1500);
    }
}

 

@Patrick suggestion: add skill.startTraining() to the API

Link to comment
Share on other sites

It made me this autohotkey script to left click cows using "cow.png", never tested it. Doubt it would work just based off of that one image but still kinda funny how detailed it went when asked.
 

#NoEnv
CoordMode, Mouse, Relative
SetWorkingDir %A_ScriptDir%
LoadLibrary("libsikulixapi.dll")
global s, r
s := Sikulix_Start()

Random, randSleep1, 800, 2000
Random, randSleep2, 1500, 3000
Random, randSleep3, 2500, 5000
Random, randSleep4, 1000, 2000
Random, randSleep5, 500, 1500
Random, randSleep6, 800, 2500
Random, randSleep7, 2000, 4000

Loop
{
    IfWinExist, runelite.exe
    {
        WinActivate, runelite.exe
        
        Random, randMouseMove1, -10, 10
        Random, randMouseMove2, -10, 10
        MouseMove, randMouseMove1, randMouseMove2, 50, R
        
        Sleep randSleep1
        
        r := s.Find("cow.png")
        If r <> 0
        {
            x := r.x + (r.w / 2)
            y := r.y + (r.h / 2)
            
            Random, randMouseMove3, -20, 20
            Random, randMouseMove4, -20, 20
            MouseMove, x + randMouseMove3, y + randMouseMove4, 50, R
            
            Sleep randSleep2
            
            Random, randClick1, 100, 300
            Random, randClick2, 50, 150
            MouseClick, left, randClick1, randClick2, 0, 0, R
            
            Sleep randSleep3
            
            Random, randMouseMove5, -15, 15
            Random, randMouseMove6, -15, 15
            MouseMove, randMouseMove5, randMouseMove6, 50, R
            
            Random, randMouseMove7, -3, 3
            Random, randMouseMove8, -3, 3
            MouseMove, randMouseMove7, randMouseMove8, 50, R
            
            Random, randMouseMove9, -5, 5
            Random, randMouseMove10, -5, 5
            MouseMove, randMouseMove9, randMouseMove10, 50, R
            
            Random, randMouseMove11, -3, 3
            Random, randMouseMove12, -3, 3
            MouseMove, randMouseMove11, randMouseMove12, 50, R
            
            Sleep randSleep4
            
            Random, randMouseMove13, -10, 10
            Random, randMouseMove14, -10, 10
            MouseMove, randMouseMove13, randMouseMove14, 50, R
        }
        
        Sleep randSleep5
        
        Random, randMouseMove15, -5, 5
        Random, randMouseMove16, -5, 5
        MouseMove, randMouseMove15, randMouseMove16, 50, R
        
        Sleep randSleep6
        
        Random, randMouseMove17, -10, 10
        Random, randMouseMove18, -10, 10
        MouseMove, randMouseMove17, randMouseMove18, 50, R
        
        Sleep randSleep7
    }
}

Sikulix_Stop(s)

LoadLibrary(name)
{
    static file
    if (file = "")
        file := DllCall("kernel32\GetModuleHandle", "str", name, "ptr")
    return file
}

Sikulix_Start()
{
    Global s, r, hBmp
    s := {}
    s.RunCmd := Func("Sikulix_RunCmd")
    s.Find := Func("Sikulix_Find")
    s.Stop := Func("Sikulix_Stop")
    VarSetCapacity(bi, 40, 0)
    NumPut(40, bi, 0, "UInt")  ;BITMAPINFOHEADER.biSize
    NumPut(1, bi, 4, "Int")   ;BITMAPINFOHEADER.biPlanes
    NumPut(32, bi, 14, "UShort")  ;BITMAPINFOHEADER.biBitCount
    hBmp := CreateDIBSection(0, &bi, 0, &Bits, 0, 0)
    hdc := CreateCompatibleDC(0)
    SelectObject(hdc, hBmp)
    ReleaseDC(0, hdc)
    return s
}

Sikulix_Stop(s)
{
    Global hBmp
    DeleteObject(hBmp)
}

Sikulix_RunCmd(cmd)
{
    run, %comspec% /c %cmd%, , hide
    return ErrorLevel
}

Sikulix_Find(img, timeout:=0)
{
    Global s, r, hBmp, Bits
    if (IsObject(img))
    {
        if img.hWnd := WinExist(img.Title . " ahk_id " . img.hWnd)
            img.Left := img.Top := 0
        else
            img := ImageCreate(img)
    }
    else if (InStr(img, "\"))
        img := ImageCreate(img)
    else if (!s.defImg || !s.defImg.Title)
    {
        MsgBox, 262180, Sikulix, Select default image (cancel to skip):
        IfMsgBox OK
            s.defImg := ImageSelect()
        else
            s.defImg := {}
    }
    if (IsObject(s.defImg))
        img := ImageFind(s.defImg, timeout, 1)
    if (!IsObject(img))
    {
        MsgBox, 16, Sikulix, Image not found:%A_Space%%A_Space%%A_Space%%A_Space%
        return 0
    }
    VarSetCapacity(ar, 16, 0)
    NumPut(16, ar, 0, "UInt")    ;BITMAPFILEHEADER.bfSize
    NumPut(19778, ar, 0, "UShort")   ;BITMAPFILEHEADER.bfType
    NumPut(54, ar, 2, "UInt")    ;BITMAPFILEHEADER.bfOffBits
    NumPut(40, ar, 14, "UInt")   ;BITMAPINFOHEADER.biSize
    NumPut(img.W, ar, 4, "Int")  ;BITMAPINFOHEADER.biWidth
    NumPut(img.H, ar, 8, "Int")  ;BITMAPINFOHEADER.biHeight
    NumPut(1, ar, 12, "UShort")  ;BITMAPINFOHEADER.biPlanes
    NumPut(32, ar, 14, "UShort")  ;BITMAPINFOHEADER.biBitCount
    NumPut(3, ar, 28, "UInt")   ;BITMAPINFOHEADER.biCompression
    hdc := CreateCompatibleDC(0)
    hBmp1 := CreateDIBSection(0, &bi, 0, &Bits1, 0, 0)
    SelectObject(hdc, hBmp)
    BitBlt(hdc, 0, 0, img.W, img.H, img.hDC, 0, 0, SRCCOPY)
    dc := CreateCompatibleDC(0)
    SelectObject(dc, hBmp1)
    c := DllCall("gdi32\GetDIBits", "ptr", hdc, "uint", 0, "uint", img.H, "ptr", &Bits1, "ptr", &bi, "uint", 0)
    VarSetCapacity(bi1, 40, 0)
    NumPut(40, bi1, 0, "UInt")  ;BITMAPINFOHEADER.biSize
    NumPut(1, bi1, 4, "Int")   ;BITMAPINFOHEADER.biPlanes
    NumPut(32, bi1, 14, "UShort")  ;BITMAPINFOHEADER.biBitCount
    hBmp2 := CreateDIBSection(0, &bi1, 0, &Bits2, 0, 0)
    SelectObject(dc, hBmp2)
    DllCall("gdi32\SetStretchBltMode", "ptr", dc, "int", 4)
    StretchBlt(dc, 0, 0, img.W * 2, img.H * 2, hdc, 0, 0, img.W, img.H, SRCCOPY)
    c := DllCall("gdi32\GetDIBits", "ptr", dc, "uint", 0, "uint", img.H * 2, "ptr", &Bits2, "ptr", &bi1, "uint", 0)
    DllCall("gdi32\DeleteDC", "ptr", hdc)
    DllCall("gdi32\DeleteDC", "ptr", dc)
    DllCall("gdi32\DeleteObject", "ptr", hBmp1)
    DllCall("gdi32\DeleteObject", "ptr", hBmp2)
    row1 := img.H * 2 - 1, row2 := img.H * 2 - 2, top := img.H * 2
    for y, x in img.TranspPos
        DllCall("gdi32\SetPixelV", "ptr", img.hDC, "int", x, "int", y, "uint", 0xFFFFFF)
    x := 0, y := 0
    Loop % img.W * 2 * img.H * 2
    {
        if !(A_Index % (img.W * 2))
            x := 0, y += 1
        r1 := NumGet(Bits1, (row1 - y) * ((img.W * 2 * 32 + 31) >> 5) + (x * 32), "UInt")
        r2 := NumGet(Bits2, (row2 - y) * ((img.W * 2 * 32 + 31) >> 5) + (x * 32), "UInt")
        if (r1 & r2)
            img.TranspPos.Insert(x, top - y)
        x += 1
    }
    img.W := img.W * 2, img.H := img.H * 2
    img.hDC := hdc
    img.W := img.W * 2, img.H := img.H * 2
    img.hDC := hdc
    
    ; Apply human-like anti-ban to the mouse clicks
    Random, randDelay, % (2000 - 1000) + 1 + 1000 ; Random delay between 1 to 2 seconds
    Sleep, randDelay
    
    ; Randomize the mouse movement within a range of 20 pixels to simulate human-like jittering
    Random, randX, % 20
    Random, randY, % 20
    CoordMode, Mouse, Screen
    MouseMove, img.TranspPos[1]+randX, img.TranspPos[2]+randY, 50
    
    ; Randomize the mouse click position within a range of 10 pixels
    Random, randClickX, % 10
    Random, randClickY, % 10
    Click, % "Left", img.TranspPos[1]+randClickX, img.TranspPos[2]+randClickY, 1, 0
    
    ; Randomize the delay after each click to simulate human-like clicking pattern
    Random, randClickDelay, % (500 - 200) + 1 + 200 ; Random delay between 0.2 to 0.5 seconds
    Sleep, randClickDelay
    
    ; Randomize the mouse movement again after the click
    Random, randMoveX, % 20
    Random, randMoveY, % 20
    CoordMode, Mouse, Screen
    MouseMove, img.TranspPos[1]+randMoveX, img.TranspPos[2]+randMoveY, 50
    
    Return
}

 

  • Heart 1
Link to comment
Share on other sites

  • 2 months later...
  • 5 weeks later...

ChatGPT no longer wants to help us script lol 

Quote

I'm sorry, but I cannot assist you in creating a script for OSBot or any other botting activity. Automating game mechanics is generally against the terms of service of most online games, including Old School RuneScape, and can result in penalties such as temporary or permanent bans from the game.

Engaging in botting or using automated scripts not only violates the rules of the game but also undermines the integrity of the gaming experience for others. It is always best to play games within the established rules and guidelines set by the game developers to ensure fair and enjoyable gameplay for everyone.

If you have any other questions or need assistance with legitimate gameplay aspects or topics, feel free to ask, and I'll be happy to help!

LOL

 

edit: u can still make it write u scripts u just gotta give bro a nudge 

Edited by BananaTown459
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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