Automating Shopping Bot using VB6

An automated shopping program for a game.

Page 1 of 1

6 Replies - 1656 Views - Last Post: 23 May 2009 - 01:34 PM Rate Topic: -----

#1 pengis  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 22-May 09

Automating Shopping Bot using VB6

Posted 22 May 2009 - 02:02 PM

Hello. I'm new to programming and am trying to make what I thought was going to be a simple automating shopping bot.

This program has a few tasks it needs to perform.
1)It needs to click on an NPC.
2)It needs to check for the variables I specify on items in the shop.
3)If the variables are found it needs to click on said item and a yes button.
4)If the item(s) are purchased or the variables are not found it needs to close the shop window.
5)It needs to sleep for a specified amount of time before repeating everything.

Here's what I have so far:
Private Sub Command1_Click()

End Sub

Private Sub Combo3_Change()

End Sub

Private Sub atype_Change()

End Sub

Private Sub a1_Click()

If atype.ListIndex = -1 Then Exit Sub

chose1.AddItem atype.Text
atype.RemoveItem atype.ListIndex

End Sub

Private Sub a2_Click()

If ael.ListIndex = -1 Then Exit Sub

chose1.AddItem ael.Text
ael.RemoveItem ael.ListIndex

End Sub

Private Sub a3_Click()

If atype.ListIndex = -1 Then Exit Sub

chose1.AddItem asuf.Text
asuf.RemoveItem asuf.ListIndex

End Sub

Private Sub a4_Click()

If atype.ListIndex = -1 Then Exit Sub

chose2.AddItem wel.Text
wel.RemoveItem wel.ListIndex

End Sub

Private Sub a5_Click()

If atype.ListIndex = -1 Then Exit Sub

chose2.AddItem wsuf.Text
wsuf.RemoveItem wsuf.ListIndex

End Sub

Private Sub Form_Load()

With atype
.AddItem "Leather"
.AddItem "Wooden"
.AddItem "Chain"
.AddItem "Copper"
.AddItem "Bronze"
.AddItem "Iron"
.AddItem "Cloth"
.AddItem "Pupil"
.AddItem "Desert"
.AddItem "Berserker"
.AddItem "Viking"
.AddItem "Gladiator"
.AddItem "Blood"
.AddItem "Initiate"
.AddItem "Traveler"
.AddItem "Thief"
.AddItem "Rogue"
.AddItem "Novice"
.AddItem "Apprentice"
.AddItem "Druidic"
.AddItem "Shaman"
.AddItem "Conjuror"
.AddItem "Wizard"


End With

With ael
.AddItem "All"
.AddItem "Sand"
.AddItem "Earth"
.AddItem "Granite"
.AddItem "Rock"
.AddItem "Air"
.AddItem "Breeze"
.AddItem "Gust"
.AddItem "Wind"
.AddItem "Flame"
.AddItem "Burn"
.AddItem "Fire"
.AddItem "Inferno"
.AddItem "Aqua"
.AddItem "Water"
.AddItem "Wave"
.AddItem "Tidal"
.AddItem "Cold"
.AddItem "Snow"
.AddItem "Frost"
.AddItem "Ice"
.AddItem "Shock"
.AddItem "Zap"
.AddItem "Volt"
.AddItem "Lightning"
.AddItem "Shadow"
.AddItem "Dark"
.AddItem "Shade"
.AddItem "Unholy"
.AddItem "Bright"
.AddItem "Light"
.AddItem "Radiant"
.AddItem "Gleaming"
.AddItem "Poison"
.AddItem "Taint"
.AddItem "Bio"
.AddItem "Venom"
.AddItem "Alleviation"
.AddItem "Soothe"
.AddItem "Remedy"
.AddItem "Pure"
End With

