Results 1 to 4 of 4

Thread: Lich Scripts

  1. #1

    Question Lich Scripts

    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.

  2. #2

    Default

    Quote Originally Posted by ryaden View Post
    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!

  3. #3

    Default

    Quote Originally Posted by Donquix View Post
    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
    thanks! That is a huge help

  4. #4

    Default

    No problem. If you haven't already joined, people on the code channel on lnet (;tune code) tend to be very helpful. But definitely check out the intro to ruby things online, then you can keep your annoying noob (term of endearment! questions to the lich specific things, rather then the underlying ruby bits.
    Last edited by Donquix; 10-28-2016 at 08:41 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!

Similar Threads

  1. crosscharcom and other lich scripts
    By Greng in forum The Lich Project
    Replies: 9
    Last Post: 05-12-2019, 04:14 PM
  2. Non Lich Scripts
    By everan in forum Scripting Discussion
    Replies: 2
    Last Post: 05-16-2016, 02:38 PM
  3. Recommended Lich Scripts
    By Shimmy in forum The Lich Project
    Replies: 7
    Last Post: 03-02-2012, 05:57 PM
  4. Best/favorite Lich scripts
    By Drew in forum The Lich Project
    Replies: 2
    Last Post: 08-18-2009, 09:50 PM
  5. Favorite lich scripts
    By Swami71 in forum The Lich Project
    Replies: 49
    Last Post: 06-05-2009, 06:28 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •