BryceTheCoder Posted January 11, 2012 Share Posted January 11, 2012 Like maybe if i wanted to write tiem running or have a picture of a skillcape on the screen while the bot is running, can i do that somehow? Quote Link to comment Share on other sites More sharing options...
Wanted Posted January 11, 2012 Share Posted January 11, 2012 Yea if you are using SMART client you can use the SMART canvas. Quote Link to comment Share on other sites More sharing options...
BryceTheCoder Posted January 11, 2012 Author Share Posted January 11, 2012 Oo cool. And how would i use SMART canvas? I want to know how please:) I never used canvas before:) Quote Link to comment Share on other sites More sharing options...
shadowrecon Posted January 15, 2012 Share Posted January 15, 2012 wanted ive been messing with this for a week, ive tried everything, it always leads back to an access error on this line SMART_Canvas.canvas.handle := SmartGetDC; ive tried a hundred different ways of setting the handle ive tried writeln the DC and inputting it that way (i know they are non static but they do stay the same for a little while), could it just be scar and smart since the new version arnt clicking? Quote Link to comment Share on other sites More sharing options...
FHannes Posted January 15, 2012 Share Posted January 15, 2012 Is the SMART_Canvas object actually created before doing this? I don't know if this is part of OSI or anything... But before you can actually use SMART_Canvas, it needs to be assigned a canvas object: SMART_Canvas := TCanvas.Create(nil); Before the script terminates it also has to be destroyed with: SMART_Canvas.Free; If the object wasn't initialized, that could be the reason for your error. EDIT: Actually, now that I look closer, what is SMART_Canvas? it isn't a TCanvas object because then it wouldn't have a canvas field of it's own... Quote Link to comment Share on other sites More sharing options...
Wanted Posted January 15, 2012 Share Posted January 15, 2012 I guess I'll come out with a RS2\Misc\SMARTDebug.scar Quote Link to comment Share on other sites More sharing options...
shadowrecon Posted January 16, 2012 Share Posted January 16, 2012 Is the SMART_Canvas object actually created before doing this? I don't know if this is part of OSI or anything... But before you can actually use SMART_Canvas, it needs to be assigned a canvas object: SMART_Canvas := TCanvas.Create(nil); Before the script terminates it also has to be destroyed with: SMART_Canvas.Free; If the object wasn't initialized, that could be the reason for your error. EDIT: Actually, now that I look closer, what is SMART_Canvas? it isn't a TCanvas object because then it wouldn't have a canvas field of it's own... yes it is declarded as a Tbitmap, heres the code: (This complies jsut fine but when it runs it gets a read access violation in scar.exe) var SMART_Canvas: TBitmap; SMART_DebugSetup: Boolean; procedure SMART_SetupDebug(); begin SmartSetDebug(True); SMART_Canvas := TBitmap.Create; SMART_Canvas.canvas.handle := SmartGetDC; SMART_DebugSetup := true; end; ive tried doing this 100 different ways just in seting up the handle, not only in the method, ive tried tcanvas but get the same error. ---------- Post added at 05:15 AM ---------- Previous post was at 05:12 AM ---------- I guess I'll come out with a RS2\Misc\SMARTDebug.scar i can handle the drawing and ect i just need the object to draw on, this is the problem. i cant get the handle of the direct content or DC which is the windows api address or something like that, basically the address of the window. i have tried writeln the address and i do get a number from it and manualy entering that number does nothing but give me the same error.. =/ i can make a debug window and draw on it, just cant draw on smarts canvas Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted January 16, 2012 Share Posted January 16, 2012 i can handle the drawing and ect i just need the object to draw on, this is the problem. i cant get the handle of the direct content or DC which is the windows api address or something like that, basically the address of the window. i have tried writeln the address and i do get a number from it and manualy entering that number does nothing but give me the same error.. =/ i can make a debug window and draw on it, just cant draw on smarts canvasThat's as far as I got as well before throwing up my hands and walking away. I have all the code for doing the drawing from old scripts, which I was trying to adapt to SCAR, but without the ability to get the object to draw on you're hooped. Quote Link to comment Share on other sites More sharing options...
Wanted Posted January 17, 2012 Share Posted January 17, 2012 It's actually very easy, I'll do it sometime Quote Link to comment Share on other sites More sharing options...
shadowrecon Posted January 17, 2012 Share Posted January 17, 2012 It's actually very easy, I'll do it sometime how do u assign the handle other than var SMART_Canvas: TBitmap; SMART_Canvas.canvas.handle := SmartGetDC; Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted January 21, 2012 Share Posted January 21, 2012 I think he misses the point: Code that should work (and does work with Simba) generates an access violation in SCAR. Using SMART with SCAR is different than using SMART with Simba somehow. Quote Link to comment Share on other sites More sharing options...
Wanted Posted January 21, 2012 Share Posted January 21, 2012 I think he misses the point: Code that should work (and does work with Simba) generates an access violation in SCAR. Using SMART with SCAR is different than using SMART with Simba somehow. That's incorrect, you guys just don't know how to do it. I've drawn on SMART plenty of times, so have many others... long before simba existed. Quote Link to comment Share on other sites More sharing options...
rsutton Posted January 21, 2012 Share Posted January 21, 2012 Agree w/ wanted. god there are MANY MANY examples out there. why is everyone having such problems. yet then again who even wants to spend that much effort on a bot like that. what are you producing 1 bot every 2 months ? Have to think about what your intentions are. making it look pretty or making it work well. If you try to do both your in for a very good bot, but expect high maintenance in the long run. Me, I make sure the bots work 100% and maybe maybe put a gui screen on em. Quote Link to comment Share on other sites More sharing options...
BryceTheCoder Posted January 21, 2012 Author Share Posted January 21, 2012 can you help me with this wanted please: under varialbes: Canvas: TCanvas; and my code: Canvas := GetBitmapCanvas(TempBMP); Canvas.Brush.Style := bsSolid; Canvas.Brush.Color := clBlack; Canvas.Pen.Color := clBlack; Canvas.Rectangle(309, 197, 422, 255); I get an error on my "TempBMP" Wut do i put TempBMP as? a variable of somesort ooorrr wuut? Quote Link to comment Share on other sites More sharing options...
mormonman Posted January 21, 2012 Share Posted January 21, 2012 program New; var bmp: Integer; canvas: TCanvas; begin bmp := BitmapFromString(50, 50, ''); Canvas := TCanvas.Create; Canvas := GetBitmapCanvas(bmp); Canvas.Brush.Color := clRed; Canvas.Rectangle(25, 25, 45, 45); DisplayDebugImgWindow(50, 50); DebugBitmap(bmp); end. Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted January 21, 2012 Share Posted January 21, 2012 program New; var bmp: Integer; canvas: TCanvas; begin bmp := BitmapFromString(50, 50, ''); Canvas := TCanvas.Create; Canvas := GetBitmapCanvas(bmp); Canvas.Brush.Color := clRed; Canvas.Rectangle(25, 25, 45, 45); DisplayDebugImgWindow(50, 50); DebugBitmap(bmp); end. I know you had good intentions but displaying a debug window is not the same thing as drawing on the SMART canvas. Displaying the debug window is easy and not what is being asked here. That's incorrect, you guys just don't know how to do it. I've drawn on SMART plenty of times, so have many others... long before simba existed.So have I. Unfortunately I don't have those scripts around anymore. The examples I can find generate access violations using the latest version of SCAR and SMART. I mean this in the nicest possible way when I say "put up or shut up". People are looking for a working example of how to get the SMART canvas and work with it. What they are getting instead is a lot of people saying "It's easy really but I'm not going to show you how to do it." Small wonder they are getting frustrated. Quote Link to comment Share on other sites More sharing options...
FHannes Posted January 21, 2012 Share Posted January 21, 2012 I'll look into the possibility that there's a bug in SCAR that causes this, but at the moment I can't test anything in SCAR due to something I'm working on which breaks pretty much everything until it's done. Quote Link to comment Share on other sites More sharing options...
rsutton Posted January 21, 2012 Share Posted January 21, 2012 There is ALOT more to do than you think, it is not just a simple 4 lines and call it good. You have along way to go bud. Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted January 21, 2012 Share Posted January 21, 2012 I'll look into the possibility that there's a bug in SCAR that causes this, but at the moment I can't test anything in SCAR due to something I'm working on which breaks pretty much everything until it's done.Too funny. It always seems to work out that way. Quote Link to comment Share on other sites More sharing options...
FHannes Posted January 21, 2012 Share Posted January 21, 2012 Too funny. It always seems to work out that way. That's what big internal rewrites will do for you Quote Link to comment Share on other sites More sharing options...
shadowrecon Posted January 21, 2012 Share Posted January 21, 2012 Agree w/ wanted. god there are MANY MANY examples out there. why is everyone having such problems. yet then again who even wants to spend that much effort on a bot like that. what are you producing 1 bot every 2 months ? Have to think about what your intentions are. making it look pretty or making it work well. If you try to do both your in for a very good bot, but expect high maintenance in the long run. Me, I make sure the bots work 100% and maybe maybe put a gui screen on em. This is incorrect as there are only about 3 ways to assign a handle to an object, either by locating the bitmap onscreen, using some function made for it(eg. GetSmartDc) or by windows size i think? And drawing on the canvas has many good possibilities as you can debug actively while running the script, print boxes around colors, show Tboxs ect alot of good useful information that in the long run can make a script that runs better with less downtime ---------- Post added at 05:10 PM ---------- Previous post was at 05:08 PM ---------- That's incorrect, you guys just don't know how to do it. I've drawn on SMART plenty of times, so have many others... long before simba existed. ive drawn on smart to back in the day, but it doesnt work anymore, we dont need lessons for drawing on it, we just need the canvas, I can draw on debug windows all day, but cant get the canvas handle for smart. This must require some weird way of getting other then the conventional way because the conventional ways report access errors within scar ---------- Post added at 05:14 PM ---------- Previous post was at 05:10 PM ---------- I think he misses the point: Code that should work (and does work with Simba) generates an access violation in SCAR. Using SMART with SCAR is different than using SMART with Simba somehow. i think everyone is missing the point, everyone keeps say oh its easy! a million ways to do it! but i dont see one person posting anything useful but comments on how its so easy.. lmao.. Quote Link to comment Share on other sites More sharing options...
Wanted Posted January 21, 2012 Share Posted January 21, 2012 Look, here's ancient 2 year old pre-simba code Timer wrote for POMS that with removing obvious things to make it work with OSI is STILL AFTER 2 YEARS working beautifully http://srlpoms.googlecode.com/svn/trunk/Includes/Debug.scar program New; {$DEFINE RS2} {$DEFINE OSI_Color_Anti_Randoms} {$DEFINE SMART} // Comment out to disable SMART {$I OSI\OSI.scar} {$I OSI\Divi\Misc\Debug.scar} procedure ScriptTerminate; begin FreeOSI; end; //By Timer var POMS_SCRIPT: string; POMS_VARIABLES: TStringArray; {$DEFINE POMS_DEBUG} procedure POMS_DebugLine(_text: string); begin {$IFNDEF LIMIT_TEXT} WriteLn('[' + STimeRunning + '] : ' + _text); {$ENDIF} end; procedure ClearSMARTCanvas; var SCanvas, Canvas: TCanvas; BMP, BMP2, I, II, III: Integer; TPA: TPointArray; begin try POMS_DEBUGLINE('Clearing SMART Canvas....'); BMP := BitmapFromString(765, 503, ''); SCanvas := GetBitmapCanvas(BMP); SCanvas.handle := SmartGetDebugDC; BMP2 := BitmapFromString(765, 503, ''); TPA := LoadTextTPA('POMS rev' + IntToStr(1), StatChars); for I := 0 to High(TPA) do FastSetPixel(BMP2, TPA[i].x + 25, TPA[i].y + 35, clWhite); TPA := LoadTextTPA(POMS_SCRIPT, StatChars); for I := 0 to High(TPA) do FastSetPixel(BMP2, TPA[i].x + 25, TPA[i].y + 45, clWhite); for II := 0 to High(POMS_VARIABLES) do begin TPA := LoadTextTPA(POMS_VARIABLES[iI], StatChars); for III := 0 to High(TPA) do FastSetPixel(BMP2, TPA[iII].x + 25, TPA[iII].y + 35 + ((II + 3) * 10), clWhite); end; Canvas := GetBitmapCanvas(BMP2); CopyCanvas(Canvas, SCanvas, 0, 0, 765, 503, 0, 0, 765, 503); FreeBitmap(BMP); FreeBitmap(BMP2); POMS_DEBUGLINE('Cleared SMART Canvas!!'); except end; end; procedure DebugTPA2(TPA: TPointArray); var SCanvas, Canvas: TCanvas; BMP, BMP2, I, Usless, II, III: Integer; TPAA: TPointArray; begin try POMS_DEBUGLINE('Found ' + IntToStr(Length(TPA)) + ' colours!'); POMS_DEBUGLINE('Debugging TPA!'); BMP := BitmapFromString(765, 503, ''); SCanvas := GetBitmapCanvas(BMP); SCanvas.handle := SmartGetDebugDC; BMP2 := BitmapFromString(765, 503, ''); for I := 0 to High(TPA) do FastSetPixel(BMP2, TPA[i].x, TPA[i].y, clRed); TPAA := LoadTextTPA('POMS rev' + IntToStr(1), StatChars); for I := 0 to High(TPAA) do FastSetPixel(BMP2, TPAA[i].x + 25, TPAA[i].y + 35, clWhite); TPAA := LoadTextTPA(POMS_SCRIPT, StatChars); for I := 0 to High(TPAA) do FastSetPixel(BMP2, TPAA[i].x + 25, TPAA[i].y + 45, clWhite); for II := 0 to High(POMS_VARIABLES) do begin TPAA := LoadTextTPA(POMS_VARIABLES[iI], StatChars); for III := 0 to High(TPAA) do FastSetPixel(BMP2, TPAA[iII].x + 25, TPAA[iII].y + 35 + ((II + 3) * 10), clWhite); end; Canvas := GetBitmapCanvas(BMP2); CopyCanvas(Canvas, SCanvas, 0, 0, 765, 503, 0, 0, 765, 503); FreeBitmap(BMP); FreeBitmap(BMP2); POMS_DEBUGLINE('Debuged TPA Successfully!'); except end; end; begin SetUpOSI; ClearSMARTCanvas; DebugTPA2(TPAFromBox(Box(0, 0, 100, 100))); end. (Make sure your smart says 'disable debug' and not 'enable debug' because otherwise you won't see anything) Have ye ole leader some faith Quote Link to comment Share on other sites More sharing options...
shadowrecon Posted January 21, 2012 Share Posted January 21, 2012 Look, here's ancient 2 year old pre-simba code Timer wrote for POMS that with removing obvious things to make it work with OSI is STILL AFTER 2 YEARS working beautifully http://srlpoms.googlecode.com/svn/trunk/Includes/Debug.scar program New; {$DEFINE RS2} {$DEFINE OSI_Color_Anti_Randoms} {$DEFINE SMART} // Comment out to disable SMART {$I OSI\OSI.scar} {$I OSI\Divi\Misc\Debug.scar} procedure ScriptTerminate; begin FreeOSI; end; //By Timer var POMS_SCRIPT: string; POMS_VARIABLES: TStringArray; {$DEFINE POMS_DEBUG} procedure POMS_DebugLine(_text: string); begin {$IFNDEF LIMIT_TEXT} WriteLn('[' + STimeRunning + '] : ' + _text); {$ENDIF} end; procedure ClearSMARTCanvas; var SCanvas, Canvas: TCanvas; BMP, BMP2, I, II, III: Integer; TPA: TPointArray; begin try POMS_DEBUGLINE('Clearing SMART Canvas....'); BMP := BitmapFromString(765, 503, ''); SCanvas := GetBitmapCanvas(BMP); SCanvas.handle := SmartGetDebugDC; BMP2 := BitmapFromString(765, 503, ''); TPA := LoadTextTPA('POMS rev' + IntToStr(1), StatChars); for I := 0 to High(TPA) do FastSetPixel(BMP2, TPA[i].x + 25, TPA[i].y + 35, clWhite); TPA := LoadTextTPA(POMS_SCRIPT, StatChars); for I := 0 to High(TPA) do FastSetPixel(BMP2, TPA[i].x + 25, TPA[i].y + 45, clWhite); for II := 0 to High(POMS_VARIABLES) do begin TPA := LoadTextTPA(POMS_VARIABLES[iI], StatChars); for III := 0 to High(TPA) do FastSetPixel(BMP2, TPA[iII].x + 25, TPA[iII].y + 35 + ((II + 3) * 10), clWhite); end; Canvas := GetBitmapCanvas(BMP2); CopyCanvas(Canvas, SCanvas, 0, 0, 765, 503, 0, 0, 765, 503); FreeBitmap(BMP); FreeBitmap(BMP2); POMS_DEBUGLINE('Cleared SMART Canvas!!'); except end; end; procedure DebugTPA2(TPA: TPointArray); var SCanvas, Canvas: TCanvas; BMP, BMP2, I, Usless, II, III: Integer; TPAA: TPointArray; begin try POMS_DEBUGLINE('Found ' + IntToStr(Length(TPA)) + ' colours!'); POMS_DEBUGLINE('Debugging TPA!'); BMP := BitmapFromString(765, 503, ''); SCanvas := GetBitmapCanvas(BMP); SCanvas.handle := SmartGetDebugDC; BMP2 := BitmapFromString(765, 503, ''); for I := 0 to High(TPA) do FastSetPixel(BMP2, TPA[i].x, TPA[i].y, clRed); TPAA := LoadTextTPA('POMS rev' + IntToStr(1), StatChars); for I := 0 to High(TPAA) do FastSetPixel(BMP2, TPAA[i].x + 25, TPAA[i].y + 35, clWhite); TPAA := LoadTextTPA(POMS_SCRIPT, StatChars); for I := 0 to High(TPAA) do FastSetPixel(BMP2, TPAA[i].x + 25, TPAA[i].y + 45, clWhite); for II := 0 to High(POMS_VARIABLES) do begin TPAA := LoadTextTPA(POMS_VARIABLES[iI], StatChars); for III := 0 to High(TPAA) do FastSetPixel(BMP2, TPAA[iII].x + 25, TPAA[iII].y + 35 + ((II + 3) * 10), clWhite); end; Canvas := GetBitmapCanvas(BMP2); CopyCanvas(Canvas, SCanvas, 0, 0, 765, 503, 0, 0, 765, 503); FreeBitmap(BMP); FreeBitmap(BMP2); POMS_DEBUGLINE('Debuged TPA Successfully!'); except end; end; begin SetUpOSI; ClearSMARTCanvas; DebugTPA2(TPAFromBox(Box(0, 0, 100, 100))); end. (Make sure your smart says 'disable debug' and not 'enable debug' because otherwise you won't see anything) Have ye ole leader some faith You are the Fucking man! (Sorry had to make it clear your the shit, a fellow Texan Now i think i see what you were doing is using the GetSmartDebugDC for the handle instead of GetSmartDc... which i think is where everyone problem lied. Thanks Man, i will be kicking back and playing with this for the rest of the weekend! Quote Link to comment Share on other sites More sharing options...
FHannes Posted January 21, 2012 Share Posted January 21, 2012 Using GetSmartDC wouldn't be a problem, you'd just be drawing onto the canvas you should use for searching, it wouldn't throw an error because of that. I thought it was obvious you have to use GetSmartDebugDC though, I guess I should've mentioned that. Quote Link to comment Share on other sites More sharing options...
shadowrecon Posted January 21, 2012 Share Posted January 21, 2012 yeah i guess but its all good now, and im loving this =) so much useful info can can be printed actively not to include make things look a little better =)look the road colors lit up like some thing .. lol you can clearly see where its finding active colors ect. this is an awesome addition! [ATTACH=CONFIG]230[/ATTACH] Quote Link to comment Share on other sites More sharing options...