Valhalla Legends Forums Archive | Battle.net Bot Development | [VB6] Bugged up Code

AuthorMessageTime
Anubis
I'm attempting to make an "!own whatever*" function that's similar to Flawed Bot's "!own". I wrote up the code and a few days ago it worked great, but now it's not working. It gets to a point in the function and then just leaves the function and goes back to the previous function (the function that was called before DoOwn(), which was CSB_UserJoin()).

I have marked the line below with '#####<<< where the code is just stopping in the function. (It stops right after running the code on that line.)

[code]Public Function DoOwn(Username, Optional Why = "")
On Error GoTo Err
'Dim OwnedAttempt
If Owning = 1 Then OwnedAttempt = 1: OwnedNext = Username: OwnedNextWhy = Why: Exit Function
Dim i As Integer, OwnMsg(3) As String, J As Integer, K
Owning = 1
frmMain.timQueue.Enabled = False '### Freeze the normal queue
Queue = 1 '#####<<<
RunAgain:
Pause 5000 '8000
Username = WCPrep(Username)
Next2:[/code]

Hopefully there's something I'm missing here...I'd hate to think I need to rewrite the function again =/

I have tried many different values for Username and it doesnt seem to change the result. Also, Queue is dclared as "Public Queue".

All help is appreciated. Thanks!
July 14, 2004, 10:23 PM
hismajesty
Eww, your tab key is being denied pleasure. :(
July 14, 2004, 10:58 PM
Anubis
[quote author=hismajesty[yL] link=board=17;threadid=7706;start=0#msg70400 date=1089845880]
Eww, your tab key is being denied pleasure. :(
[/quote]

haha... I used the tab key a lot in that function, just not in thet part of it...;)
July 14, 2004, 10:59 PM
Myndfyr
What does "!own" do, specifically?
July 14, 2004, 11:02 PM
Anubis
[quote author=Myndfyre link=board=17;threadid=7706;start=0#msg70403 date=1089846166]
What does "!own" do, specifically?
[/quote]

Basically, if you have a lot of users/bots join the channel with the same name (such as bob#500, bob#265, bob#600, ect) you can ban them 4 at a time by typing "!own bob*".
July 14, 2004, 11:38 PM
ChR0NiC
[quote author=Anubis link=board=17;threadid=7706;start=0#msg70395 date=1089843807]
Hopefully there's something I'm missing here...I'd hate to think I need to rewrite the function again =/
[/quote]

Such a function is not hard to write // rewrite.
That is.....if you bothered to learn the language correctly....

For example
[code]
Public Sub DoOwn(WildCard As String)

Dim UsersToBan() As String, BanCount As Integer
Dim Wildcard2 As String
Wildcard2 = Left(Wildcard, Len(Wildcard) - 1) 'To get rid of the *

For i = 1 To ChannelList.ListItems.Count 'I think
If Wildcard2 Like ChannelList.ListItems(i).text Then
UsersToBan(UBound) = ChannelList.ListItems(i).text
ReDim Preserve UsersToBan(UBound(UsersToBan) + 1)
End If
Next i

'So far you have added all the users that fit the wildcard description to an array
'Next you will ban all of them without flooding out

For i = 0 To UBound(UsersToBan)

Send "/ban " & UBound(UsersToBan)
BanCount = BanCount + 1

If BanCount => 4 Then
Pause 5000
BanCount = 0
End If

Next i

End Sub
[/code]

Well again it's untested code and I wrote it in a hurry, but that should be what you are looking for, with your little "own" command that was made by Fleet, which I find isn't any faster due to the delay afterwards, compared to any efficient queue system.
July 15, 2004, 11:48 PM
Myndfyr
[quote author=ChR0NiC link=board=17;threadid=7706;start=0#msg70675 date=1089935305]
Well again it's untested code and I wrote it in a hurry, but that should be what you are looking for, with your little "own" command that was made by Fleet, which I find isn't any faster due to the delay afterwards, compared to any efficient queue system.
[/quote]

I agree. An efficient queue system should ban floods just as well as this "own" command, particularly if you either 1.) enable channel protection, which just walks down the list of users in the channel, or 2.) use wildcards to ban.
July 16, 2004, 12:49 AM
Adron
[quote author=Anubis link=board=17;threadid=7706;start=0#msg70395 date=1089843807]
It gets to a point in the function and then just leaves the function and goes back to the previous function (the function that was called before DoOwn(), which was CSB_UserJoin()).
[/quote]

Do you happen to have "On Error Resume Next" in CSB_UserJoin? It sounds like you're handling an error you shouldn't be handling.
July 16, 2004, 5:18 PM
Anubis
I went to retest the code again today and now it's not even reaching the load-detecting function.

[code]If Username = LUser Then GoTo EndV
LUser = Username
frmMain.RoomList.ListItems.Add , , Username, , GetIconCode(Message, Flags)
frmMain.RoomList.ListItems(frmMain.RoomList.ListItems.Count).ListSubItems.Add , , , GetLagIcon(Ping, Flags)
frmMain.RoomList.ListItems(frmMain.RoomList.ListItems.Count).ListSubItems.Add , , Ping
frmMain.RoomList.ListItems(frmMain.RoomList.ListItems.Count).ListSubItems.Add , , Val(frmSettings.txtIdleKicks)
frmMain.lblChannel.Caption = msChannelName & " (" & frmMain.RoomList.ListItems.Count & ")"
lstProducts.AddItem Message 'It exits the function right after this
'And it exits the function even if I put GoTo EndV on this line
EndV:
If frmSettings.chkDingWhenUserJoins.Value = 1 Then Beep[/code]

So what fried now? heh

IIRC I had a problem similar to this before... I was using Microsoft Scripting Runtime for the FileSystemObject, and I used the object so many times in the project that I had to add another FileSystemObject (such as FSO and FSO2). Could it be that I have over-done the 'GoTo' labels?

And yes I got the idea from Flawed Bot, but I want to make my own instead of copy/pasting ;)


Edit: I found this new bug when I was checking with the 'On Error Resume Next's... I reset everything back to the way it was and has had no change.
July 16, 2004, 10:30 PM

Search