With asuf
.AddItem "Thorns"
.AddItem "Spikes"
.AddItem "Razors"
.AddItem "Ages"
.AddItem "Ease"
.AddItem "Sapling"
.AddItem "Vine"
.AddItem "Oak"
.AddItem "Spirit"
.AddItem "Soul"
.AddItem "Wanderer"
.AddItem "Wayfarer"
.AddItem "Pacing"
.AddItem "Haste"
.AddItem "Speed"
.AddItem "Jackal"
.AddItem "Fox"
.AddItem "Wolf"
.AddItem "Tiger"
.AddItem "Newt"
.AddItem "Frog"
.AddItem "Lizard"
.AddItem "Snake"
.AddItem "Snail"
.AddItem "Tortoise"
.AddItem "Feather"
.AddItem "Wings"
End With

With wel
.AddItem "All"
.AddItem "Sand"
.AddItem "Earth"
.AddItem "Granite"
.AddItem "Rock"
.AddItem "Air"
.AddItem "Breeze"
.AddItem "Gust"
.AddItem "Wind"
.AddItem "Flame"
.AddItem "Burn"
.AddItem "Fire"
.AddItem "Inferno"
.AddItem "Aqua"
.AddItem "Water"
.AddItem "Wave"
.AddItem "Tidal"
.AddItem "Cold"
.AddItem "Snow"
.AddItem "Frost"
.AddItem "Ice"
.AddItem "Shock"
.AddItem "Zap"
.AddItem "Volt"
.AddItem "Lightning"
.AddItem "Shadow"
.AddItem "Dark"
.AddItem "Shade"
.AddItem "Unholy"
.AddItem "Bright"
.AddItem "Light"
.AddItem "Radiant"
.AddItem "Gleaming"
.AddItem "Poison"
.AddItem "Taint"
.AddItem "Bio"
.AddItem "Venom"
.AddItem "Alleviation"
.AddItem "Soothe"
.AddItem "Remedy"
.AddItem "Pure"
End With

With wsuf
.AddItem "Blundering"
.AddItem "Leech"
.AddItem "Locust"
.AddItem "Bat"
.AddItem "Wraith"
.AddItem "Ages"
.AddItem "Bear"
.AddItem "Ease"
.AddItem "Magus"
.AddItem "Rabbit"
.AddItem "Cheetah"
End With











End Sub

Private Sub m1_Click()

If atype.ListIndex = -1 Then Exit Sub

m1.AddItem atype.Text
atype.RemoveItem atype.ListIndex

End Sub

Private Sub r1_Click()

If chose1.ListIndex = -1 Then Exit Sub

atype.AddItem chose1.Text
chose1.RemoveItem chose1.ListIndex


End Sub

Private Sub r2_Click()

If chose1.ListIndex = -1 Then Exit Sub

ael.AddItem chose1.Text
chose1.RemoveItem chose1.ListIndex


End Sub

Private Sub r3_Click()

If chose1.ListIndex = -1 Then Exit Sub

asuf.AddItem chose1.Text
chose1.RemoveItem chose1.ListIndex

End Sub

Private Sub r4_Click()

If chose2.ListIndex = -1 Then Exit Sub

wel.AddItem chose1.Text
chose2.RemoveItem chose2.ListIndex

End Sub

Private Sub r5_Click()

If chose2.ListIndex = -1 Then Exit Sub

wsuf.AddItem chose1.Text
chose2.RemoveItem chose2.ListIndex

End Sub



Option Explicit
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Const WM_MBUTTONDOWN = &H207
Public Const WM_MBUTTONUP = &H208

Public Sub mainproc()

End Sub



Posted Image

It compiles fine so far, so I don't have any errors which is good.

I'm kind of at a loss for what to do next.
I know I'm going to need to be able to pull information from the game I am making this for. It took me a while to figure it out, but I think I've included all of the functions and constants I'll need in order to do that.

Can someone point me in the right direction for what my next step should be? This is pretty much my first program other than a "Hello World!" type thing.

Is This A Good Question/Topic? 0
  • +

Replies To: Automating Shopping Bot using VB6

#2 Core  Icon User is offline

  • using System.Linq;
  • member icon

Reputation: 774
  • View blog
  • Posts: 5,097
  • Joined: 08-December 08

