hey, i just downloaded simba, and im trying to create a simple bot, that would eat, when at certain hp, or under it, can somebody help me with it, and show me like how to start it or something. thanks!
hey, i just downloaded simba, and im trying to create a simple bot, that would eat, when at certain hp, or under it, can somebody help me with it, and show me like how to start it or something. thanks!
https://villavu.com/forum/showthread.php?t=58935 A great beginner's guide, highly recommended
https://villavu.com/forum/showthread.php?t=107757 If you're doing rs3, definitely check this out after getting the basics from that ^
e: I see section now huehue, no clue where the best osrs guides would be at. @Harrier; did you make any yet? smh
e: if it's an rsps then you'll probably have to write your own. Posting a picture of the HP display will help. If there is a number then reading it should be easy.
After reading the first guide that acow posted, check out the reflection tutorial if that's the way you want to go.
With reflection it's as simple as
Simba Code:if (myPlayer.getHeath() < 50) then
begin
//do some stuff
end;
Last edited by Citrus; 09-26-2016 at 05:28 PM.
hp bar is like this, https://gyazo.com/b37ed170886ad2c95fe419ed8911c281
as i said im new tho, i know pretty much nothing about scripting yet. How can i make it like it would know the color of the food, and when its on the certain hp, it would click the color(food), btw do i need to download any plugins for the reflection thingy
Last edited by scripter1; 09-26-2016 at 05:35 PM.
Reflection won't work for this, you'll have to use color.
The HP number should be easy to read. I've written a few scripts for private servers and had no problems reading the text. It's just a matter of knowing which font is used (smallChars maybe?). http://docs.villavu.com/simba/scriptref/ocr.html
I'm busy today, but I might be able to look at this more tonight. Which RSPS is this?
RuneHD, its same as alotic back in the day, but its a beta server atm. just hmu on this post when ur available to help ?
Btw, how do i find the color then, what is the command for it, and how do i start the script, like : "Program - var - (FindColor) or something, then If (FindColor) = True - Then (MouseClick) Food ID/Color
Last edited by scripter1; 09-26-2016 at 06:42 PM.
Hmm.. Simba isn't able to see the game window properly. This is all it sees, even while in game.
http://i.imgur.com/wcgUzBb.png
Anyone know why / how to fix? I know you can use setDesktopAsClient() but that's a pain.
e: I have it worked out.
Last edited by Citrus; 09-27-2016 at 05:41 AM.
Here's what I threw together. Make sure the client window is fixed size and the entire thing is visible and uncovered.
Edit eatFood's slots to wherever your food is.
Simba Code:
program RuneHD_Simple_Eater; const mouse_move = 3; choose_Option_Text_Color = 9812166; choose_Option_Border_Color = 4016722; col = $99ff00; green_text = 65280; yellow_text = 65535; orange_text = 2070783; red_text = 255; var left, top, right, bot: integer; type TOption = record bounds: TBox; str: string; end; TOptionArray = array of TOption; procedure getAndSet(); var pp: TSysProcArr; i: integer; begin pp := client.getIOManager.getProcesses; for i := 0 to high(pp) do begin if pos('RuneHD', pp[i].title) then begin setTarget(pp[i]); getClientPosition(left, top); left += 8; top += 30; right := left + 764; bot := top + 502; setDesktopAsClient(); imageSetClientArea(left, top, right, bot); mouseSetClientArea(left, top, right, bot); exit(); end; end; writeln('RuneHD not found'); terminateScript(); end; procedure mouse(pnt: TPoint; button: integer); var i, x, y: integer; tpa: TPointArray; begin moveMouse(pnt.x, pnt.y); if (button = MOUSE_MOVE) then exit(); wait(22 + random(9)); holdMouse(pnt.x, pnt.y, button); wait(69 + random(69)); getMousePos(x, y); releaseMouse(x, y, button); end; procedure mouseBox(b: TBox; button: integer); begin mouse(point(b.x1 + random(b.x2 - b.x1), b.y1 + random(b.y2 - b.y1)), button); end; function isOptionOpen(wait: integer = 0): boolean; var w, h: integer; t: longword; begin result := false; t := getSystemTime() + wait; getClientDimensions(w, h); repeat result := (countColor(choose_Option_Text_Color, 0, 0, w-1, h-1) > 69); until (result or (getSystemTime() > t)); end; procedure getOptionBounds(var box: TBox); var w, h: integer; tpa: TPointArray; b: TBox; begin if (not isOptionOpen(0)) then exit(); getClientDimensions(w, h); if findColors(tpa, choose_Option_Border_Color, 0, 0, w-1, h-1) then box := getTPABounds(tpa); end; function getOptions(): TOptionArray; var oldT, newT, bmp, w, h, i, n: integer; bounds, box: TBox; begin if (not isOptionOpen(0)) then exit(); oldT := getImageTarget(); getOptionBounds(bounds); bounds.shrink(1); bmp := bitmapFromClient(bounds.x1, bounds.y1, bounds.x2, bounds.y2); fastReplaceColor(bmp, 9812166, col); fastReplaceColor(bmp, 16777215, col); fastReplaceColor(bmp, 65280, col); fastReplaceColor(bmp, 255, col); fastReplaceColor(bmp, 65535, col); fastReplaceColor(bmp, 16776960, col); fastReplaceColor(bmp, 16744447, col); fastReplaceColor(bmp, 28927, col); fastReplaceColor(bmp, 25800, col); fastReplaceColor(bmp, 4231423, col); w := bounds.x2 - bounds.x1; h := bounds.y2 - bounds.y1; n := floor(h / 16); setLength(result, n); try setTargetBitmap(bmp); for i := 0 to n-1 do begin result[i].str := getTextAtEx(0, (i * 16) + 0, w, min(h-1, (i * 16) + 16), 0, 5, 5, col, 0, 'upCharsEx'); result[i].bounds := [0, (i * 16) + 1, w, min(h-1, (i * 16) + 16)]; result[i].bounds.offset(point(bounds.x1, bounds.y1)); result[i].bounds.shrink(1); end; finally newT := getImageTarget(); setImageTarget(oldT); freeTarget(newT); if bitmapExists(bmp) then freeBitmap(bmp); end; end; function selectOption(txt: TStringArray; mouseAction, waitTime: integer): boolean; var opts: TOptionArray; i, j, len: integer; b: TBox; t: longword; begin if (not isOptionOpen(0)) then exit(); t := getSystemTime() + waitTime; opts := getOptions(); if ((len := length(opts)) > 1) then begin for j := 0 to high(txt) do begin for i := 0 to high(opts) do begin if (getSystemTime() > t) then exit(false); if (pos(txt[j], opts[i].str) > 0) then begin mouseBox(opts[i].bounds, mouseAction); exit(true); end; end; end; end; end; function gridBox(slot, columns, rows, w, h, diffX, diffY: integer; startPoint: TPoint): TBox; begin if (slot > (columns * rows)) then begin writeln('gridBox: Invalid slot: '+toStr(slot)); exit; end; result.x1 := (startPoint.x + ((slot mod columns) * diffX) - (w div 2)); result.y1 := (startPoint.y + ((slot div columns) * diffY) - (h div 2)); result.x2 := (result.x1 + w); result.y2 := (result.y1 + h); end; function grid(columns, rows, w, h, diffX, diffY: integer; starTPoint: TPoint): TBoxArray; var i: integer; begin setLength(result, (columns * rows)); for i := 0 to high(result) do result[i] := gridBox(i, columns, rows, w, h, diffX, diffY, starTPoint); end; procedure TBox.edit(const x1_, y1_, x2_, y2_: integer); begin self.x1 := self.x1 + x1_; self.y1 := self.y1 + y1_; self.x2 := self.x2 + x2_; self.y2 := self.y2 + y2_; end; procedure TBox.shrink(const size: integer); begin self.edit(+size, +size, -size, -size); end; procedure TBox.offset(const p: TPoint); begin self.X1 := self.X1 + p.x; self.X2 := self.X2 + p.x; self.Y1 := self.Y1 + p.y; self.Y2 := self.Y2 + p.y; end; function isItemInSlot(slot: integer): boolean; var b: TBox; begin b := gridBox(slot-1, 4, 7, 38, 35, 42, 36, point(579, 229)); result := (countColor(131072, b.x1, b.y1, b.x2, b.y2) > 4); end; function getSlotBox(slot: integer): TBox; begin result := gridBox(slot-1, 4, 7, 38, 35, 42, 36, point(579, 229)); end; function shouldEat(): boolean; const b: TBox = [720, 28, 747, 44]; var x, y: integer; begin result := (findColor(x, y, yellow_text, b.x1, b.y1, b.x2, b.y2) or findColor(x, y, orange_text, b.x1, b.y1, b.x2, b.y2) or findColor(x, y, red_text, b.x1, b.y1, b.x2, b.y2)); end; function eatFood(slots: TIntegerArray = [1..28]): boolean; var i: integer; begin for i := 0 to high(slots) do begin if isItemInSlot(slots[i]) then begin mouseBox(getSlotBox(slots[i]), mouse_right); if selectOption(['Eat'], mouse_left, 222) then exit(true) else mouse(point(-1, -1), mouse_move); end; end; end; procedure mainloop(); begin if shouldEat() then eatFood([10, 18]); { <-- edit the slots where your food is } wait(1234); end; begin getAndSet(); while true do mainloop(); end.
Last edited by Citrus; 09-27-2016 at 03:10 PM.
btw how does the scriptwork, it just says "compiled succesfully in 297 ms", when i run it, it just ends there? or does it begin eating the food when at certain hp
you may be able to borrow stuff from rj's alotic include
There are currently 1 users browsing this thread. (0 members and 1 guests)