Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ Problems with an Auto Sip Subroutine

Problems with an Auto Sip Subroutine

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Gore   (207 posts)  Bio
Date Fri 01 Oct 2004 10:02 PM (UTC)
Message
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?
Top

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #1 on Fri 01 Oct 2004 10:38 PM (UTC)
Message
Is it called from a trigger?

If so, you need the arguements.

Auto_Sipping(sName, sLine, aryWild)

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
Top

Posted by Gore   (207 posts)  Bio
Date Reply #2 on Fri 01 Oct 2004 10:59 PM (UTC)
Message
nopem it's called from that muti-line plugin Nick wrote for prompts
Top

Posted by Gore   (207 posts)  Bio
Date Reply #3 on Fri 01 Oct 2004 11:01 PM (UTC)
Message
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
Top

Posted by Gore   (207 posts)  Bio
Date Reply #4 on Sat 02 Oct 2004 05:52 AM (UTC)
Message
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
Top

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #5 on Sat 02 Oct 2004 07:19 AM (UTC)
Message
& is for string concatenation, try using AND
and you might be safer using parentheses.
if ((asdf = asdf) AND (asdf = asdf))
Just to be sure.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


22,086 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.