• Log in or sign up for an account here: https://www.sythe.org/login

[Function]Clan lookup

timk777

Active Member
Joined
Feb 19, 2007
Sythe Gold
0
Messages
156
Its bloated but it works. Make sure txtInfo's multiline property is set to True.
You need:
Code:
2 Textboxes- txtUser and txtInfo
1 Command button- CmdLookup
1 iNet control- InetClan

Code:
Public Function LookupClan(Person As String) As String
Dim str2() As String, TempStr() As String, StrData As String, NewStr() As String, Stuff As String, Last() As String
On Error GoTo ErrHandler
CmdLookup.Enabled = False
If InetClan.StillExecuting = True Then Exit Function
LookupClan = Split(Split(InetClan.OpenURL("http://runehead.com/feeds/lowtech/searchuser.php?user=" & Person), "@@start")(1), "@@end")(0)
StrData = InetClan.OpenURL("http://runehead.com/feeds/lowtech/searchuser.php?user=" & txtUser.Text)
str2 = Split(StrData, "@@start")
TempStr = Split(str2(1), "@@end")
If InStr(1, TempStr(0), "@@Not Found", vbTextCompare) Then
LookupClan = Person & " not found in RuneHead database."
Else
NewStr = Split(TempStr(0), "|")
Last = Split(TempStr(0), "|")
LookupClan = Replace(Stuff, vbLf, "") & "Clan Name- " & Replace(NewStr(0), vbLf, "") & vbNewLine & "Clan Site- " & Replace(Last(1), vbLf, "")
End If
CmdLookup.Enabled = True
Exit Function
ErrHandler:
CmdLookup.Enabled = True
InetClan.Cancel
MsgBox "Error Number: " & Err.Number & vbCrLf & "Error Description: " & Err.Description, vbCritical, "Clan Lookup"
Exit Function
End Function

Usage is:

Code:
TxtInfo.text = Lookupclan(txtUser.text)

Feel free to use, modify, improve on this code.
 
That's very LONG considering I have this on my Kit :) (Think I was first to make one, not sure? Not that I care)

Here is a screenshot of mine in action, I may release source (it's added to BrownHead's Hiscore searcher with big mods to enable lite searching).

 
Actually your code is pretty long. You could easily put all that code in like 5-10 lines.
 
Well, get rid of the error handler, make the split all on one line, yeah it could be 5-10 lines but I like putting a new line for each function. I don't know. Its my programming habit.
 
Hmm. I don't have a client but I guess I'll update it. I made this as a request for somebody.
 
duelarena.gg
Back
Top