VB6 AddTrigger(Ex) Question/Problem

Posted by Onoitsu2 on Tue 31 Jan 2006 07:35 AM — 3 posts, 15,101 views.

USA #0
I am having a problem sending the following from within a VB Application made with VB6. I got the main concepts for mushclient from the super hp bar, which I as far have perfected for my own use on Aardwolf (aardmud.org), such as the theworld.XXX i have declared as public in a module, and I get the syntax popup to aid in the commands.

I get the following error message from the code following:
"Object variable or With block variable not set"


Dim TriggerName, TriggerMatch, ResponseText, SoundFileName, ScriptName As String
Dim Flags As Long
Dim Colour, Wildcard, SendTo, Sequence As Integer
TriggerName = "HB_Trigger"
TriggerMatch = "^\<(\d+)\/(\d+)hp (\d+)\/(\d+)mn (\d+)\/(\d+)mv (\d+)tnl Gold: (\d+)(\w?\w?(.*?))?\>"
ResponseText = ""
Flags = eEnabled + eTriggerRegularExpression
Colour = -1 'No Colour Change
Wildcard = 0 'Do Not Copy Any Wildcard To Clipboard
SoundFileName = "-1"
ScriptName = "-1"
SendTo = 0 'Send To World = 0, Sent To Command = 1, Send To Script = 12
Sequence = 100

result = theworld.AddTriggerEx("TriggerName", "TriggerMatch", "ResponseText", Flags, Colour, Wildcard, "SoundFileName", "ScriptName", SendTo, Sequence)
theworld.Note "test"


In the super bar however I have a wimpy option added, that sends whatever wimpy command is to the mud when HP is less than or equal to the wimpy value.

Do I have to call MY program from inside a plugin, and pass the callingworld option like I see in the super bar?

OR

Can I get the "callingworld" from the mushclient program from some function, or built in COM command ?

Any advice on this topic would be great.

Thanks in advance,
Onoitsu2
Australia Forum Administrator #1
Quote:

result = theworld.AddTriggerEx("TriggerName", "TriggerMatch", "ResponseText", Flags, Colour, Wildcard, "SoundFileName", "ScriptName", SendTo, Sequence)


Your first problem is you are quoting what appear to be variable names. It should read:


result = theworld.AddTriggerEx(TriggerName, TriggerMatch, ResponseText, Flags, Colour, Wildcard, SoundFileName, ScriptName, SendTo, Sequence)


Second, I wouldn't have:


ScriptName = "-1"


There won't be a script function called "-1". Just leave it empty if you don't want to call a script. Ditto for sound file name.

As for what calls what, where does all this start? In MUSHclient, calling a script, or are you trying to call MUSHclient from a VB application?
Amended on Tue 31 Jan 2006 09:29 AM by Nick Gammon
USA #2
I have tried with and without the quotes, with and without the -1 in the script field.

This is to be in a VB6 App, so I can run it independently from mushclient, and control mushclient, so there is no plugin installing needed, as lots of people on my mud do not know how to install a plugin ...

Thanks,
Onoitsu2