• Welcome to Valhalla Legends Archive.
 

icon trouble

Started by QwertyMonster, January 29, 2005, 09:47 AM

Previous topic - Next topic

QwertyMonster

Hello, some of you may know me, some might not!

i am trying to program icons into my bot. So far i have this



Function Icons()

             If product = "STAR" Then
                frmMain.ListView1.ListItems.Add , , Username, 1
            Else
             If product = "SEXP" Then
                frmMain.ListView1.ListItems.Add , , Username, 2
            End If
               End If

End Function



I have the Starcraft and Starcraft: Broodwar images in my "ImageList1", as 1 & 2.

I put

Function Icons(ByVal Product As String)


and i get "Arguement not optional". So i put


Function Icons (Optional ByVal product as string)


and i get no error but no icons either!


If somebody could help me please i would appreciate it !


{{{ == QwertyMonster == }}}

Blaze

Are your sure the product your getting isn't "RATS" or "PXES"?
Quote
Mitosis: Haha, Im great arent I!
hismajesty[yL]: No

Newby

Try using a switch statement instead of your horrible set of if statements.

Err, select case.
- Newby

Quote[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

Quote<TehUser> Man, I can't get Xorg to work properly.  This sucks.
<torque> you should probably kill yourself
<TehUser> I think I will.  Thanks, torque.

QwertyMonster

#3
I put


Msgbox Product

to see what the product actually is, and i got nothing ;(

i will now try your idea newby

thanks
btw did i post this in the wrong forum? should i post it "Bot devolpment" forum, or is it ok here?
{{{ == QwertyMonster == }}}


[EDIT]

Has anybody any ideas why i get
"Arguement Not Optional"
when i have

Function Icons (Byval product as string)

and when i dont have it its ok but doesnt work?

Newby

#4
Try something like this (psuedo-code)


Public Function GetIconCode(ByVal Product As String) As Integer
    Select Case UCase(Product)
        Case "RATS" ' Starcraft
            GetIconCode = 1
        ' Put cases for all the rest of the products
    End Select
End Function

And call it as such:

Call listview.listitems.add(username, , , GetIconCode(Product))
I haven't touched any Visual Basic for projects of mine in a while. :(
- Newby

Quote[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

Quote<TehUser> Man, I can't get Xorg to work properly.  This sucks.
<torque> you should probably kill yourself
<TehUser> I think I will.  Thanks, torque.

QwertyMonster

whats the


UCase(Product)


mean? explain what that bit is doing please



ooooooh i see it! thanks for this help newby!

[ still explain what the UCase(Product) bit does though :) ]

QwertyMonster

#6
Umm i have tried it, and it doesnt add icon, :(

Anybody got any ideas?

Newby

Are you passing in anything when you pass in the product?

UCase(string) makes the string all uppercase.

Example: Hello there! becomes HELLO THERE!
- Newby

Quote[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

Quote<TehUser> Man, I can't get Xorg to work properly.  This sucks.
<torque> you should probably kill yourself
<TehUser> I think I will.  Thanks, torque.

QwertyMonster

Well what i have is:



If Mid(data,5,1) = chr(1) then
        If Mid(Data, 5, 1) = Chr(1) Then

        Call ListView1.ListItems.Add(, , Username, everything.Icons(product))

End if



If i just put


Icons(Product))

i get "Sub or function not defined"

so i put


Everything.Icons(Product))
and it worked

im sure im passing through something when i pass in the product ..  :-\ :-\ :-\

QwertyMonster

oh btw Newby, can you add me on msn so we can talk better? ive just added you now

QwertyMonster

Ok, after help from Newby i finally am getting somewhere :)

By using F9 and F5 I saw that my bot was seeing the icons should be starcraft. But my bot doesnt add them as starcraft and just misses it all out!

Newby was thinking the product wasnt being passed in and wasnt correct for the icons to show. I do too think that is right.

But my question is, how do i "send the right pass product in".

Thanks all.

QwertyMonster

Ok. After spending time and looking at my code i relised something was odd.

For just a test i just put the normal code to add a icon, to find that it doesnt add it!

Im thinking maybe the icons are transparent, or maybe its me just coding it wrong?

I have in my ImageList
1- Starcraft icon
2 - Broodwar icon

at the moment


ListView1.listitems.add, ,frmconfig.username , 1


I have that in form_load just for a test and it shows only the username but with a blank square infront. i had it working once, but now it seems dodgey

Maybe they are transparent or something? Because it happens when i add the correct product for other users as well.

Please help  :-[ :'(

Warrior

Are you initializing the imagelist?



-- Also how can you have made a Bot and not know what UCase does?
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?

QwertyMonster

Cos i dont use UCase Much o_O

Warrior

You still should know what it does. I mean it is self explanitory

LCase() uses the lowercase form of a string
UCase() uses the uppercase form of a string

Was that so hard?
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?