Problems with an Auto Sip Subroutine

Posted by Gore on Fri 01 Oct 2004 10:02 PM — 6 posts, 23,248 views.

#0
Hello, I'm not sure what my problem is with this paticular subroutine, but it won't call at all from my prompt plugin.

I think the problem lies with the Subroutine itself?
Quote:


Dim maxhealth, maxmana, curhealth, curmana, autosip
Dim prevhealth, prevmana, health_mana_override, automoss

Sub Auto_Sipping
  If AutoSip = 1 & drinkbalance = 1 then
  world.note "auto sip is on same with drink balance"
    If health_mana_override = "health" then
    world.note "health mana override for health"
      If curHealth < (.85 * maxHealth) then
        Drink_Health
      ElseIf curMana < (.85 * maxMana) then
      World.Note "Gotta sip mana"
        Drink_Mana
      End If
    ElseIf health_mana_override = "mana" then
      If curMana < (.85 * maxMana) then
        Drink_Mana
      ElseIf curHealth < (.85 * maxHealth) then
        Drink_Health
      End If
    End If
  End If
  'If AutoMoss = 1 & mossbalance = 1 then
  '  If curHealth < (.75 * maxHealth) or curMana < (.75 * maxMana) then
  '    Eat_Moss
  '  End If
  '	End If
End Sub


Any suggestions?
USA #1
Is it called from a trigger?

If so, you need the arguements.

Auto_Sipping(sName, sLine, aryWild)
#2
nopem it's called from that muti-line plugin Nick wrote for prompts
#3
Quote:
sub OnPluginPartialLine (sText)
Dim regEx, Matches, Match

' Make a regular expression to match on the line:
 
  Set regEx = New RegExp

'  exit CDATA block so we can use the trigger entity

]]>

  regEx.Pattern = "&regexp_match;"

<![CDATA[

'  Execute regular expression

  Set Matches = regEx.Execute (sText)

'  Exit if no match
 
  if Matches.Count = 0 then  
    Set regEx = Nothing
    Set Matches = Nothing
	exit sub
  end if

  Set Match = Matches.Item (0)

  Set regEx = Nothing
  Set Matches = Nothing
  
  prevhealth = curhealth
  premana = curmana
  
  curHealth = Match.SubMatches (0)
  curMana = Match.SubMatches (1)

  Auto_Sipping
  
  Set Match = Nothing

End sub
#4
I'm such an idiot, I figured out the answer to my problem.

For anyone who experienced a similar problem, I guess

If blah = blah & blah = blah doesn't work, not sure why, but it doesn't
USA #5
& is for string concatenation, try using AND
and you might be safer using parentheses.
if ((asdf = asdf) AND (asdf = asdf))
Just to be sure.