View Full Version : Need help!!!
krazytamalez
09-19-2012, 06:26 AM
I don't know why this is happening to me i freed the dtm but im still getting this error somebody please help me!!
Exception: The given DTM Index[0] doesn't exist at line 38
Le Jingle
09-19-2012, 06:33 AM
You freed the DTM one to many times. That is saying that there is no existent DTM for the script to use, therein when you try to find a dtm and it does not exist, you receive that Exception.
Either post code or figure out how to utilize DTM's (ex. the tutorial section) for fixing.
krazytamalez
09-19-2012, 05:19 PM
program ratkiller;
{$i SRL/SRL.simba}
var
Rat,x,y:Integer;
const
GoldCharm = 4746624;
Procedure Attackrats;
begin
SetupSrl;
Rat:= DTMFromString('mbQAAAHicY2VgYOhjZGDoAeIOIJ4MxP1AHA HE7kAcBmUnA3F1eRFDU30Vw5QJXQwL5kxlKC/OZfjPgAkYsWAwAABviw09');
if srl_infight = false then
if FindDTM(x, y, Rat, MSX1, MSY1, MSX2, MSY2)then
begin
Mouse(x, y, 3, 3, True);
wait(500)
end;
end;
Procedure Pickupdrop;
begin
if srl_infight = false then
if(FindColorSpiralTolerance(x, y, GoldCharm, MSX1, MSY1, MSX2, MSY2, 5))then
begin Mouse(x, y, 5, 5, true); //If found will Left-Click on the x, y coordinates with a randomness between 5 pixelend
end;
end;
procedure main;
begin
repeat
Attackrats;
Pickupdrop;
until(false)
end;
begin
ClearDebug;
SetUpSrl;
ActivateClient;
freedtm(Rat);
main;
end.
This is it i can't see whats the problem
Footy
09-19-2012, 05:25 PM
You need to free the ratDTM in the same procedure, or make the rat DTM variable global.
krazytamalez
09-19-2012, 05:30 PM
Can you explain how to do that sorry only my second day scripting ^,^
krazytamalez
09-19-2012, 05:32 PM
program ratkiller;
{$i SRL/SRL.simba}
var
Rat,x,y:Integer;
const
GoldCharm = 4746624;
Procedure Attackrats;
begin
SetupSrl;
Rat:= DTMFromString('mbQAAAHicY2VgYOhjZGDoAeIOIJ4MxP1AHA HE7kAcBmUnA3F1eRFDU30Vw5QJXQwL5kxlKC/OZfjPgAkYsWAwAABviw09');
if srl_infight = false then
if FindDTM(x, y, Rat, MSX1, MSY1, MSX2, MSY2)then
begin
Mouse(x, y, 3, 3, True);
wait(500)
freedtm(Rat);
end;
end;
Procedure Pickupdrop;
begin
if srl_infight = false then
if(FindColorSpiralTolerance(x, y, GoldCharm, MSX1, MSY1, MSX2, MSY2, 5))then
begin Mouse(x, y, 5, 5, true); //If found will Left-Click on the x, y coordinates with a randomness between 5 pixelend
end;
end;
procedure main;
begin
repeat
Attackrats;
Pickupdrop;
until(false)
end;
begin
ClearDebug;
SetUpSrl;
ActivateClient;
main;
end.
like that?
Footy
09-19-2012, 05:32 PM
Move freedtm(rat); to the line before the end of the procedure that uses that DTM. This isn't the best way to do it, but it will work.
krazytamalez
09-19-2012, 05:35 PM
SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap]
This is what i get now ;(
Le Jingle
09-19-2012, 06:02 PM
As per PM request:
Not a bad script for a first time user. Granted it's simplicity, I'd say you are on a good path to learning the basics. I commented in some code to help give a better idea of what's going on. Hope this helps;
program ratkiller;
{$i SRL/SRL.simba}
var
Rat,x,y:Integer;
const
GoldCharm = 4746624;
// since we will probably use this DTM often, we'll just load it once, which should use less memory in the long run.. (good practice)
procedure SetScriptDTMs;
begin
Rat := DTMFromString('mbQAAAHicY2VgYOhjZGDoAeIOIJ4MxP1AHA HE7kAcBmUnA3F1eRFDU30Vw5QJXQwL5kxlKC/OZfjPgAkYsWAwAABviw09');
end;
// and free it once when the script is over.
procedure FreeScriptDTMs;
begin
FreeDTM(Rat);
end;
Procedure Attackrats;
begin
if (not srl_InFight) then // not is a better way to say that we're looking for a false result of a boolean function (the function srl_infight)
if FindDTM(x, y, Rat, MSX1, MSY1, MSX2, MSY2) then
begin
Mouse(x, y, 3, 3, True);
wait(500+random(100)); // a additive of randomness that won't get you banned as fast..
end;
end;
Procedure Pickupdrop;
begin
if (not srl_InFight) then
if (FindColorSpiralTolerance(x, y, GoldCharm, MSX1, MSY1, MSX2, MSY2, 5)) then
Mouse(x, y, 5, 5, true); //If found will Left-Click on the x, y coordinates with a randomness between 5 pixels
end;
procedure main;
begin
repeat
FindNormalRandoms; // this is useful (until random events are removed from RS - which is supposed to be soon..) to make sure we do not continue if we hit a random event.
Attackrats;
Pickupdrop;
until(not(loggedin)); // Makes sense that we'll stop once we're not loggedin rather than until 'false'..
end;
begin
SetupSRL; // Placed SetupSRL; here, as it makes more sense in a novice who is learning - You only need to call this once, at the start of the script.
ActivateClient;
ClearDebug;
SetScriptDTMs; // sets the rat dtm at the very stary, this will be able to be used throughout the scripts duration
AddOnTerminate('FreeScriptDTMs'); // when the script stops, it will free the dtm setup earlier, at the scripts' start.
main;
end.
krazytamalez
09-19-2012, 06:11 PM
Thank you very much :0 saved my brain from exploding digging in forums for hours :D
krazytamalez
09-19-2012, 06:14 PM
Well now i have another problem it says successfully executed but nothing happened -.-
Le Jingle
09-19-2012, 06:38 PM
Well now i have another problem it says successfully executed but nothing happened -.-
I'd imagine this is caused due to lack of fail safes in your checking for rats. I mean this as a learning experience, not an insult, however you simply ask to find the DTM (on the rs main screen) which doesn't pan out, as you've stated, because it's only looking for a Deformed Template Model. If you want more accuracy on Main Screen Finding, using something like your Pickupdrop; procedure would have a better shot that the Attackrats; procedure. I tend to use DTM's for static-like images, and TPA's for main screen and changing images as you have much more tools to work with in order to obtain precisely what you need. Tutorials are your friend in this case :)
krazytamalez
09-19-2012, 06:47 PM
Thanks for your advice might need to look for some more tutorials been watching yohojo for like 12 hours straight l0l!! but anyways yeah i had used the findcolorspiral tolerance and got the color of the rat but since the walls were black it was clicking the walls -.- gunna take a break.
Jakkle
09-20-2012, 04:30 PM
Thanks for your advice might need to look for some more tutorials been watching yohojo for like 12 hours straight l0l!! but anyways yeah i had used the findcolorspiral tolerance and got the color of the rat but since the walls were black it was clicking the walls -.- gunna take a break.
Keep searching for the most unique colour on the rat.
You would be better off with using a TPA finding method for the rat and also would help with finding the charms even tho they should be easy enough to find. Your doing well, keep up the effort and it will pay off :)
Edit: To find the colours and check to see how where it finds the colours on the screen use this great tool ACA found here http://villavu.com/forum/showthread.php?t=26944
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.