Jump to content
kyocera

Need help with my first script, help with a few lines of code

Recommended Posts

Hey I'm working with a script it's not mine, but I'm pretty much rewriting the whole thing. This is my first script so I was just gonna copy someone elses, but hand write the whole thing add my functions my variables etc etc...

 

There's a few lines of codes I don't understand so I'll post them here and I was hoping someone could explain to me what they do and when I use them.

 

I'm not sure if there's a guide all ready if there is please refer me to that post.

 

1.) he set the variable "ms" as a global variable is this a common variable? I found "MS1, MS2" are those the same things?

 

2.)"tmpCTS := GetColorToleranceSpeed;

ColorToleranceSpeed(2);

SetColorSpeed2Modifiers(0.23, 0.45);" duhhh fuhhh???

 

3.)"SetColorSpeed2Modifiers(0.2, 0.2)"

 

4.)" SortTPAFrom(arP, Point(MSCX, MSCY));

ararP := SplitTPAEx(arP, 10, 10);

arL := High(ararP);"

 

5.)

function AutoColor2: Integer;

var

arP: TPointArray;

arC: TIntegerArray;

tmpCTS, i, arL: Integer;

R, G, B: Integer;

begin

tmpCTS := GetColorToleranceSpeed;

ColorToleranceSpeed(0);

 

if not (FindColorsTolerance(arP, 6920667, 0, 0, 764, 502, 0)) then

begin

Writeln('Failed to find the color, no result.');

ColorToleranceSpeed(tmpCTS);

GEUP := 1;

Exit;

end;

 

I don't get that whole function lol ^ I mean I know it's find the item to buy, but that's all I know.

 

5.) " arC := GetColors(arP);

ClearSameIntegers(arC);

arL := High(arC); "

 

what's dat ^ O.o

 

6.)"ColorToRGB(arC, R, G, B); "

 

I'm more of an XHTML guy, so I'm guessing that sends a color already specified to the RGB triplet colors? What's arC though

 

7.)"TypeSendEx(Item2Buy,True) "

 

That's it this is not my script I give credit to inf3ctious over at Simba. They're offline at the moment for me or I would of posted there.

Link to comment
Share on other sites

First let me say indenting. Use it, it's a beautiful thing. Seriously, my eyes bled a little trying to read that.

 

1.) You haven't included that part, so going by what you've posted: ms is a global variable available for use throughout the script. No comment on MS1 and MS2; const he has defined maybe?

 

2.) He is switching color finding method here. First he gets the current color finding method (GetColorToleranceSpeed) so he can restore it back after, then is setting things up to use CTS 2. (Yeah I know this is named horribly: ColorToleranceSpeed = Color finding method. WTH?)

 

3.) See #2

 

4.) He is sorting an array of screen coords (points) by their distance from another point (SortTPAFrom). In this case screen center (MSCX, MSCY). Then he is splitting that original array into a 2 dimensional array based on how close together/far apart each point is from it's neighboring points in the list. In this case using a distance of 10 as the criteria for splitting it up.

 

5.) GetColors returns the color(s) found at every point in the array arP, which is an array variable containing TPoints (screen coords), and stores the result in the array variable arC. ClearSameIntegers removes the duplicates from the array, and again he uses High to find out how long the array is.

 

6.) arC would refer to the ith element of array arC. i is likely a loop counter. Function called takes a color value (Ex: 1237824) and converts it to RGB values.

 

7.) Item2Buy would be a String variable I'm guessing. TypeSendEx simply sends that string to the client as if the user were typing into the game.

 

To sum it up you may want to spend some time reading some beginner tutorials on how to script. You need to learn the basics before tackling anything more complicated.

Edited by Bixby Sayz
Link to comment
Share on other sites

First let me say indenting. Use it, it's a beautiful thing. Seriously, my eyes bled a little trying to read that.

 

1.) You haven't included that part, so going by what you've posted: ms is a global variable available for use throughout the script. No comment on MS1 and MS2; const he has defined maybe?

 

2.) He is switching color finding method here. First he gets the current color finding method (GetColorToleranceSpeed) so he can restore it back after, then is setting things up to use CTS 2. (Yeah I know this is named horribly: ColorToleranceSpeed = Color finding method. WTH?)

 

3.) See #2

 

4.) He is sorting an array of screen coords (points) by their distance from another point (SortTPAFrom). In this case screen center (MSCX, MSCY). Then he is splitting that original array into a 2 dimensional array based on how close together/far apart each point is from it's neighboring points in the list. In this case using a distance of 10 as the criteria for splitting it up.

 

5.) GetColors returns the color(s) found at every point in the array arP, which is an array variable containing TPoints (screen coords), and stores the result in the array variable arC. ClearSameIntegers removes the duplicates from the array, and again he uses High to find out how long the array is.

 

6.) arC would refer to the ith element of array arC. i is likely a loop counter. Function called takes a color value (Ex: 1237824) and converts it to RGB values.

 

7.) Item2Buy would be a String variable I'm guessing. TypeSendEx simply sends that string to the client as if the user were typing into the game.

 

To sum it up you may want to spend some time reading some beginner tutorials on how to script. You need to learn the basics before tackling anything more complicated.

 

thanks, and i do indent I mostly do XHTML, javascript, and I've learned a little VB. That wasn't my code so don't blame me :P

 

Thanks for the help, yes I've been reading lots of TUTs. You learn way more with hands on experience rather then practicing random TUT scripts. Again thanks a lot, I spent a little more time over the code while I was waiting for someone to reply and I understood a lot more then when I posted so sorry for some of the stupid questions like number 7 :).

 

======================

 

so number 6

 

6.) arC would refer to the ith element of array arC. i is likely a loop counter. Function called takes a color value (Ex: 1237824) and converts it to RGB values

 

"ColorToRGB(arC, R, G, B);"

 

Is just how you set up sending a color to RGB?

In other words you can't just do (arC, R, G , B); or ColorToRGB but all of them together?

 

number 1

 

ms := mousespeed; can you do that?? lol

 

gotta go, I will post more questions later if no one minds :)

Edited by kyocera
Link to comment
Share on other sites

Is just how you set up sending a color to RGB?

In other words you can't just do (arC, R, G , B); or ColorToRGB but all of them together?

 

number 1

 

ms := mousespeed; can you do that?? lol

Not sure I understand the question on RGB. SCAR uses an integer number to represent colors. If you are used to dealing with colors as RGB or HSL that number doesn't really mean a lot to you. Depending on the application the scripter might convert it back to RGB (unless I have a reason to do so I never do).

 

In this example he is calling the function ColorToRGB that does that conversion. It expects 4 parameters: The color to be converted passed in, and it will pass out the RGB values that correspond to that color value. So yes you have to use them all together. But again unless you have a reason to convert it to RGB why bother?

 

Not sure on the mousespeed functions built into SCAR. I generally leave it alone. Never had a ban/blackmark yet after years of botting. Sometimes you can be too clever with your script.

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.

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.



×
  • Create New...