Reemer
09-05-2012, 03:12 PM
My VERY first actual program. Not my best work, but it sorta works. If you can figure out why it stops APing randomly, more power to ya.
Private Sub cmdstart_Click()
Dim strwinNP As String
Dim strWinItem As String
Dim strLast As String
Dim strXCN0 As String
Dim strxplode As String
Dim strChar As String
Dim strRand As String
Dim strLastChar As String
Dim strLastMove As String
StopProgram = False
cmdstart.Enabled = False
cmdStop.Enabled = True
lblstatus.Caption = "Grabbing XCN"
strHTML = Wrapper1.GetWrapper("[Only registered and activated users can see links]")
strXCN0 = GetStringBetween(strHTML, "type='hidden' name='xcn' value='", "'>")
lblstatus.Caption = "Grabbed XCN. Starting game."
MSToWait (Rand(txtwait1.Text, txtwait2.Text))
lblstatus.Caption = "Playing Gormball."
strHTML = Wrapper1.GetWrapper("[Only registered and activated users can see links]")
MSToWait (Rand(txtwait1.Text, txtwait2.Text))
strRand = Rand(1, 9)
strHTML = Wrapper1.PostWrapper("[Only registered and activated users can see links]", "xcn=" & strXCN0 & "&player_backed=" & strRand, "[Only registered and activated users can see links]")
If strRand = 1 Then strChar = ("Thyassa")
If strRand = 2 Then strChar = ("Brian")
If strRand = 3 Then strChar = ("Gargarox")
If strRand = 4 Then strChar = ("Farvin III")
If strRand = 5 Then strChar = ("Ember")
If strRand = 6 Then strChar = ("Zargrold")
If strRand = 7 Then strChar = ("Ursula")
If strRand = 8 Then strChar = ("Kevin")
Do
If Val(lblgamesplayed.Caption) >= Val(txtmaxgames.Text) Then StopProgram = True
strLastChar = (GetStringBetween(strHTML, "name='last_character' value='", "'><input type='submit"))
lbllastchar.Caption = (strLastChar)
lbllastmove.Caption = Val(lbllastmove.Caption) + 1
MSToWait (Rand(txtwait1.Text, txtwait2.Text))
If InStr(1, strHTML, "Your Move") Then
lbllastchar.Caption = ("You")
strHTML = Wrapper1.PostWrapper("[Only registered and activated users can see links]", "type=moveon" & "&pagecount=" & lbllastmove.Caption & "&xcn=" & strXCN0 & "&turns_waited=1" & "&last_character=You", "[Only registered and activated users can see links]")
Else
strHTML = Wrapper1.PostWrapper("[Only registered and activated users can see links]", "type=moveon" & "&pagecount=" & lbllastmove.Caption & "&xcn=" & strXCN0 & "&last_character=" & (strLastChar), "[Only registered and activated users can see links]")
End If
If InStr(1, strHTML, "<br><b>Your Prize : ") Then
strwinNP = (GetStringBetween(strHTML, "(x4 = ", " points)</b><br>(you win that many Neopoints!)"))
strWinItem = (GetStringBetween(strHTML, "<br><b>Your Prize : ", "</b><p><img src='[Only registered and activated users can see links]"))
lststatus.AddItem ("Won the game! Gained " & (strwinNP) & "NP and " & (strWinItem))
strHTML = Wrapper1.GetWrapper("[Only registered and activated users can see links]", "[Only registered and activated users can see links]")
lblgamesplayed.Caption = Val(lblgamesplayed.Caption) + 1
lbllastmove.Caption = 0
MSToWait (Rand(txtwait1.Text, txtwait2.Text))
strRand = Rand(1, 9)
strHTML = Wrapper1.PostWrapper("[Only registered and activated users can see links]", "xcn=" & strXCN0 & "&player_backed=" & strRand, "[Only registered and activated users can see links]")
If strRand = 1 Then strChar = ("Thyassa")
If strRand = 2 Then strChar = ("Brian")
If strRand = 3 Then strChar = ("Gargarox")
If strRand = 4 Then strChar = ("Farvin III")
If strRand = 5 Then strChar = ("Ember")
If strRand = 6 Then strChar = ("Zargrold")
If strRand = 7 Then strChar = ("Ursula")
If strRand = 8 Then strChar = ("Kevin")
lblchar.Caption = (strChar)
End If
If InStr(1, strHTML, "The Gormball explodes") Then
strxplode = GetStringBetween(strHTML, "The Gormball Explodes on ", "!!!")
lststatus.AddItem ("The Gormball explodes on " & strxplode & "!!!")
End If
If InStr(1, strHTML, "Oh dear, you are out of the game") Then
strwinNP = GetStringBetween(strHTML, "game :( You scored <b>", "</b> points! (and gain")
lststatus.AddItem ("Lost the game and gained " & strwinNP & "NP")
lbllastmove.Caption = 0
lblgamesplayed.Caption = Val(lblgamesplayed.Caption) + 1
strHTML = Wrapper1.GetWrapper("[Only registered and activated users can see links]", "[Only registered and activated users can see links]")
MSToWait (Rand(txtwait1.Text, txtwait2.Text))
strRand = Rand(1, 9)
strHTML = Wrapper1.PostWrapper("[Only registered and activated users can see links]", "xcn=" & strXCN0 & "&player_backed=" & strRand, "[Only registered and activated users can see links]")
If strRand = 1 Then strChar = ("Thyassa")
If strRand = 2 Then strChar = ("Brian")
If strRand = 3 Then strChar = ("Gargarox")
If strRand = 4 Then strChar = ("Farvin III")
If strRand = 5 Then strChar = ("Ember")
If strRand = 6 Then strChar = ("Zargrold")
If strRand = 7 Then strChar = ("Ursula")
If strRand = 8 Then strChar = ("Kevin")
lblchar.Caption = (strChar)
End If
Loop Until StopProgram = True
End Sub
Private Sub cmdstart_Click()
Dim strwinNP As String
Dim strWinItem As String
Dim strLast As String
Dim strXCN0 As String
Dim strxplode As String
Dim strChar As String
Dim strRand As String
Dim strLastChar As String
Dim strLastMove As String
StopProgram = False
cmdstart.Enabled = False
cmdStop.Enabled = True
lblstatus.Caption = "Grabbing XCN"
strHTML = Wrapper1.GetWrapper("[Only registered and activated users can see links]")
strXCN0 = GetStringBetween(strHTML, "type='hidden' name='xcn' value='", "'>")
lblstatus.Caption = "Grabbed XCN. Starting game."
MSToWait (Rand(txtwait1.Text, txtwait2.Text))
lblstatus.Caption = "Playing Gormball."
strHTML = Wrapper1.GetWrapper("[Only registered and activated users can see links]")
MSToWait (Rand(txtwait1.Text, txtwait2.Text))
strRand = Rand(1, 9)
strHTML = Wrapper1.PostWrapper("[Only registered and activated users can see links]", "xcn=" & strXCN0 & "&player_backed=" & strRand, "[Only registered and activated users can see links]")
If strRand = 1 Then strChar = ("Thyassa")
If strRand = 2 Then strChar = ("Brian")
If strRand = 3 Then strChar = ("Gargarox")
If strRand = 4 Then strChar = ("Farvin III")
If strRand = 5 Then strChar = ("Ember")
If strRand = 6 Then strChar = ("Zargrold")
If strRand = 7 Then strChar = ("Ursula")
If strRand = 8 Then strChar = ("Kevin")
Do
If Val(lblgamesplayed.Caption) >= Val(txtmaxgames.Text) Then StopProgram = True
strLastChar = (GetStringBetween(strHTML, "name='last_character' value='", "'><input type='submit"))
lbllastchar.Caption = (strLastChar)
lbllastmove.Caption = Val(lbllastmove.Caption) + 1
MSToWait (Rand(txtwait1.Text, txtwait2.Text))
If InStr(1, strHTML, "Your Move") Then
lbllastchar.Caption = ("You")
strHTML = Wrapper1.PostWrapper("[Only registered and activated users can see links]", "type=moveon" & "&pagecount=" & lbllastmove.Caption & "&xcn=" & strXCN0 & "&turns_waited=1" & "&last_character=You", "[Only registered and activated users can see links]")
Else
strHTML = Wrapper1.PostWrapper("[Only registered and activated users can see links]", "type=moveon" & "&pagecount=" & lbllastmove.Caption & "&xcn=" & strXCN0 & "&last_character=" & (strLastChar), "[Only registered and activated users can see links]")
End If
If InStr(1, strHTML, "<br><b>Your Prize : ") Then
strwinNP = (GetStringBetween(strHTML, "(x4 = ", " points)</b><br>(you win that many Neopoints!)"))
strWinItem = (GetStringBetween(strHTML, "<br><b>Your Prize : ", "</b><p><img src='[Only registered and activated users can see links]"))
lststatus.AddItem ("Won the game! Gained " & (strwinNP) & "NP and " & (strWinItem))
strHTML = Wrapper1.GetWrapper("[Only registered and activated users can see links]", "[Only registered and activated users can see links]")
lblgamesplayed.Caption = Val(lblgamesplayed.Caption) + 1
lbllastmove.Caption = 0
MSToWait (Rand(txtwait1.Text, txtwait2.Text))
strRand = Rand(1, 9)
strHTML = Wrapper1.PostWrapper("[Only registered and activated users can see links]", "xcn=" & strXCN0 & "&player_backed=" & strRand, "[Only registered and activated users can see links]")
If strRand = 1 Then strChar = ("Thyassa")
If strRand = 2 Then strChar = ("Brian")
If strRand = 3 Then strChar = ("Gargarox")
If strRand = 4 Then strChar = ("Farvin III")
If strRand = 5 Then strChar = ("Ember")
If strRand = 6 Then strChar = ("Zargrold")
If strRand = 7 Then strChar = ("Ursula")
If strRand = 8 Then strChar = ("Kevin")
lblchar.Caption = (strChar)
End If
If InStr(1, strHTML, "The Gormball explodes") Then
strxplode = GetStringBetween(strHTML, "The Gormball Explodes on ", "!!!")
lststatus.AddItem ("The Gormball explodes on " & strxplode & "!!!")
End If
If InStr(1, strHTML, "Oh dear, you are out of the game") Then
strwinNP = GetStringBetween(strHTML, "game :( You scored <b>", "</b> points! (and gain")
lststatus.AddItem ("Lost the game and gained " & strwinNP & "NP")
lbllastmove.Caption = 0
lblgamesplayed.Caption = Val(lblgamesplayed.Caption) + 1
strHTML = Wrapper1.GetWrapper("[Only registered and activated users can see links]", "[Only registered and activated users can see links]")
MSToWait (Rand(txtwait1.Text, txtwait2.Text))
strRand = Rand(1, 9)
strHTML = Wrapper1.PostWrapper("[Only registered and activated users can see links]", "xcn=" & strXCN0 & "&player_backed=" & strRand, "[Only registered and activated users can see links]")
If strRand = 1 Then strChar = ("Thyassa")
If strRand = 2 Then strChar = ("Brian")
If strRand = 3 Then strChar = ("Gargarox")
If strRand = 4 Then strChar = ("Farvin III")
If strRand = 5 Then strChar = ("Ember")
If strRand = 6 Then strChar = ("Zargrold")
If strRand = 7 Then strChar = ("Ursula")
If strRand = 8 Then strChar = ("Kevin")
lblchar.Caption = (strChar)
End If
Loop Until StopProgram = True
End Sub