Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: QwertyMonster on February 07, 2005, 12:58 PM

Title: Trouble :(
Post by: QwertyMonster on February 07, 2005, 12:58 PM
Hmm, yeah thats right. I have trouble!  :'(

I have been trying to add icons into my bot for a good old 4 months now. I can tell it to add icons ect.. but i cant give the proper icon.


First of all i have


Public Function Icons(ByVal Product As String) As Integer


Select Case UCase(Product)

Case "RATS" ' <-- Starcraft (STAR = RATS)
Icons = 0
Case "PXES" ' <-- Broodwar (SEXP = PXES)
  Icons = 2
Case "STAR" ' <-- Starcraft Client
  Icons = 1
Case "SEXP" ' <-- Broodwar Client
Icons = 2
End Select
'MsgBox Icons
End Function


Just to test our sc and bw icons.

Then i have
       

If Mid(Data, 5, 1) = Chr(1) Then
     
        Icons = Everything.Icons
         
         ListView1.ListItems.Add , , Username, , Icons

   End if



And it just comes up as this

Example:
                                 Op [vL] (10)
                                          Arta[vL]
                                    ^ icon should be there but isnt?


Any ideas is appreciated. Thanks in advance people!
Title: Re: Trouble :(
Post by: Spilled on February 07, 2005, 01:41 PM
Have you added the image list and public'd the constants in your module for each icon? and is that all the code you have to show us because its not much to go on...
Title: Re: Trouble :(
Post by: QwertyMonster on February 07, 2005, 01:43 PM
Quote from: Spilled[DW] on February 07, 2005, 01:41 PM
Have you added the image list and public'd the constants in your module for each icon?

Oops Shite, totally forgot bout that lol.

Yeah that is all the code i have. Chr(1) is requesting the Userlist @ connect, and whats point on showing chr(2) (user join) when its basically the same as chr(1).


I will public my constants in my module. Keep advanced here for updates.
Title: Re: Trouble :(
Post by: Soul Taker on February 07, 2005, 01:48 PM
Having a variable and a function which is assigning values to that variable use the same name is probably not a good idea.
Title: Re: Trouble :(
Post by: QwertyMonster on February 07, 2005, 02:37 PM
This might be a "dodgey" way but.

I have it saying


    If Mid(Data, 5, 1) = Chr(1) Then
          If strText = "VD2D" Then
          ListView1.ListItems.Add , , Username, , 5
       End if
           End if


Just to test D2. And it works!

But thats because D2 has no stats. Now when my strText = "RATS 0 0 0 0 0 0 0 RATS" the icon wont show. But anyway, i will fix it soon. But i would like to know wether you think its a good way or a dodgey way?
Title: Re: Trouble :(
Post by: tA-Kane on February 07, 2005, 04:25 PM
Indeed, it'd be a dodgy way... as in, it won't work if the statstring contains anything other than the user's product.

Try using left() on the strtext before you compare, like so:
if left(strText, 4) = "VD2D" then
Title: Re: Trouble :(
Post by: QwertyMonster on February 08, 2005, 10:01 AM
Ahh yeah, thanks.

I know my way is dodgey, but im finding it hard to find any other way. If it is dodgey, i will keep making it better and better :)

Keep posted here incase any more trouble :) (im sure i will haha ;D)
Title: Re: Trouble :(
Post by: Spilled on February 08, 2005, 10:24 AM
As Kane said your way is a dodgey way but use this way to play around with it until you see exactly how things work and then work your way up is the best advice i can give you thats how i learned how to deal with icons.
Title: Re: Trouble :( [SOLVED]
Post by: QwertyMonster on February 08, 2005, 10:26 AM
Woohoo, i finally got all icons working now

Thanks to: tA-Kane Mostly :D

Thanks to everyone who helped
Title: Re: Trouble :(
Post by: tA-Kane on February 08, 2005, 03:03 PM
You're welcome.
Title: Re: Trouble :(
Post by: QwertyMonster on February 09, 2005, 11:34 AM
Ok, maybe i havent got ALL icons working yet.

Im just woundering, If Starcraft = "RATS", then what is it for Starcraft Spawn and Gavel?

Is Starcraft Spawn: SSPW ? (Just a guess:P)

If somebody could tell me, would be big help. thanks
Title: Re: Trouble :(
Post by: OnlyMeat on February 09, 2005, 11:52 AM
Quote from: QwertyMonster on February 09, 2005, 11:34 AM
Ok, maybe i havent got ALL icons working yet.

Im just woundering, If Starcraft = "RATS", then what is it for Starcraft Spawn and Gavel?

Is Starcraft Spawn: SSPW ? (Just a guess:P)

If somebody could tell me, would be big help. thanks

The gavel is actually a flag, the product code remains the same.
Title: Re: Trouble :(
Post by: QwertyMonster on February 09, 2005, 11:58 AM
What about Starcraft Spawn ?
Title: Re: Trouble :(
Post by: QwertyMonster on February 09, 2005, 12:02 PM
Hmm you said it stays the same, would i put


If Left(Strtext, 4) = "GAVEL" then
blah blah
Else
If Left(Strtext, 4) = "LEVAG" then
blah blah
Else
If Left(Strtext, 4) = "ICON_GAVEL" then
blah blah
End If
End If
End if


Are any of those right, or am i totally wrong? Because NONE of them work.
Title: Re: Trouble :(
Post by: Zakath on February 09, 2005, 12:35 PM
You're approaching it COMPLETELY wrong. It is NOT a product code. The gavel information is stored in the user's FLAGS.
Title: Re: Trouble :(
Post by: MyndFyre on February 09, 2005, 01:36 PM
Quote from: QwertyMonster on February 09, 2005, 12:02 PM
Hmm you said it stays the same, would i put


If Left(Strtext, 4) = "GAVEL" then
blah blah
Else
If Left(Strtext, 4) = "LEVAG" then
blah blah
Else
If Left(Strtext, 4) = "ICON_GAVEL" then
blah blah
End If
End If
End if


Are any of those right, or am i totally wrong? Because NONE of them work.

ROFL!  First of all, do you even program?  Do you know that the second parameter in the Left(string, integer) function is for "Length"?  How can ANYTHING of length 4 equal a string of length 5?

Second, bitwise flags are what Zak is talking about; use the binary nature of numbers in computing to store multiple true/false values.  To test if flag 1 is set, for example, you would:

If (value And 1) <> 0 Then
  ' Flag 1 is set.
End If
Title: Re: Trouble :(
Post by: QwertyMonster on February 09, 2005, 02:02 PM
Yeah when relooking at my code i saw i put 4, but anway that was fixed after i just posted.

Hmm seem to be understand, ill do some testing.
Title: Re: Trouble :(
Post by: QwertyMonster on February 09, 2005, 02:30 PM
Umm ok i nearly there, but what about Starcraft Spawn, is that in the flags aswell ?
Title: Re: Trouble :(
Post by: UserLoser. on February 09, 2005, 02:31 PM
Quote from: QwertyMonster on February 09, 2005, 02:30 PM
Umm ok i nearly there, but what about Starcraft Spawn, is that in the flags aswell ?

No, a user's product is the first part of the user's statstring which is viewable in chat channels

Edit: was thinking Starcraft Shareware, not Spawn.  But anyways, IIRC it's the fifth part of statstring which contains spawn boolean value
Title: Re: Trouble :(
Post by: QwertyMonster on February 09, 2005, 02:56 PM
Oh right. Ok, i kind of got it now.

But now i have another question.


How would i make my bot see a name for a command to trigger

Like this


If UCase(Username) = "QwertyMonster" then
blah blah


That would mean my name HAS to be QwertyMonster.

What would i put so it can be anything like QweRTYMonSteR, QwertMonster like that

I havent really used things like that much, help is thanks.
Title: Re: Trouble :(
Post by: Soul Taker on February 09, 2005, 03:47 PM
"EVIL_MARINE".
Title: Re: Trouble :(
Post by: QwertyMonster on February 09, 2005, 03:55 PM
Yeah, that was just an example, at first i did have "SouL TaKeR and SOUL TAKER" but then changed to evil_marine one cos it looked better, ok now its my name..
Title: Re: Trouble :(
Post by: Joe[x86] on February 09, 2005, 05:13 PM
UCase will NEVER == something with a lowercase letter in it.

If (UCase(Username) = UCase("QuertyMonster") Then

That'll work though.
Title: Re: Trouble :(
Post by: tA-Kane on February 09, 2005, 06:20 PM
Quote from: UserLoser on February 09, 2005, 02:31 PM
Quote from: QwertyMonster on February 09, 2005, 02:30 PM
Umm ok i nearly there, but what about Starcraft Spawn, is that in the flags aswell ?

No, a user's product is the first part of the user's statstring which is viewable in chat channels
UserLoser is correct, however, the product is not where the "spawn" flag is specified. It's not in the user's flags, either. The spawn flag is in the statstring. I do not remember which one, though. Consult BnetDocs (http://bnetdocs.valhallalegends.com).
Title: Re: Trouble :(
Post by: QwertyMonster on February 10, 2005, 02:00 AM
Thanks u lot, nearly got it working now
Title: Re: Trouble :(
Post by: QwertyMonster on February 11, 2005, 12:16 PM
Quote from: JoeTheOdd on February 09, 2005, 05:13 PM
UCase will NEVER == something with a lowercase letter in it.

If (UCase(Username) = UCase("QuertyMonster") Then

That'll work though.

It doesnt =[
Look, i have



If (UCase(Username)) = UCase("QwertyMonster") And UCase(Mid(strText, 1, 6)) = frmConfig.trigger.Text & "home " Then


A msgbox comes up as QwertyMonster -> QWERTYMONSTER, Not QwertyMonster, what do i put for it to read exactly what the name is?
Title: Re: Trouble :(
Post by: Blaze on February 11, 2005, 03:01 PM
Quote from: QwertyMonster on February 11, 2005, 12:16 PM
If (UCase(Username)) = UCase("QwertyMonster") And UCase(Mid(strText, 1, 6)) = frmConfig.trigger.Text & "home " Then

The home isn't upper case, so it will never match.
Title: Re: Trouble :(
Post by: QwertyMonster on February 12, 2005, 10:06 AM
oh fk i didnt see that, nice spotting :D