|
Post by Vertigo on Jun 1, 2003 6:57:31 GMT -5
hey, just started writing a vb client from syams source in old board. ive managed to get a nicklist working in a nicklist patched together from various readnames, but its in 3 columns....just wondering ifs its a property i havent got set in the listview, or the way the nick names are passed to the listview thru call readnames.
|
|
Tewl
xTeam
C# & VB Developer
Posts: 495
|
Post by Tewl on Jun 1, 2003 7:19:09 GMT -5
Can you be a little more specific about what your problem is please ;\
|
|
|
Post by Vertigo on Jun 1, 2003 17:37:26 GMT -5
ok, the nicklist is meant to be one column of names....in my listview its 3 diff columns so like nick1 nick2 nick3 nick4 nick5 nick6 etc...
|
|
Tewl
xTeam
C# & VB Developer
Posts: 495
|
Post by Tewl on Jun 1, 2003 17:53:02 GMT -5
well u still havent told me much of anything to be able to help you so read this ( www.developerfusion.com/show/74/ ) if you are still having problems after that show some code
|
|
|
Post by Webagent007 on Jun 1, 2003 18:05:15 GMT -5
then I guess you are not splitting the data correctly, you have to add 1 name at the time, not 3.. so yeah post some code.
|
|
|
Post by Vertigo on Jun 1, 2003 18:08:34 GMT -5
Public Sub ReadNames() On Error Resume Next Dim xData As String, xNames() As String, SName As String, i As Integer, X As Integer xData = Mid(Data, Loc(" :") + 3, Len(Data)) xNames = Split(xData, " ") For i = 0 To UBound(xNames) sFileName = Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(xNames(i), "=", ""), vbCr, ""), vbLf, ""), vbCrLf, ""), "P,", ""), "R,", ""), "U,", ""), "G,", ""), "H,", ""), "U,", ""), "S,", ""), "G,", ""), ":", ""), "+", ""), "FX,", ""), "RX,", ""), "MX,", ""), "MY,", ""), "PX,", ""), "PY,", ""), "RX,", ""), "FY,", ""), ",", "") sFileName = Trim$(sFileName) SName = Replace(Replace(sFileName, "@", ""), ".", "") If sFileName <> "" And sFileName <> ListView1.ListItems(ListView1.ListItems.Count).Text And sFileName <> serverhost And sFileName <> Rname Then ListView1.ListItems.Add , SName, ConvertNick(sFileName) End If If sFileName Like ".*" Then Me.BeGold (SName) If sFileName Like "@*" Then Me.BeHost (SName) If sFileName Like "*'*" Then Me.BeGuide (SName) lblPPL.Caption = ListView1.ListItems.Count & " People Chatting." Next i Erase xNames() ListView1.ListItems.Add , "....", "...." For i = 1 To ListView1.ListItems.Count If ListView1.ListItems(i).Key = "...." Then ListView1.ListItems.Remove i Exit For End If Next i End Sub
thats my readnames..well not mine...cant remember where i pulled it from..but i didnt have nicklist at all....l
and
If Loc("353") <> 0 And Loc("=") <> 0 Then Call ReadNames Exit Sub End If
|
|
|
Post by Webagent007 on Jun 1, 2003 18:15:01 GMT -5
ok if you are replacing the stuff in front anyways (not using it) then this looks more organized br] Sub CreateNickList(sNames As String) Dim sNick() As String Dim i As Integer Dim Nick As String sNick = Split(sNames, " ") For i = 0 To UBound(sNick) Nick = sNick(i) If Nick <> "" Then Nick = Split(Nick, ",")(3) If Left$(Nick, 1) = "@" Or Left$(Nick, 1) = "." Or Left$(Nick, 1) = "+" Then Nick = Right$(Nick, Len(Nick) - 1) End If Namelist.AddItem Trim$(Nick) Usercount = Usercount + 1 End If Next
End Sub
this will give you nice clean list and here's my trigger (select case offcource ;D ) br] Case "353" 'namelist sTemp = Split(sLine, sChannel & " :")(1) CreateNickList (sTemp)
*edit, the usercount is to count the amount of users, and you can even leave the following part out br] If Left$(Nick, 1) = "@" Or Left$(Nick, 1) = "." Or Left$(Nick, 1) = "+" Then Nick = Right$(Nick, Len(Nick) - 1)
if you want to keep the userstatus in front
|
|
|
Post by Vertigo on Jun 1, 2003 21:59:41 GMT -5
thanks web and tewl, the site on listviews is good..shows how to put icons in web, if i use your trigger, ill have to change my server2_dataarrival to use cases like your ircbrowser....is it faster? looks a lot less complicated
|
|
|
Post by Vertigo on Jun 1, 2003 22:23:10 GMT -5
well, im starting to understand how it does it a bit better, and ive used webs readnames, and its now down to 2 columns....im getting somewhere i spose
*edit...bugger...its still on 3 columns, i was just in a room with less ppl...i can take a screenshot, but cant think of where to post it so you guys can see it
*final edit...fixed it up listviews have a view property, kinda like explorer in windows. it was set to icons....so i changed it to small icons and all was fixed. now i think ill start putting the icons into it
|
|
|
Post by Webagent007 on Jun 2, 2003 2:57:51 GMT -5
glad you fixed it Yes select cases are faster, faster then when you use "if" statements all the time. What I do (didn't do it in the example I gave www.webagent007.org/programmertools/IRCBrowser.zip) is you have several raw numbers you only get while joining, once you joined a room, you dont need to check the "910 (info outdated)" "913 (banned)" or all the things you get before you actually joined (a whole lot!) so what I do is I make a select case on the joining process, for example CMode = 0 is when you loaded up the bot, CMode = 1 is while connecting and CMode = 2 is when you actually joined the channel, why do I do this? it saves checking for all those things you don't need once you have joined, thus... it makes it faster, the less code or parsing the raw data has to go through, the faster it will be. so I have select cases on the join process, then once I am joined I select on "Select Case UCase(Split(sLine, " ")(1))" and sLine doesnt have the "vbCrLf" or unnessecary stuff cause thats what it is splitted on before I send it to the parser (that you can see in example) you can select in this stage on "MODE", "KICK", "PRIVMSG" but also "PROP" and as you know there are alot of props and modes, so what if you want to do something if a mode is changed? you fist make it select the "MODE" case, and inside that you make it select wich mode you want by making a new select case inside there, fore example br] Case "MODE" sNick = (Left$(sLine, InStr(sLine, "!") - 1)) sNick = Right$(sNick, Len(sNick) - 1) sMode = Split(sLine, " ")(3) sTemp = Trim$(Split(sLine, sMode)(1)) WriteLog sNick & " sets mode " & sMode & " " & sTemp, RGB(0, 100, 200) Select Case LCase(sMode) Case "+o"
so why is this faster? the process will only get to the point of Case "+o" when there is actually a mode change detected, now if you use "if" statements for everything, then the code goes thourg all of it every time, even if it's a kick etc.. I hope that makes it clear, its simply make the the route as short as possible, and make sure you dont check extra for things you dont need at that stage.. the less lines you use the faster it will be
|
|
|
Post by Vertigo on Jun 2, 2003 8:47:32 GMT -5
thanks web nice and clear ..understood it all sure im gonna be posting here more.....still go lots 2 learn
|
|
Trad
New Member
Posts: 1,122
|
Post by Trad on Jun 4, 2003 4:41:07 GMT -5
How long have you been learning VB? Vertigo?
|
|
|
Post by Vertigo on Jun 4, 2003 8:28:21 GMT -5
well only been seriously doing it since start of this yr b4 that i just messed around with it at school to open command prompts and explorer..cause they disabled access to it thru normal ways
lately its all i been doing now...practically given up scripting, only use script to test my bot and its coming along half decently. been reading thru the old vb forum, and picking up some stuff that i need.
one problem i am having atm though...when i remove an item from the listview...it leaves a blank space. ne ideas on that?
|
|
|
Post by Dynamic Sysop on Jun 4, 2003 16:54:23 GMT -5
refresh the listview
|
|
|
Post by Vertigo on Jun 4, 2003 17:40:19 GMT -5
listview1.refresh? cause ive got that in my user part under remove item and it doesnt seem to help Set itmFound = frmC.ListView1.FindItem(uName) itmFound.EnsureVisible itmFound.Selected = True part = frmC.ListView1.SelectedItem.Index frmC.ListView1.ListItems.Remove (part) frmC.ListView1.Refresh
that seems to work fine except for when the person is gold, but im working on that. was up till 2 last nite working on variables getting the room name and username, cause when i was trying to prop an ownerkey it didnt work, problem was there was lf at the end of it which was getting set in the variable, so when i tried to send it, it split the prop up. fixed that now though also kinda worked out bit more about the actual connection, using ethereal and my debug window had a better look at it all.
|
|