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 ➜ VBscript ➜ Piece of code -> Could use a little help debugging..

Piece of code -> Could use a little help debugging..

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


Posted by Gore   (207 posts)  Bio
Date Tue 10 Feb 2004 05:51 AM (UTC)
Message
Alright, I'm having a little trouble with this subroutine. Here's the Sub:


Quote:

Sub bow_toggle (a,b,wildcard)
  If bowon = "1" then
    World.Note "NO SHOOTING"
    bowon = "0"
    World.Send "unwield " & bow
    World.Send "wear "& bow
    if weapon = "whip" then 
     World.Send "get " & whip & " from bag"
     World.Send "wield " & whip
    Elseif weapon = "dirk" then
      World.Send "get " & whip & " from bag"
      World.Send "wield " & whip
    End If
    If armor = "blunt" then
      World.Send "get " & bshield & "  from bag"
      World.Send "wield " & bshield
    Elseif armor = "cut" then
      World.Send "get " & cshield & "  from bag"
      World.Send "wield " & cshield
    End If
  Elseif bowon = "0" then
    World.Note "SHOOTING"
    bowon = "1"
    If weapon = "whip" then
      World.Send "unwield " & whip
      World.Send "put " & whip & " in bag"
    Elseif weapon = "dirk" then
      World.Send "unwield " & dirk
    End If
    If armor = "blunt" then
      World.Send "unwield " & bshield
      World.Send "put " & bshield & " in bag"
    Elseif armor = "cut" then
      World.Send "unwield " & cshield
      World.Send "put " & cshield & " in bag"
    End if
    World.Send "remove " & bow
    World.Send "wield " & bow
  End if
End Sub



What it's supposed to do is: If the toggle is set to shoot, i'll set the toggle to "not shoot", unwield my bow, then wield a shield, blunt or cut, depending on the variable, and wield a dirk or whip, depending on the variable.

If the toggle is set to not shoot, it'll unwield the dirk or whip depending on the variable, unwield my shield, and wield my bow, Simple enough.

Here's what it actually does -

If the variable bowon = 1, then it'll do

Quote:
NO SHOOTING
unwield darkbow59678
wear darkbow59678
get whip244566 from bag
wield whip244566
get shield186377 from bag
wield shield186377


but if the variable bowon = 0, then it'll do

Quote:
SHOOTING
unwield dirk261597
unwield shield186377
put shield186377 in bag
remove darkbow59678
wield darkbow59678


Meaning, it tries to wield my whip each time when I turn shooting off, and it'll unwield my dirk each time when I turn shooting on, regardless of whether I'm supposed to wield/unwield the dirk or wield/unwield the bow.

Could anyone help me debug this?
Top

Posted by Gore   (207 posts)  Bio
Date Reply #1 on Tue 10 Feb 2004 05:53 AM (UTC)
Message
Ah, just in case, here's what is in all of the variables:

dirk = dirk261597
whip = whip244566
bshield = shield186377
cshield = shield92797
bow = darkbow59678

Sorry about that.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #2 on Tue 10 Feb 2004 06:01 AM (UTC)
Message
For one thing, this looks wrong:

Elseif weapon = "dirk" then
World.Send "get " & whip & " from bag"
World.Send "wield " & whip
End If

You are saying if the weapon is a dirk you are getting the whip.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Gore   (207 posts)  Bio
Date Reply #3 on Tue 10 Feb 2004 06:20 AM (UTC)
Message
Alright, thanks again. I knew it was something simple that I kept overlooking.
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.


16,384 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.