I do almost the opposite, actually. I like to be able to override commands easily, so I do most commands through Execute and only use Send when I'm doing a command that would match my alias and cause one of those dreaded infinite loops. I know it's a tad slower, but coming from zMUD, it still appears to be 10 times faster. Heh.
You should use send when you want to send it to the server. Using execute just wastes time (while going through the aliases) which might not sound like a lot for each triiger/alias, it all adds up. Especially when you're sending multiple lines per trigger.
Apart from that, using execute for most/all/by default makes it really easy to get yourself into infinite loops. Whether it's within a single alias, or whether down the road you change/add something, and then you find yourself in a loop, which will be even more difficult to get rid of.
So, danger of loops, and the extra time using Executes, both make using send by default (and using executes only when you need to) a good practice to get in to.
(And then the pure laziness factor, in which you can just type "send" but in VB you have to type out "World.execute" to get around the VB function)
Execute should work just as well for what he's doing, unless he's got alias matches that he doesn't want to trigger. From what I've seen, the only difference between the two functions is that Execute will be parsed by the aliases and Send bypasses the aliases to go directly to the game.
You don't want to set your stupidity variable to 0 when you attempt the cure. You should have a trigger for the cure and set it to 0 then, especially with an affliction like stupidity which can often screw up your curing.
world.setvariable "stupidity", "1"
if world.getvariable("eatcan") = "1" then
world.setvariable "eatcan", "0"
world.send "outr 1 goldenseal"
world.send "eat goldenseal"
world.setvariable "stupidity", "0"
end if
That's what you want all I changed was the world.executes to world.send and added world.setvariable this wasy it'll set "stupidity" to 1 then if "eatcan" is equal to 1 it'll set eatcan to 0 get the goldenseal and then eat it and then set "stupidity" back to 0 also make the changes that Flannel said about your reg expression
That won't set stupidity to 0. But I'm assuming you're not expecting it to (you have another trigger or an alias to do that for you).
If you don't need the things you're sending to be evaluated (for aliases) then you can (and probably should) use world.send instead of world.execute.
You may also want to set the variables to 0 and 1 (instead of "0" and "1") and then test against 0 and 1 (again instead of their string counterparts).
And, if you are using a regular expression for your trigger, you'll need to escape the question mark and the period (with a backslash):
^Hmmmm\. Why must everything be so difficult to figure out\?$
What I want to do is a trigger, so when I get the message
^Hmmmm. Why must everything be so difficult to figure out?$
I set the variable stupidity to 1 and if eatcan is 1 I can eat the herb, so I set eatcan to 0, then get the herb, eat and eat it. After that the cure line will set stupidity to 0 again. Is this correct?
world.setvariable "stupidity", "1"
if world.getvariable ("eatcan") = "1" then
world.setvariable "eatcan", "0"
world.execute "outr 1 goldenseal"
world.execute "eat goldenseal"
end if
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.