• Welcome to Valhalla Legends Archive.
 

Access / Command trouble

Started by ^, February 15, 2005, 11:47 AM

Previous topic - Next topic

^

Hello everyone.


Ok, my problem starts with:


I have set the access level of "100" for me. And i have the code of


If intAccess >= 50 and <What goes here for saying the name> and Mid(strtext, 1 , 9) = frmConfig.Trigger.text & "trigger"



I dont know what to put to say if the name is right, explained:
My bot will search for the name, check the access and see if its over 50, and if its not over 50, or it has no access, do nothing?

Could somebody please help me on the lines to this?

Spilled

Honestly i cant say much because you havent supplied enough code but the best way i figured to add access/commands to a bot is load a txt to a listbox and use a get access Function for example like this one


Public Function getaccess(user1 As String) As Integer
On Error Resume Next
Static X As Integer
For X = 0 To Form2.List1.ListCount - 1
Dim User() As String
User() = Split(Form2.List1.List(X), " ")
If LCase(User(0)) = LCase(user1) Then
    getaccess = User(1)
End If
Next X
End Function


Some kind of function like that would be sufficient, so your coding would be something like If Getaccess(username) >= 50 Then do w/e

Hope this helps, anymore questions ask away or PM me :D

^

I wrote code like that but i put


  For i = 0 to frmConfig.List1.ListCount + 1



Is + 1 wrong?

Warrior

For i = 0 to frmConfig.List1.ListCount Step 1 ??
Quote from: effect on March 09, 2006, 11:52 PM
Islam is a steaming pile of fucking dog shit. Everything about it is flawed, anybody who believes in it is a terrorist, if you disagree with me, then im sorry your wrong.

Quote from: Rule on May 07, 2006, 01:30 PM
Why don't you stop being American and start acting like a decent human?

^

Huh? Sorry, but why did you put "Step" instead of "1" ?

tA-Kane

Why did you put + 1? That will make it crash when it goes out of the bounds of the listbox (which is .ListCount).

"Step 1" tells the for loop to increment by one for each run through the loop.

Try setting to "Step 2" to see a difference.
Macintosh programmer and enthusiast.
Battle.net Bot Programming: http://www.bash.org/?240059
I can write programs. Can you right them?

http://www.clan-mac.com
http://www.eve-online.com

^

Yeah, k.

Umm back to my problem:

I have now made it save to a txt file and it reads


    Dim strCompare as string

getaccess = Right(strCompare , 3)



Thats part of it.
strCompare , 1 = Username
strCompare , 2 = A space..
strCompare , 3 = The access of the name

And i have

If getaccess >= 50 and username = Right(strCompare , 1) and Mid(strText, 1, 8) = "+trigger" then

But it doesnt work? Ahh help :(

Spilled

#7
... just use a split of " " to get the access of the username so it would be something like this...


Public function GetAccess(username as string)
Dim splt() as String
  With YOURLISTBOX
    For i = 0 to .listcount
      splt = Split(.list(i), " ")
       if splt(0) = lcase(username) then
           getaccess = splt(1)
       end if
   next i
end with
End function

somethign like that would be very simple...

^

Omfg i see how simple it is, but whats the " " mean / for :(

UserLoser.

Quote from: ^OwnaGe~ on February 15, 2005, 01:25 PM
Omfg i see how simple it is, but whats the " " mean / for :(

It's the delimeter (what you're splitting the string up by).

If you split: "Hi, my name is whatever", it would put:

Hi,
my
name
is
whatever

all into the return array

If you were to split that by "i", then the array containing the result of Split() would hold:

H
, my name
s whatever.

^

Oooh thanks!  ;D

Thanks all for explaining, going to go try some more commands now hehehe

I bet i come back though needing more help :(


Edit:

There is just one more thing, how do i get the ping? All i know is it you can get it at login, but how do i request it?  :-\

Spilled

You cant request it (or i never heard of that way) you get it as the person joins the channel or when you join the channel in the packet &HF (chat event), to keep record of it you must add it to a listbox to keep record of it and when you want to ping someone (ex: 'ping Spilled[DW]) you much search taht listbox and obtain the record of there ping.

Ill be sure to checkback because im sure you will need help again :), any questions feel free to ask.

^

Umm, what would i put to store it in a listbox ?



List1.Additem <What here>


:'(

Spilled

#13
Simple, on join chat event listbox.additem username & " " & Ping and on leave write a function to find that username that leaves and remove them from the listbox, and also on the users here chat event add everyone in the channel with the same format ( listbox.additem username & " " & Ping)

Hope this helps, feel free to ask any questions you make have :D

Edit: o and forgot to get the ping just write a simple function that uses a split to split the text in the listbox with the delimeter of " "

^

Hmm im kind of a newb for getting ping, could you write a demo code or something for me to get a little idea ?