
Originally Posted by
ryaden
I am new to lich scripts and have 2 basic question if anyone call help.
1
I want to reassign script.vars[1] to another variable name. Here is what I tried.
scripts.vars[1] = name
I subsequently tried to use the variable as #{name}
Incidentally I would like to be able to continue to use script.vars[1] and the variable name in the script because I plan to shift the variables with script.vars[1].shift
2.
I would like to use the checkspell function but have been unclear how it functions within the script. Essentially I want to check if a spell is active and then cast it if it isn't. Here is what I tried (unsuccessfully). I am on Avaalon if that makes a different.
if checkspell "presence" == nil
fput "incant 402"
else
end
I appreciate any help that can be provided.
1) you're assigning the variable backwards. In "a = b", you're saying "set the variable a to the value of variable b", so you're trying to set script.vars[1] to the value of "name", rather than setting "name" to the value of "script.vars[1]"
Lich syntax is all ruby, I would highly suggest reading introductory ruby coding guides of which there are many.
https://www.codecademy.com/learn/ruby
2) nil means nothing. checkspell is a boolean (true / false) check, and nil is not equal to false. So your if statement will not evaluate since you are asking "is false equal to nothing", the answer is no because false is not nothing, it's false. Also why do you have the else there? That is completely unnecesarry unless you actually want to do something when your if statement is not met.
Code:
if checkspell "presence" == false
<do some shit>
end
you could also do
Code:
if not checkspell "presence"
<do some shit>
end
but i generally prefer the more explicit condition.
also you should be posting in the actual lich folder
Last edited by Donquix; 10-28-2016 at 12:35 PM.
Mithrilschlong, 2015-03-10 to slightly later on 2015-03-10. You will not be forgotten!
usable Meteor Swarm, late 2020-12-30 to early 2020-12-31. You will also not be forgotten!