Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

A Starcraft Broodwar Script V1.3b


  • Please log in to reply
42 replies to this topic
000sixzeros000
  • Members
  • 43 posts
  • Last active: Apr 23 2011 08:11 AM
  • Joined: 17 Oct 2009
the SC bounding rect.. is ahh.. not a rect.. it's not even a parallelogram, quadralateral perhaps (rhombus?) where the longest side has the highest elevation.

personally, I found the adjustable camera viewpoint, rendundant, it just gives it a flashy feel, if there is a way to force maximum elevation, that would be the go.. (I figure maybe sending mousewheel commands to scroll backwards, and then redirecting the mousewheel to our own purposes)

Enter_User_Name_Here
  • Members
  • 35 posts
  • Last active: Jan 19 2012 07:40 PM
  • Joined: 18 Apr 2010
You should still be able to find all 4 corners. Top two are easy enough.

If it is symmetrical about a vertical axis, then you only need to follow one "leg" down to the bottom. So given (X,Y) for top left corner...

something like this?

FindBottomLeftCorner(X, Y, ByRef CornerX, ByRef CornerY)
{
  global MaxPixelsInLeg
  while (1) {
    LineY := Y + 1
    LineX := X - Xoffset
    LineCount := 0
    while (LineX <= (X + Xoffset))  {
      PixelGetColor, color, LineX,LineY, RGB
      if (color = 0xFFFFFF) {
        LineCount += 1
        if (LineCount = 1) {
          CornerX := LineX
        }
      }
      LineX += 1
    }
    if (LineCount > MaxPixelsInLeg) { ;in case the leg is wider than 1 pixel
      CornerY := LineY
      break
    }
  }
}
return


000sixzeros000
  • Members
  • 43 posts
  • Last active: Apr 23 2011 08:11 AM
  • Joined: 17 Oct 2009
well you cant count on there being any straight lines, about all you can count on is that the inner angles will add up to 360 degrees...

and the top left corner, will at least have two lines extending from it.. but those lines could have any kind of slope.

so if you can work out the angle of the top left corner.. then trace the sloped top line to find the top right corner.. then trace the slope of the left line to find the bottom left corner.. then work out the angles of those corners.. you have your last corner... (most likely).. and from there you can work out a center. lol.. its one of those 3d graphics problems that require digging out the 'ol trig school books. Or you could just do away with the angles and radians, and just fudge it somehow..

 assuming we have found the top left pixel...

 nextX =  
    checkX+1,y-1  y/n?
    checkX+1,y     y/n?
    checkX+1,y+1 y/n?
       width+=1

 nextY =  
    checkY+1,X-1     y/n?
    checkY+1,X        y/n?
    checkY+1,X+1    y/n?
       hieght+=1

you might need to add some kind of bresenham style slope tracker.. so (Xslope/width)*radians gives you an angle..(or something like that)
    checkY+1,X-1     y/n?
       if Yes, Xslope-=1
    checkY+1,X        y/n?
    checkY+1,X+1    y/n?
       if Yes, Xslope+=1

hmm.. actaully... I'd say we could probably trace all 4 sides.. and then take an average of the widths and heights / 2 , and that would give us a near enough center point.

Enter_User_Name_Here
  • Members
  • 35 posts
  • Last active: Jan 19 2012 07:40 PM
  • Joined: 18 Apr 2010
In the pictures I have seen it looks like the bottom is always horizontal. If that's true then you can start with the bottom two corners.

Enter_User_Name_Here
  • Members
  • 35 posts
  • Last active: Jan 19 2012 07:40 PM
  • Joined: 18 Apr 2010
I thought of a handy feature but not one that I know how to fully implement.

Ping the map (to allies). Makes for easier partner communication.

My thoughts so far are this:

Transmitting and receiving the mini-map coordinates:

1) the messaging system within BW

2) TCP/IP communication (for instance http://www.autohotke...pic.php?t=13829 )

"Displaying" the mini-map ping:

1) we constantly display mouse location on screen so that the receiving players can know where to click the mini-map

2) we develop automatic message reading and either automatically click the mini-map or save the location until the user triggers it

3) get an overlay of some type working to display a graphic in the correct location


Any ideas?

JackDoe
  • Guests
  • Last active:
  • Joined: --
Do you have one to for Starcraft 2?

  • Guests
  • Last active:
  • Joined: --
Not really, no. I don't have access to SC 2. I can't guarantee that the pixel searches are anywhere near where they should be.

Has anyone else been using this for BW?

Awesome Flying Pinguin
  • Guests
  • Last active:
  • Joined: --
I'm a beginning SC2 player (but i'm medium at warcraft 3 and I'm almost done with practice league).
In the past I've made several autohotkey based programs with my best one being a World of Warcraft bot that relied on calculation and screen colours for it's movements and actions.
Now I've tried making a warcraft 3 script that would aid me in macro and though it wasn't bad at all it wasn't flexible enough, gave it up really early too though.