Re: Automating Shopping Bot using VB6

Posted 22 May 2009 - 02:19 PM

What is the purpose of this applciation? Is it for a MMORPG?
Was This Post Helpful? 0
  • +
  • -

#3 pengis  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 22-May 09

Re: Automating Shopping Bot using VB6

Posted 22 May 2009 - 02:46 PM

View PostCore, on 22 May, 2009 - 01:19 PM, said:

What is the purpose of this applciation? Is it for a MMORPG?



No. I've got host files for an older version of a BYOND game.
BYOND is a gaming network with nothing but user created games incase you're not famliar with it.

Sadly, most of the online games for byond rarely have more than 25 active members online at a time.
Was This Post Helpful? 0
  • +
  • -

#4 Core  Icon User is offline

  • using System.Linq;
  • member icon

Reputation: 774
  • View blog
  • Posts: 5,097
  • Joined: 08-December 08

Re: Automating Shopping Bot using VB6

Posted 22 May 2009 - 02:52 PM

I'm not quite familiar with BYOND, but since it's a network of independent developers, maybe you should contact the developer of a specific game to find the logic and organization of the game elements.

However, I highly doubt that this kind of programs is allowed to be used with online games, even independently developed. Developers want real people to play them, not bots.
Was This Post Helpful? 0
  • +
  • -

#5 pengis  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 22-May 09

Re: Automating Shopping Bot using VB6

Posted 22 May 2009 - 02:58 PM

Yeah, it would not be allowed for use with the online games on the network.
What I'm making this for is an older single player game that I've host files for. A lot of the games are open source etc.
Was This Post Helpful? 0
  • +
  • -

#6 MajorWalrus  Icon User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 115
  • Joined: 22-April 09

Re: Automating Shopping Bot using VB6

Posted 22 May 2009 - 02:59 PM

My first thought is to save the selections to an XML file and then have the game read that file and load the selections.

You could save as some thing like:

<data>
[indent]<Armor Type>[/indent]
[indent][indent]<*selection(s)*>[/indent][/indent]
[indent]</Armor Type>[/indent]
[indent]<Element>[/indent]
[indent][indent]<*selection(s)*>[/indent][/indent]
[indent]</Element>[/indent]
[indent]<Suffix>[/indent]
[indent][indent]<*selection(s)*>[/indent][/indent]
[indent]</Suffix>[/indent]
[indent]<Weapon>[/indent]
[indent][indent]<*selection(s)*>[/indent][/indent]
[indent]</Weapon>[/indent]
[indent]<Suffix>[/indent]
[indent][indent]<*selection(s)*>[/indent][/indent]
[indent]</Suffix>[/indent]
</data>



I'm not too familar with XML, but I think an approach like this would work. Try searching the web for "XML vb6" or something similar. I'm sure you'll find loads on how make a XML file that would suit your needs.

Here's a good tutorial on saving to a text file . This will at least give a place to start.

Good luck!
Was This Post Helpful? 0
  • +
  • -

#7 pengis  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 22-May 09

Re: Automating Shopping Bot using VB6

Posted 23 May 2009 - 01:34 PM

Okay, I've gotten a little farther but I'm stuck again.

I also used the Spy++ tool to find out I need to check msctls_statusbar32. This is where my program is going to check to see if the variables I want show up.

There are two rows I need to check with 12 boxes. When you hover over one of the boxes the information I need shows up in the msctls_statusbar32

Posted Image


for(int i = 0; i < 350; i+=30)
	setMousePos(105 + i, 430)
	checkText()


and
for(int i = 0; i < 350; i+=30)
	setMousePos(105 + i, 465)
	checkText()



I think this should work for making my program check over each of the boxes. I'm not exactly sure how I'm going to make it check what is displayed in the status bar with what I have selected in my listboxes on the right though.


EDIT: Can I use findwindow then EnumChildWindows with WM_GET TEXTLENGTH and WM_GETTEXT to get the text?

This post has been edited by pengis: 23 May 2009 - 06:28 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1