Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Values / Char comparison If Statements

Status
Not open for further replies.

GoLoGo

IS-IT--Management
Feb 4, 2009
1
My problem is that myAccess = 999 myFlags = "G" but the script does not work unless myAccess = 10 and myFlags = "G"

what im trying to do is make it so it executes with out problem with any value that myAccess returns that is equal to 10 or greater with or with out myFlags = "G"

Code:
Sub weatherinfo_Event_UserTalk(Username, Flags, Message, Ping)
  If Left(LCase(Message), 9) = BotVars.Trigger & "weather " Then
    GetDBEntry Username, myAccess, myFlags
    If Username = Botvars.Username AND Ping = -4 Then
      VetoThisMessage
    Else
      If myAccess < WeatherAccess and inStr(UCase(myFlags), WeatherFlag) = 0 Then Exit Sub
    End If
    
    success = false
    Location = Trim(Mid(Message, 10))
    Call DisplayTodaysWeather(Location)
  End If
 
  If Left(LCase(Message), 10) = BotVars.Trigger & "forecast " Then
    GetDBEntry Username, myAccess, myFlags
    If Username = Botvars.Username AND Ping = -4 Then
      VetoThisMessage
    Else
      If myAccess < WeatherAccess and inStr(UCase(myFlags), WeatherFlag) = 0 Then Exit Sub
    End If
    
    success = false
    Location = Trim(Mid(Message, 11))
    Call DisplayAllWeather(Location)
  End If
End Sub
 
Sub weatherinfo_Event_WhisperFromUser(Username, Flags, Message)
  Call weatherinfo_Event_UserTalk(Username, Flags, Message, -3)
End sub
 
Sub weatherinfo_Event_PressedEnter(Text)
  Call weatherinfo_Event_UserTalk(BotVars.Username, 0, Text, -4)
End Sub
 
So if I understand you right you don't want to filter on MyFlags and ONLY want to filer on MyAccess. Is that correct?

Code:
If MyAccess > 9 Then
    'code to execute
Else
     'do nothing
End If

IF you want to only process for MyAccess when MyFlags = G then nest it.

Code:
If UCase(MyFlags) = "G" Then 
    If MyAccess > 9 Then
        'code to execute
    Else
         'do nothing
    End If
End If



I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top