Valhalla Legends Archive

Programming => General Programming => Visual Basic Programming => Topic started by: zeth369 on October 09, 2004, 08:27 AM

Title: when someone joins....
Post by: zeth369 on October 09, 2004, 08:27 AM
how do i get the product code to change to something like "STarCraft" or "StarCraft BroodWar"?

i got this.. but it wont work..

If frmSettings.Check2.Value = vbChecked Then
ElseIf Product = "RATS" Then
AddChat vbGreen, "-- ", vbYellow, Username & " [" & Ping & "ms] ", vbGreen, "has joined the channel using StarCraft."
ElseIf Product = "PXES" Then
AddChat vbGreen, "-- ", vbYellow, Username & " [" & Ping & "ms] ", vbGreen, "has joined the channel using StarCraft BroodWar."
End If
Title: Re: when someone joins....
Post by: hismajesty on October 09, 2004, 09:08 AM
QuotePublic Function ExplodeClient(product As String) As String

Select Case UCase(product)
    Case "STAR"
        ExplodeClient = "Starcraft"
    Case "SEXP"
        ExplodeClient = "Starcraft: Broodwar"
    Case "JSTR"
        ExplodeClient = "Starcraft: Japanese"
    Case "SSHR"
        ExplodeClient = "Starcraft: Shareware"
    Case "W2BN"
        ExplodeClient = "Warcraft II: Battle.net Edition"
    Case "WAR3"
        ExplodeClient = "Warcraft III: Reign of Chaos"
    Case "W3XP"
        ExplodeClient = "Warcraft III: The Frozen Throne"
    Case "DRTL"
        ExplodeClient = "Diablo Retail"
    Case "DSHR"
        ExplodeClient = "Diablo Shareware"
    Case "D2DV"
        ExplodeClient = "Diablo II"
    Case "D2XP"
        ExplodeClient = "Diablo II: Lord of Destruction"
    Case "CHAT"
        ExplodeClient = "chat bot"
    Case Else
        ExplodeClient = "an Unknown Product"
End Select

End Function

Usage:
QuoteAddChat("User joined using product " & ExplodeClient(product)
Title: Re: when someone joins....
Post by: zeth369 on October 09, 2004, 09:34 AM
thank you.. :) it works..
Title: Re: when someone joins....
Post by: Grok on October 09, 2004, 02:33 PM
Another way -- use a resource file with a string table.
Title: Re: when someone joins....
Post by: Tuberload on October 09, 2004, 07:51 PM
Quote from: Grok on October 09, 2004, 02:33 PM
Another way -- use a resource file with a string table.

To try and elaborate more on this, the reason this method would be more beneficial is it would keep you from having to update the bots code when new products types need to be added. All you would have to do is update the resource file.