Jump to content
Sign in to follow this  
ondrajka

Subscript Nesting

Recommended Posts

ondrajka

I am looking for a function to help with clutter in my script.

I have a cluster of 47 lines that I have cut and pasted several times.

What I want to do is nest them under something like an array and just call for the array and have it execute my nested commands.

i.e.

Subscript[1]Start

$min=PixelGetColor($x,$y)

$trig=PixelGetColor($x+$per,$y)

$trig2=PixelGetColor($x+$per2,$y)

If $min<>2100491 And $trig2=2888206 OR $min<>2100491 And $trig=2888206 Then $gh=$gh+1

Subscript[1]End

So if I wanted to run the above 4 lines i could just use a command like.

Run Subscript[1]

Share this post


Link to post
Share on other sites
Valuater

Maybe...

_Subscript()

Func _Subscript()
    $min = PixelGetColor($x, $y)
    $trig = PixelGetColor($x + $per, $y)
    $trig2 = PixelGetColor($x + $per2, $y)
    If $min <> 2100491 And $trig2 = 2888206 Or $min <> 2100491 And $trig = 2888206 Then $gh = $gh + 1
EndFunc   ;==>Subscript

; or

_Subscript2(12, 22, 1, 1)

Func _Subscript2($x, $y, $per, $per2, $gh = 1)
    $min = PixelGetColor($x, $y)
    $trig = PixelGetColor($x + $per, $y)
    $trig2 = PixelGetColor($x + $per2, $y)
    If $min <> 2100491 And $trig2 = 2888206 Or $min <> 2100491 And $trig = 2888206 Then $gh = $gh + 1
EndFunc   ;==>Subscript

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×