I was planning on making an autohotkey macro for spawning larva with the queens and since I always search the net to see if somedone was first that's how I came across this post.

I'm sure pixels won't be a problem, at the lowest quality without lighting it'll work like a charm and since I try to avoid lag that's the quality I play. Game still looks nice though.

I'm sure that with a bit of work I could adapt this script to SC2 but when I look at it I get that feeling of infinity xD I don´t know where to begin (apart from my own script for the larva macro ofc) though I understand most of it when reading it(good commentflagging btw) perhaps any tips from the maker to where to start?

Enter_User_Name_Here
  • Members
  • 35 posts
  • Last active: Jan 19 2012 07:40 PM
  • Joined: 18 Apr 2010

I was planning on making an autohotkey macro for spawning larva with the queens and since I always search the net to see if somedone was first that's how I came across this post.

I'm sure pixels won't be a problem, at the lowest quality without lighting it'll work like a charm and since I try to avoid lag that's the quality I play. Game still looks nice though.

I'm sure that with a bit of work I could adapt this script to SC2 but when I look at it I get that feeling of infinity xD I don´t know where to begin (apart from my own script for the larva macro ofc) though I understand most of it when reading it(good commentflagging btw) perhaps any tips from the maker to where to start?


I am not the original creator (thanks again 000sixzeros000), but I did a healthy re-write of the original. Now that I have Starcraft 2, I can tell you that the method for determining where the player's map position is using the mini-map will not work correctly. As discussed above, the rectangle has become a quadrilateral that changes based on elevation... you can not just find one corner of the mini-map rectangle you must find all 4. From this you might be able to calculate screen position for "remembered" locations as in the original script.

I do believe that you could get some of the functionality of the original script (cycling through control groups, for instance -- but then again you really don't NEED to in SC 2). Really, most of the functionality of this script is already in SC 2. What are you missing? The numpad hotkeys -- which personally I never used on my laptop (no numpad)...? My desire to write a performance enhancing script for SC 2 has dropped considerably now that I have played it -- all of the quirky things in SC:BW have been addressed. And now they might ban you from BNET if you use helper programs if you read your user agreement (I would suggest only using it in offline mode - if you do use something like it.)

As for scripting queen larvae, you would need to develop a method for map placement (or to use specific control groups for hatches -- and use the control group to center the hatchery) and then a method for selecting a nearby queen (image search? -- performance?, control group for all your queens? -- might cause problems when one of them doesn't have enough energy and you start having migrating queens, a control group for specific queens... starting to run out of control groups...)

Awesome Flying Pinguin
  • Guests
  • Last active:
  • Joined: --
thanks for the quick response =)
well actually all pro players do this:
1. Line up all the spit larva timing. You want to make sure you can do everything at once and that all the hatcheries are synchronized with another.

2. Hotkey all your hatchery to a control group. Next, hotkey all the queens (just 1 per hatch) to another control group.

You want to hit the control group for queen, click v (spit larva), hold shift, hit backspace (returns the screen to a hatchery) and click on the hatchery. While holding shifting, you want to press backspace and click on every single hatchery that comes up.


Enter_User_Name_Here
  • Members
  • 35 posts
  • Last active: Jan 19 2012 07:40 PM
  • Joined: 18 Apr 2010

thanks for the quick response =)
well actually all pro players do this:
1. Line up all the spit larva timing. You want to make sure you can do everything at once and that all the hatcheries are synchronized with another.

2. Hotkey all your hatchery to a control group. Next, hotkey all the queens (just 1 per hatch) to another control group.

You want to hit the control group for queen, click v (spit larva), hold shift, hit backspace (returns the screen to a hatchery) and click on the hatchery. While holding shifting, you want to press backspace and click on every single hatchery that comes up.


Then the only aspect of the original program you need to work is the ability to count the number of units/buildings in a group. (Unless you want the script to automatically return your map position to where it was before you ran it.) I would think the rest of the key presses would be fairly straightforward. To be honest, I was unaware of the backspace key functionality in SC 2.

Awesome Flying Pinguin
  • Guests
  • Last active:
  • Joined: --
Ironically enough you would've known about it if you had read the documentation ;)

Thanks for the reply I really appreciate the help, meanwhile I've made a simple yet effective script with a sound that plays after the larva spawn (the timing is different depending on game speed). I won't post it as I know how the guys from the Warden(WoW) search the internet for bots and stuff and I'm afraid they'd do that for sc2, but I'm happy to send it to anyone who wants it by e-mail.

I do have a problem with migrating queens if I hit the key more times than I have queens but a quick S press cancels the move and fixes this problem.
Though I could solve this by placing the hatcheries with queens on another hotkey and selecting the hatchery's with mouseclicks from that group.

Multigamer
  • Members
  • 9 posts
  • Last active:
  • Joined: 26 Feb 2014

Thx a Lot.