Daved2008-11-07 23:13:01
I'm attempting to create a prompt trigger using regex, my scripting language is VBscript I have config wrapwidth 0, and MUSH is auto-wrapping at column 80
this is my prompt trigger:
^\\d+h, \\d+m, \\d+e, \\d+p, \\d+en, \\d+w \\w+-$
I have enabled, and regular expression checked, but for some reason, it only matches on newline, and then causes my prompt to double-up on the next line like so:
How do I resolve that problem so that the trigger matches on every prompt and doesn't cause that oddity with the next prompt?
Following that, how would I capture my current health, ego, mana and power into individual variables?
this is my prompt trigger:
^\\d+h, \\d+m, \\d+e, \\d+p, \\d+en, \\d+w \\w+-$
I have enabled, and regular expression checked, but for some reason, it only matches on newline, and then causes my prompt to double-up on the next line like so:
QUOTE
3673h, 2190m, 2757e, 10p, 15835en, 9220w elrx-
3673h, 2190m, 2757e, 10p, 15835en, 9220w elrx-3673h, 2190m, 2757e, 10p, 15835en, 9220w elrx-
3673h, 2190m, 2757e, 10p, 15835en, 9220w elrx-3673h, 2190m, 2757e, 10p, 15835en, 9220w elrx-
How do I resolve that problem so that the trigger matches on every prompt and doesn't cause that oddity with the next prompt?
Following that, how would I capture my current health, ego, mana and power into individual variables?
Unknown2008-11-07 23:16:46
CONFIG PROMPT ADD LINEBREAK
Daved2008-11-07 23:22:15
Great, thank you!
Mariello2008-11-07 23:54:46
CODE
^(\\d+)h\\, (\\d+)m\\, (\\d+)e\\, (\\d+)p\\, \\d+en\\, \\d+w (.*?)\\-$
world.setvariable "health", %1
world.setvariable "mana", %2
world.setvariable "ego", %3
world.setvariable "power", %4
world.setvariable "prompt", "%5"
world.setvariable "health", %1
world.setvariable "mana", %2
world.setvariable "ego", %3
world.setvariable "power", %4
world.setvariable "prompt", "%5"
Daved2008-11-08 01:03:29
What is the backslash before the comma for?
Also, when I put the world.setvariable commands in there, it just started spamming them, sending them to the MUD rather than changing the variable
Also, when I put the world.setvariable commands in there, it just started spamming them, sending them to the MUD rather than changing the variable
Esano2008-11-08 01:07:14
It's an escape key - it means don't parse the next character for regex meaning. Don't think it's necessary for a comma, but without it things like . and * in the line from the MUD won't necessarily parse properly.
Mariello2008-11-08 02:19:23
In the "Send to" box, make sure it is on "script". It was spam sending them to the mud because you had it sending to world.
Daved2008-11-08 03:41:49
Wow there are much more options and versatility here than zmud. I appreciate your patience guys
Daved2008-11-08 03:47:49
Can I give a variable a default value? So that if I log off with my pipes still burning my system doesn't still think they're lit next time I log in?
Esano2008-11-08 03:49:52
Not sure, but you can edit your script file to assign those values whenever it's called (as it is when you open the world). SHIFT+CTRL+H, SetVariable("variable","value"), assuming lua scripting.
Daved2008-11-08 04:01:00
Hrm, I have an alias in mind: to set my elixir balance to 2 when I send the sip command, then having the following take effect:
trigger: ^The potion heals and soothes you\\.$
send to script:if (@elixbal=2) then
world.setvariable "elixbal", 0
trigger: ^You may drink another health\\, mana\\, or bromide potion\\.$
send to script: if (@elixbal=0) then
world.setvariable "elixbal", 1
But I am puzzled as to how I can make my alias send one command to script:
world.setvariable "elixbal", 2
and one command to world: sip health
trigger: ^The potion heals and soothes you\\.$
send to script:if (@elixbal=2) then
world.setvariable "elixbal", 0
trigger: ^You may drink another health\\, mana\\, or bromide potion\\.$
send to script: if (@elixbal=0) then
world.setvariable "elixbal", 1
But I am puzzled as to how I can make my alias send one command to script:
world.setvariable "elixbal", 2
and one command to world: sip health
Daved2008-11-08 04:01:53
QUOTE(Esano @ Nov 7 2008, 10:49 PM) 580271
Not sure, but you can edit your script file to assign those values whenever it's called (as it is when you open the world). SHIFT+CTRL+H, SetVariable("variable","value"), assuming lua scripting.
I'm using VBscript, 'cause I've heard this guy Ethelon's system made in it is pretty good.
Daved2008-11-08 04:08:04
EDIT: I fixed this problem.. end if, not endif
Daved2008-11-08 05:29:07
So I've been trying all sorts of madness to get my prompt trigger to send an alias. In my prompt trigger, I have
if (@sipcheck=1) then
world.send "sips"
end if
sips being my alias which checks out my sip balance, compares my health to my siphealth, and sends the command.
But it just sends the command "sips" to the MUD :/
if (@sipcheck=1) then
world.send "sips"
end if
sips being my alias which checks out my sip balance, compares my health to my siphealth, and sends the command.
But it just sends the command "sips" to the MUD :/
Unknown2008-11-08 11:03:36
try: world.execute("sips")
Esano2008-11-08 11:34:38
QUOTE(Daved @ Nov 8 2008, 03:01 PM) 580273
Hrm, I have an alias in mind: to set my elixir balance to 2 when I send the sip command, then having the following take effect:
trigger: ^The potion heals and soothes you\\.$
send to script:if (@elixbal=2) then
world.setvariable "elixbal", 0
trigger: ^You may drink another health\\, mana\\, or bromide potion\\.$
send to script: if (@elixbal=0) then
world.setvariable "elixbal", 1
But I am puzzled as to how I can make my alias send one command to script:
world.setvariable "elixbal", 2
and one command to world: sip health
trigger: ^The potion heals and soothes you\\.$
send to script:if (@elixbal=2) then
world.setvariable "elixbal", 0
trigger: ^You may drink another health\\, mana\\, or bromide potion\\.$
send to script: if (@elixbal=0) then
world.setvariable "elixbal", 1
But I am puzzled as to how I can make my alias send one command to script:
world.setvariable "elixbal", 2
and one command to world: sip health
Send("whatever"), although once again that's for lua. VB would be world.send "sip health"
Daved2008-11-08 18:17:01
Thanks for all your help guys, I now have a working autosipper and will likely be able to build my curing from there
My next question deals with checking to see if a certain pattern exists within a certain string for the purpose of tracking the individual elements of the last piece of the prompt that gives you your status. In zmud, the method for this is %pos("pattern", "string"). I'm pouring through MUSH's help index and not finding anything similar. Please assist
My next question deals with checking to see if a certain pattern exists within a certain string for the purpose of tracking the individual elements of the last piece of the prompt that gives you your status. In zmud, the method for this is %pos("pattern", "string"). I'm pouring through MUSH's help index and not finding anything similar. Please assist
Ilyarin2008-11-08 18:43:07
I think it's string.find, I'll check quickly.
Unknown2008-11-09 00:10:44
It depends on which scripting language you're using. If you are using Lua (the default for new worlds in recent MUSHclient versions), then Ilyarin is correct that string.find is what you want.
Daved2008-11-09 02:00:28
QUOTE(Zarquan @ Nov 8 2008, 07:10 PM) 580508
It depends on which scripting language you're using. If you are using Lua (the default for new worlds in recent MUSHclient versions), then Ilyarin is correct that string.find is what you want.
I'm using VB Script, is there a syntax for that? world.stringfind or some such?