Valhalla Legends Forums Archive | Battle.net Bot Development | CSB Access list

AuthorMessageTime
titan0060
Does anyone here know how to create an access list on CSB?
August 23, 2004, 9:28 PM
MindArchon
Try using an array system. And then to save the list have it loop throughout the array on form unload and save it to a file such as MindArchon|999.

Then on startup of the bot have it import it into the array(s) with the split function
August 23, 2004, 10:03 PM
Myndfyr
[quote author=titan0060 link=board=17;threadid=8339;start=0#msg77042 date=1093296489]
Does anyone here know how to create an access list on CSB?
[/quote]

Yes.
August 23, 2004, 10:11 PM
titan0060
[quote author=MyndFyre link=board=17;threadid=8339;start=0#msg77047 date=1093299116]
[quote author=titan0060 link=board=17;threadid=8339;start=0#msg77042 date=1093296489]
Does anyone here know how to create an access list on CSB?
[/quote]

Yes.
[/quote]

next time MyndFyre, lets try going alittle more in depth...
August 23, 2004, 10:33 PM
Kp
[quote author=titan0060 link=board=17;threadid=8339;start=0#msg77051 date=1093300391]next time MyndFyre, lets try going alittle more in depth...[/quote]

OK, how's this? Yes, lots of people know, and it's considered such a trivial task you shouldn't be bothering us with it. Figure it out for yourself.
August 23, 2004, 10:41 PM
MindArchon
OK. These are the functions I use. This is a really bad way to do it, but I am still learning VB, so if you really want to you can use my horrible way. Put this in a module

[code]
Public Const MaxAccessList = 250
Public AccessListNames(0 To MaxAccessList) As String
Public AccessListAccess(0 To MaxAccessList) As Double

Public Function AddAccess(username As String, access As Integer) As Boolean

Dim I As Integer

For I = 0 To MaxAccessList
If AccessListNames(I) = "" Then
AccessListNames(I) = username
AccessListAccess(I) = access
AddAccess = True
Exit For
ElseIf AccessListNames(I) = username Then
AccessListAccess(I) = access
AddAccess = True
Exit For
End If
Next I

End Function

Public Function RemoveAccess(username As String) As Boolean

Dim I As Integer

For I = 0 To MaxAccessList
If AccessListNames(I) = username Then
AccessListNames(I) = ""
AccessListAccess(I) = 0
RemoveAccess = True
End If
Next I

End Function

Public Function CheckAccess(username As String) As Integer

Dim I As Integer

CheckAccess = -1
For I = 0 To MaxAccessList
If AccessListNames(I) = username Then
CheckAccess = AccessListAccess(I)
Exit For
End If
Next I

End Function

Public Sub SaveAccess(FilePath As String)

Dim I As Integer

On Error Resume Next
Kill FilePath
On Error GoTo 0

Open FilePath For Output As #1
For I = 0 To MaxAccessList
If AccessListNames(I) <> "" Then
Print #1, AccessListNames(I) & "|" & AccessListAccess(I)
End If
Next I
Close #1

End Sub

Public Function LoadAccess(FilePath As String)

Dim TextLine As String
Dim Arguments() As String
Dim I As Integer

Open FilePath For Input As #1
Do While Not EOF(1)
Line Input #1, TextLine

If TextLine <> "" Then
Arguments = Split(TextLine, "|")
AccessListNames(I) = LCase(Arguments(0))
AccessListAccess(I) = Val(Arguments(1))
End If
I = I + 1
Loop
Close #1

End Function[/code]

Then at your main form you would go

[code]Private Sub Form_Load()

LoadAccess App.Path & "\Access.ini"

End Sub

Private Sub Form_Unload()

SaveAccess App.Path & "\Access.ini"

End Sub[/code]

Then when someone talks you would put their access in a vairable like

[code]
Dim useraccess as string

useraccess = CheckAccess(Username)
[/code]

Then you would compare that to the required access for a command.

To list all the usernames in the access list and their access you would go

[code]For I = 0 To MaxAccessList
If AccessListNames(I) <> "" Then


accesslist.ListItems.add , , AccessListNames(I) & " - " & AccessListAccess(I)

End If
Next I[/code]

You will get errors if Access.ini does not exist, so make sure you put it beside your bot
August 24, 2004, 12:13 AM
hismajesty
[quote author=titan0060 link=board=17;threadid=8339;start=0#msg77051 date=1093300391]
[quote author=MyndFyre link=board=17;threadid=8339;start=0#msg77047 date=1093299116]
[quote author=titan0060 link=board=17;threadid=8339;start=0#msg77042 date=1093296489]
Does anyone here know how to create an access list on CSB?
[/quote]

Yes.
[/quote]

next time MyndFyre, lets try going alittle more in depth...
[/quote]

Yes, somebody does.

Is that better?
August 24, 2004, 12:15 AM
titan0060
Thanks for that code, it works pretty good, only one problem though... Im set to -1 access and i cant figure out how to change that.
August 24, 2004, 1:45 AM
MindArchon
AddAccess also works to edit that persons access, so just addaccess yourself to 999
August 24, 2004, 2:03 AM
titan0060
but then couldn't anyone set themselfs to 999?
also please explain how i set myself to 999 alittle more, cause i dont quite understand what your saying.
August 24, 2004, 2:15 AM
Eli_1
[quote author=titan0060 link=board=17;threadid=8339;start=0#msg77096 date=1093313748]
but then couldn't anyone set themselfs to 999?
also please explain how i set myself to 999 alittle more, cause i dont quite understand what your saying.
[/quote]

You don't have to remove a person's access before adding them. If they already have access, adding them again will simply overwrite their previous access.
August 24, 2004, 3:41 AM
MindArchon
[quote author=titan0060 link=board=17;threadid=8339;start=0#msg77096 date=1093313748]
but then couldn't anyone set themselfs to 999?
also please explain how i set myself to 999 alittle more, cause i dont quite understand what your saying.
[/quote]

Try doing this.

[code]Private Sub Form_Load()

LoadAccess App.Path & "\Access.ini"
AddAccess "titan0060", 999

End Sub [/code]

There. Your 999 now. For instance, if you want a .add command, you would do something like this (this is under usertalks sub)

[code]
Dim access as string

access = GetAccess(Username)

If Mid$(Message, 1, 4) = trigger & "add" And access > 59 Then

Dim addstats() as string

addstats = Split(Message, " ")

AddAccess addstats(1), Val(addstats(2))

bot1.send "Added " & addstats(1) & " with " & addstats(2) & " access"

End If
[/code]
August 24, 2004, 4:35 AM
Gangz
Good job letting him write his own code. Not only did you give him your code to do it... You gave him an indepth message on how to use it.. Ask him what he learned.. He came back and asked how to use it.

My advice: Since you have already gotten the code. Read and Study it. Follow it all back and forth till you understand what it is actually doing to make the process work. If you succeed then write your own doing things the way you wanted to. If you dont succeed pick up the a damn VB book, It doesn't weigh that much
August 24, 2004, 8:17 AM

Search