Still trying to get ahold of coding knowledge

Posted by Jordan on Thu 02 Nov 2006 04:24 PM — 4 posts, 15,536 views.

#0
If r = 0

then cast blind

else cast 'cure blind'


how would i code something like this?
USA #1
What scripting language are you working in?
#2
Lua i think. So i have to create a script in order to do it?
Australia Forum Administrator #3
Well, a minor bit of scripting is needed to make decisions, however it can be done "inline" in your trigger or alias.

Assuming the trigger or whatever-it-is matches, your code would look something like this:


if r == 0 then
  Send ("cast blind")
else
  Send ("cure blind")
end -- if


The test of equality is "==" not "=", as "=" is used for assignment, eg.


a = 42  --> a is now 42


For this to work perfectly you need to establish a value for the variable "r".

You need to set the trigger or whatever you are making to "send to script" so that the script commands are executed as a script, and not just sent straight to the MUD.