Unknown2008-11-09 03:18:02
It's not a MUSHclient function. It'll be a VB function. You should be looking in the VB script documentation (or asking on the forum for it over at the MUSHclient web site).
Mariello2008-11-09 07:46:42
It is called Instr in VB. Syntax is as follows
String1 is what is being searched and string2 is what is being searched inside string1. It will return true if string2 is in string1 and 0 or false if it is not. You don't have to put it equal to anything if it is true but if it is false and you want it to match, then have instr(string1, "string2") = 0 . So for example
Hope this made some sense. Also visit this website if you require more functions. http://www.w3schools.com/vbscript/default.asp
CODE
Instr(string1, "string2")
String1 is what is being searched and string2 is what is being searched inside string1. It will return true if string2 is in string1 and 0 or false if it is not. You don't have to put it equal to anything if it is true but if it is false and you want it to match, then have instr(string1, "string2") = 0 . So for example
CODE
prompt = world.getvariable("prompt")
if instr(prompt, "p") then
world.note "you are prone"
end if
if instr(prompt, "z") = 0 then
world.note "there is no z in prompt"
end if
if instr(prompt, "p") then
world.note "you are prone"
end if
if instr(prompt, "z") = 0 then
world.note "there is no z in prompt"
end if
Hope this made some sense. Also visit this website if you require more functions. http://www.w3schools.com/vbscript/default.asp
Daved2008-11-09 16:39:14
I want to create an array for each cure. So one for arnica, one for yarrow etc. I put in my script file:
ArrayCreate "arnica"
ArraySet "arnica", "brokenchest", 0
ArraySet "arnica", "brokennose", 0
ArraySet "arnica", "crushedleftfoot", 0
ArraySet "arnica", "crushedrightfoot", 0
ArraySet "arnica", "fracturedleftarm", 0
ArraySet "arnica", "fracturedrightarm", 0
ArraySet "arnica", "snappedrib", 0
ArraySet "arnica", "windpipe", 0
and created an alias to test:
if (ArrayGet("arnica", "brokenchest")=0) then
world.send "ql"
end if
But the alias I created to test modifying the array:
ArraySet "arnica", "brokenchest", 1
Didn't really change the value, because the first testing alias still fired 'ql', indicating that the value of brokenchest in the arnica array was still 0.
How can I modify my array values via an alias?
ArrayCreate "arnica"
ArraySet "arnica", "brokenchest", 0
ArraySet "arnica", "brokennose", 0
ArraySet "arnica", "crushedleftfoot", 0
ArraySet "arnica", "crushedrightfoot", 0
ArraySet "arnica", "fracturedleftarm", 0
ArraySet "arnica", "fracturedrightarm", 0
ArraySet "arnica", "snappedrib", 0
ArraySet "arnica", "windpipe", 0
and created an alias to test:
if (ArrayGet("arnica", "brokenchest")=0) then
world.send "ql"
end if
But the alias I created to test modifying the array:
ArraySet "arnica", "brokenchest", 1
Didn't really change the value, because the first testing alias still fired 'ql', indicating that the value of brokenchest in the arnica array was still 0.
How can I modify my array values via an alias?
Daved2008-11-09 17:45:36
I tried making an alias that executed
ArrayCreate "arnica"
ArraySet "arnica", "brokenchest", 0
ArraySet "arnica", "brokennose", 0
ArraySet "arnica", "crushedleftfoot", 0
ArraySet "arnica", "crushedrightfoot", 0
ArraySet "arnica", "fracturedleftarm", 0
ArraySet "arnica", "fracturedrightarm", 0
ArraySet "arnica", "snappedrib", 0
ArraySet "arnica", "windpipe", 0
rather than just putting it in my script file, and it appears to have worked. I seem to be unclear on how to use the script file. Could someone explain when I'm to use that, or when I'm to put things in aliases/triggers/etc?
ArrayCreate "arnica"
ArraySet "arnica", "brokenchest", 0
ArraySet "arnica", "brokennose", 0
ArraySet "arnica", "crushedleftfoot", 0
ArraySet "arnica", "crushedrightfoot", 0
ArraySet "arnica", "fracturedleftarm", 0
ArraySet "arnica", "fracturedrightarm", 0
ArraySet "arnica", "snappedrib", 0
ArraySet "arnica", "windpipe", 0
rather than just putting it in my script file, and it appears to have worked. I seem to be unclear on how to use the script file. Could someone explain when I'm to use that, or when I'm to put things in aliases/triggers/etc?
Unknown2008-11-09 17:52:06
You put things in your script file when you want them to be loaded and executed once, unless you're defining functions/subroutines that you can access from your aliases/triggers.
For example, if you want to setup macros using the Accelerator function, you just put the calls in your script function so that they load the macros when your world loads your script file and executes the code.
Functions/subroutines are a great way to break your code up into reusable chunks that you can reference in your alias. It's similar to calling multiple aliases from one alias, and it helps organize your code so you don't repeat things unnecessarily and end up having to manage spaghetti code.
For example, if you want to setup macros using the Accelerator function, you just put the calls in your script function so that they load the macros when your world loads your script file and executes the code.
Functions/subroutines are a great way to break your code up into reusable chunks that you can reference in your alias. It's similar to calling multiple aliases from one alias, and it helps organize your code so you don't repeat things unnecessarily and end up having to manage spaghetti code.
Daved2008-11-12 19:51:42
zMUD has a function called #alarm, and you can modify it like so: #alarm {+1} {look} which will send the command 'look' to the mud in one second and then delete the alarm. How can I do this in VBScript-based MUSH?
Esano2008-11-12 20:47:03
QUOTE(Daved @ Nov 13 2008, 06:51 AM) 581520
zMUD has a function called #alarm, and you can modify it like so: #alarm {+1} {look} which will send the command 'look' to the mud in one second and then delete the alarm. How can I do this in VBScript-based MUSH?
Have a look for DoAfter.