Magnum smirks amusingly.
Here's some code from my own script file:
Const vbsTrue = 1
Const vbsFalse = 0
' ------------------------------------------------------------
Sub Join_Party (thename, theoutput, arrWildcards)
World.SetVariable "InParty", True
World.SetVariable "InPartyStatus", "InParty: Yes"
World.Note World.GetVariable("InPartyStatus")
World.SpeedWalkDelay = 250
Display_StatusLine()
World.EchoInput = vbsTrue
End Sub
Sub Quit_Party (thename, theoutput, arrWildcards)
World.SetVariable "InParty", False
World.SetVariable "InPartyStatus", "InParty: No"
World.Note World.GetVariable("InPartyStatus")
World.SpeedWalkDelay = 0
Display_StatusLine()
World.EchoInput = vbsTrue
End Sub
Sub Toggle_InParty (thename, theoutput, arrWildcards)
If World.GetVariable("InParty") Then
Quit_Party "Toggle_InParty", "-", "-"
Else
Join_Party "Toggle_InParty", "-", "-"
End If
End Sub
' ------------------------------------------------------------
I keep track of weather I am in a party or not using triggers, so that I don't send party tells when I am not actually in a party...
<triggers>
<trigger
enabled="y"
match="dissolved the party."
name="Party_Dissolved"
regexp="y"
script="Quit_Party"
sequence="100"
>
</trigger>
</triggers>
<triggers>
<trigger
enabled="y"
match="You create a party."
name="Party_Create"
script="Join_Party"
sequence="100"
>
</trigger>
</triggers>
<triggers>
<trigger
enabled="y"
match="You join * party."
name="Party_Join"
script="Join_Party"
sequence="100"
>
</trigger>
</triggers>
<triggers>
<trigger
enabled="y"
match="You left the party."
name="Party_Leave"
script="Quit_Party"
sequence="100"
>
</trigger>
</triggers>
<triggers>
<trigger
enabled="y"
match="You were kicked out of the party."
name="Party_Kicked"
script="Quit_Party"
sequence="100"
>
</trigger>
</triggers>
In case one of the triggers fails to fire for some reason, or due to whatever error, I can toggle the status with an alias:
<aliases>
<alias
name="Set_Toggle_InParty"
script="Toggle_InParty"
match="inparty"
enabled="y"
ignore_case="y"
>
</alias>
</aliases>
Back to my script, I can now present messages according to my party status. Here's one example:
Sub Display_End_Inspiration (thename, theoutput, arrWildcards)
If World.GetVariable("InParty") Then
World.EchoInput = vbsFalse
LogSend "party emote no longer feels inspired."
End If
World.EchoInput = vbsTrue
End Sub
(There are calls made from some of the above routines to other routines I have not quoted)
If EchoInput ever fails for some reason (and it did a ton in that older version that was bugged), I can turn it back on quickly with an alias:
<aliases>
<alias
name="Set_Echo_On"
script="Echo_On"
match="eon"
enabled="y"
>
</alias>
</aliases>
...which calls this small subroutine:
Sub Echo_On (thename, theoutput, arrWildcards)
World.EchoInput = vbsTrue
End Sub
As you can see in my "Inparty" code, I sometimes put a "World.EchoInput" in a subroutine even though I never turned it off... that was mostly a holdever from the bugged version, and I had almost every routine turn it back on just before the 'End Sub'.
Well, how's this for spam?
Magnum grins demonically. |