First of all, know that this program is not done. It is almost complete other than a few bugs that still need worked out. I would like you all to test it out and make suggestions/report bugs.
Screenshot:
Features:
Known issues:
Still needs done:
This project is for VB.net 2010, if you have 2008.. see the bottom of this post
[link removed by OP]
The code is not completely organized but i did throw a few comments in to help guide newcomers through the source. If you have any questions about what or why i did what i did... post them here.
If you have VB.net 2008, here is the full source.
You will need to put the controls into each form. Any questions, reply to this thread.
Form1:
Form2:
Screenshot:
Spoiler (Click to View)
[img]upload/files/hemp.jpg[/img]
Features:
- Auto-Clicker
- Load/Save Auto-Click settings
- Loads game without website
Known issues:
- Clicking and dragging bugs it up (needs to be a solid click)
- Sometimes it records the start click, sometimes it doesnt
Still needs done:
- Error handling (mainly make the User Interface better)
- Add hotkeys instead of buttons (will eliminate Known issue #2)
- Listboxes aren't very efficient (thought about using arrays)
This project is for VB.net 2010, if you have 2008.. see the bottom of this post
[link removed by OP]
The code is not completely organized but i did throw a few comments in to help guide newcomers through the source. If you have any questions about what or why i did what i did... post them here.
If you have VB.net 2008, here is the full source.
Spoiler (Click to View)
You will need to put the controls into each form. Any questions, reply to this thread.
Form1:
Code:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
WebBrowser1.DocumentText = _
"<object width=""800"" height=""600"" name=""gameSwf"" allowscriptaccess=""always"" allownetworking=""always"" codebase=""http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0"" classid=""clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"" id=""gameSwf"" >" & _
"<param name=""src"" value=""http://i.adultswim.com/adultswim/games2/game-files/hemptycoon/game.swf""/>" & _
"<param name=""base"" value=""http://i.adultswim.com/adultswim/games2/game-files/hemptycoon/""/>" & _
"<param name=""bgcolor"" value=""#000000""/>" & _
"<param name=""quality"" value=""high""/>" & _
"<param name=""wmode"" value=""transparent""/>" & _
"<param name=""allowScriptAccess"" value=""always""/>" & _
"<param name=""allowNetworking"" value=""always""/>" & _
"<param name=""FlashVars"" value=""""/>" & _
"<param name=""playerVersion"" value=""10""/>" & _
"<embed width=""800"" height=""600"" id=""gameSwf"" name=""gameSwf"" allownetworking=""always"" wmode=""transparent"" allowscriptaccess=""always"" bgcolor=""#000000"" type=""application/x-shockwave-flash"" pluginspage=""http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"" quality=""high"" src=""http://i.adultswim.com/adultswim/games2/game-files/hemptycoon/game.swf"" flashvars="""" base=""http://i.adultswim.com/adultswim/games2/game-files/hemptycoon/"" />" & _
"</object>"
End Sub
Private Sub Form1_SizeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.SizeChanged
Me.Text = Me.Width.ToString & "-" & Me.Height.ToString
End Sub
Private Sub OpenAutoClickToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenAutoClickToolStripMenuItem.Click
Form2.Show()
End Sub
End Class
Form2:
Code:
Imports System.IO
Public Class Form2
Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Integer, ByVal dx As Integer, ByVal dy As Integer, ByVal cButtons As Integer, ByVal dwExtraInfo As Integer)
Private Const LEFTDOWN = &H2 ' left button down
Private Const LEFTUP = &H4 ' left button up
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Const lbutton = &H1
Dim x As String = ""
Dim y As String = ""
Dim val As Integer = 0
Dim count As Integer = 1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
x = "0"
'tR is the thread that captures the mouse clicks and stores them in the listbox
Dim tR As Threading.Thread = New Threading.Thread(AddressOf test)
tR.Start()
Timer2.Start()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer2.Enabled = False
x = "-1"
'removes extra clicks from clicking start and stop (sometimes you need the first 3)
'it depends on if it records the first click or not
'ListBox1.Items.RemoveAt(0)
'ListBox2.Items.RemoveAt(0)
'ListBox3.Items.RemoveAt(0)
ListBox1.Items.RemoveAt(ListBox1.Items.Count - 1)
ListBox2.Items.RemoveAt(ListBox2.Items.Count - 1)
ListBox3.Items.RemoveAt(ListBox3.Items.Count - 1)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Button1.Enabled = False
x = "-1"
ListBox1.SelectedIndex = 0
ListBox2.SelectedIndex = 0
ListBox3.SelectedIndex = 0
Timer1.Interval = 100
Timer1.Start()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim sdial As SaveFileDialog = New SaveFileDialog
sdial.Filter = "Hemp Settings (*.hemp)|*.hemp"
If Not sdial.ShowDialog = DialogResult.OK Then
Exit Sub
Else
Dim sw As StreamWriter = New StreamWriter(sdial.FileName)
Dim line As String = ""
For i = 0 To ListBox1.Items.Count - 1
line = ListBox1.Items(i) & "," & ListBox2.Items(i) & "," & ListBox3.Items(i)
sw.WriteLine(line)
Next
sw.Close()
End If
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Dim odial As OpenFileDialog = New OpenFileDialog
odial.Filter = "Hemp Settings (*.hemp)|*.hemp"
If Not odial.ShowDialog = DialogResult.OK Then
Exit Sub
Else
Dim sr As StreamReader = New StreamReader(odial.FileName)
While Not sr.EndOfStream
Dim strLine As String() = Split(sr.ReadLine, ",")
ListBox1.Items.Add(strLine(0))
ListBox2.Items.Add(strLine(1))
ListBox3.Items.Add(strLine(2))
End While
End If
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
ListBox1.Items.Clear()
ListBox2.Items.Clear()
ListBox3.Items.Clear()
Label1.Text = 0
Label2.Text = 0
Label3.Text = 0
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
'timer that plays back the clicks
Dim total As Integer = ListBox1.Items.Count - 1
Cursor.Position = New Point(ListBox1.SelectedItem, ListBox2.SelectedItem)
mouse_event(LEFTDOWN, 0, 0, 0, 0)
mouse_event(LEFTUP, 0, 0, 0, 0)
If Not total = ListBox1.SelectedIndex Then
ListBox1.SelectedIndex += 1
ListBox2.SelectedIndex += 1
ListBox3.SelectedIndex += 1
Timer1.Interval = ListBox3.SelectedItem * 200
Else
If Not count = Int32.Parse(TextBox1.Text) Then
ListBox1.SelectedIndex = 0
ListBox2.SelectedIndex = 0
ListBox3.SelectedIndex = 0
count += 1
Else
count = 1
Button1.Enabled = True
Timer1.Enabled = False
End If
End If
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
val += 1
Label3.Text = val
End Sub
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
Dim str As String = "0123456789"
If str.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End Sub
Private Sub test()
Try
Do While Not x = "-1"
Invoke(New _title(AddressOf title))
If GetAsyncKeyState(lbutton) Then
If Not x = Cursor.Position.X.ToString Or Not y = Cursor.Position.Y.ToString Then
x = Cursor.Position.X.ToString
y = Cursor.Position.Y.ToString
Invoke(New _lbox(AddressOf lbox))
End If
End If
Loop
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
Delegate Sub _title()
Delegate Sub _lbox()
Private Sub title()
Me.Text = "x: " & Cursor.Position.X.ToString & " y: " & Cursor.Position.Y.ToString
End Sub
Private Sub lbox()
ListBox1.Items.Add(x)
ListBox2.Items.Add(y)
ListBox3.Items.Add(val)
val = 0
Label1.Text = ListBox1.Items.Count
Label2.Text = ListBox2.Items.Count
End Sub
End Class
I code at http://tech.reboot.pro