Page 3 of 3 FirstFirst 123
Results 21 to 28 of 28

Thread: Lich Help

  1. Default

    Quote Originally Posted by Shaelun View Post
    I went to fix what I thought was a bug in the Wizard/SF interpreting code, and I don't really see one. I do however notice that the `%c' and `%s' character sequences appear to be case sensitive; I changed it for the next version, since Lich is supposed to behave exactly like Wizard/SF when running one of their scripts. For the time being, try changing those to use lower case letters instead.

    As for rewriting it in Lich format...
    Code:
    spell = Script.self.vars[2]
    Script.self.vars[1].to_i.times { cast(spell, 'Wizard') }
    Script.self = lookup and retrieve the current script object
    vars[1] = the command-line variables are stored in this array for every script
    to_i = to_integer (convert from a string to an Integer class object)
    times = that many times, execute this block
    cast(spell, 'Wizard') = handle casting the spell on the target ('Wizard' here -- type ``;man cast'' in-game for details)

    That should do it. Long chain of methods, but it was easy enough to come up with off-hand.
    The only thing that .lic version doesn't do that my .cmd would is loop through multiple cast of multiple spells...such as .sg 4 401 406 414...where there I'd get 4 cast of each spell.

    I looked at your lich docs this weekend and played around for a little while...I didn't pick up on things as quickly as I'd have liked to but I didn't have as much time as I'd like to have had either.

    Maybe for the time being since my time is short I'll concentrate on trying to make some more of my .cmd scripts work when run through lich. I love the fact that lich doesn't run my pc's processor at 100% when I run scripts.

  2. #22
    Join Date
    Nov 2004
    Location
    Upstate NY
    Posts
    428

    Default

    The errors you're getting are really puzzling me for the time being. I'll try to figure out what's going on though...

    Here's a fully-functional version:
    Code:
    list = Script.self.vars[2..-1]
    num = Script.self.vars[1].to_i
    
    for spell in list
       num.times { cast(spell, 'Wizard') }
    end
    Hopefully this'll give you the basic idea:

    When you reference an array the way the first line does, it returns a subset of that array (in this case array index positions 2 through -1 [-1 being the last element]). So the first line is making a copy of the appropriate variables entered on the command line, and storing them in the list variable.

    The second line is just converting the first command line variable to an integer and storing it in the num variable. The reason for converting it from a String object to an Integer object is that the num.times part requires an Integer, and won't work with a String.

    The third line is the same basic syntax for a for loop that you find in most high-level scripting languages. for (variable_name) in (array) -- a Ruby tutorial will elaborate.

    Then we have the same basic num.times thing as before. Then the last line just ends the for loop.

    Good luck
    I visualize a time when we will be to robots what dogs are to humans, and I'm rooting for the machines. -- Claude Shannon

  3. #23
    Join Date
    Nov 2004
    Location
    Upstate NY
    Posts
    428

    Default

    So I altered the script you previously posted in order to run it and get a closer look at what's happening, and there aren't any errors at all. Are you absolutely certain that you're using Lich v3.53, and changed all the instances of %s and %c? This is the script as I have it; try it and see what happens:

    Code:
    #Spellup Wizard
    
    # .sg 4 401
    
    
    save %1
    Counter set %1
    SHIFT
    GOTO Start
    
    6:
    5:
    4:
    3:
    2:
    1:
    
    Start:
    put prep %1
    Match Cast Your spell is ready.
    Match StartWait wait
    MatchWait
    
    StartWait:
    pause 2
    GOTO Start
    
    Cast:
    counter subtract 1
    put cast at Shaelun
    Match %c You gesture
    Match CastWait wait
    MatchWait
    
    CastWait:
    pause 3
    GOTO %c
    
    0:
    SHIFT
    Counter set %s
    If_1 GOTO Start
    Exit
    I visualize a time when we will be to robots what dogs are to humans, and I'm rooting for the machines. -- Claude Shannon

  4. Default

    Quote Originally Posted by Shaelun View Post
    So I altered the script you previously posted in order to run it and get a closer look at what's happening, and there aren't any errors at all. Are you absolutely certain that you're using Lich v3.53, and changed all the instances of %s and %c? This is the script as I have it; try it and see what happens:

    Code:
    #Spellup Wizard
    
    # .sg 4 401
    
    
    save %1
    Counter set %1
    SHIFT
    GOTO Start
    
    6:
    5:
    4:
    3:
    2:
    1:
    
    Start:
    put prep %1
    Match Cast Your spell is ready.
    Match StartWait wait
    MatchWait
    
    StartWait:
    pause 2
    GOTO Start
    
    Cast:
    counter subtract 1
    put cast at Shaelun
    Match %c You gesture
    Match CastWait wait
    MatchWait
    
    CastWait:
    pause 3
    GOTO %c
    
    0:
    SHIFT
    Counter set %s
    If_1 GOTO Start
    Exit
    I'll try that tonight, thanks. I'm pretty certain I did that but who knows...I build houses for a living so apparantly it's easier to do that then write a program in Lich

    In the mean time I'm trying to add variables to the Character.settings.txt file in Lich so I can run my .cmd scripts through Lich until I pick up better on Lich.

    I added weapon.dagger to the settings file and added put get my Lich.weapon to my .cmd script. I ;reloaded to updage and ran the script...it returned a Get what? in game, appearing also to echo Lich.weapon to the game window. Are there parenthesis or brackets I'm missing? I tried a bunch of different combinations but couldn't get it right...any quick fix here?

  5. Default

    Quote Originally Posted by Shaelun View Post
    So I altered the script you previously posted in order to run it and get a closer look at what's happening, and there aren't any errors at all. Are you absolutely certain that you're using Lich v3.53, and changed all the instances of %s and %c? This is the script as I have it; try it and see what happens:

    Code:
    #Spellup Wizard
    
    # .sg 4 401
    
    
    save %1
    Counter set %1
    SHIFT
    GOTO Start
    
    6:
    5:
    4:
    3:
    2:
    1:
    
    Start:
    put prep %1
    Match Cast Your spell is ready.
    Match StartWait wait
    MatchWait
    
    StartWait:
    pause 2
    GOTO Start
    
    Cast:
    counter subtract 1
    put cast at Shaelun
    Match %c You gesture
    Match CastWait wait
    MatchWait
    
    CastWait:
    pause 3
    GOTO %c
    
    0:
    SHIFT
    Counter set %s
    If_1 GOTO Start
    Exit
    Well, I'm not sure what the problem with my script was because the .cmd script you posted, the version of mine that you altered, worked fine. I botched something...but glad it works.

    I'm trying to work in some Lich stuff into my .cmd scripts....maybe ease my way in. I was told they work together is that right? If so hopefully you can straighten me out with my previous post.

    Thanks again...preciate the time you're giving me...

  6. #26
    Join Date
    Nov 2004
    Location
    Upstate NY
    Posts
    428

    Default

    Yes, they work together. You can include Lich code in a .cmd script like so:
    Code:
    if_1 goto whocares
    put cast something at someone
    
    LICH {
      echo "You have to follow proper syntax and all other normal Lich rules here"
      if Char.health < 50
        echo "Get healed."
      end
    } LICH
    
    goto somelabel
    It's a useless, contrived example, but you get the idea. You can use as many of those snippets as you like. Essentially it "embeds" a mini-Lich-script in the Wizard script. They also run in a "safe" environment, though, and aren't able to do things like access the hard drive or anything else that could possibly be unwanted by the user.

    Oh, nearly forgot -- you cannot use labels within the Lich block(s). Labels aren't native to Ruby, and these "embedded" Lich snippets don't go through the preprocessing a normal .lic script does (that's when Lich sets up label jumps for the script). You can use labels all you want in the normal Wizard formatted portions, but that's all.
    Last edited by Shaelun; 01-18-2008 at 09:54 PM.
    I visualize a time when we will be to robots what dogs are to humans, and I'm rooting for the machines. -- Claude Shannon

  7. Default

    Quote Originally Posted by Frozen Rope View Post
    I added weapon.dagger to the settings file and added put get my Lich.weapon to my .cmd script. I ;reloaded to update and ran the script...it returned a Get what? in game. Are there parenthesis or brackets I'm missing? I tried a bunch of different combinations but couldn't get it right...any quick fix here?
    How am I getting the syntax wrong for calling a variable stored in the settings.txt file to one of my .cmd scripts?

    In my .cmd script I'd enter put get my %weapon and that would get the weapon from my container that I have stored in the %weapon variable slot in my options.

    I know Lich's variables are stored in the character.settings.txt file but I'm having a hard time getting the syntax right for using that in one of my .cmd scripts that I'm running through Lich. I thought it was put get my 'Lich.weapon' but that returns a Get what? instead of drawing my weapon. I know it's a baby step, but could ya help me with this?

  8. #28
    Join Date
    Nov 2004
    Location
    Upstate NY
    Posts
    428

    Default

    Lich.weapon is essentially a variable. So you use it the same way; if it's a Lich "snippet":
    Code:
    put "get my #{Lich.weapon}"
    If it isn't a Lich snippet, you don't want anything weird. The actual values aren't shared by Lich & Wizard, but the syntax and scripts should be identical. Basically I wrote my own version of Wizard/StormFront's script interpreters, so treat it exactly like a Wizard script that has no match limit. Just the same as you'd do in Wizard:
    Code:
    put get my %weapon
    Also, that's not the right file. It's "settings-{characterName}.txt" (e.g. "settings-Shaelun.txt"
    Last edited by Shaelun; 01-19-2008 at 12:10 AM.
    I visualize a time when we will be to robots what dogs are to humans, and I'm rooting for the machines. -- Claude Shannon

Similar Threads

  1. Welcome to Lich - A New Users Guide to GS 4.Lich
    By NoOnesShowMonkey in forum The Lich Project
    Replies: 39
    Last Post: 11-30-2015, 11:55 PM
  2. lich crashing when lich window out of focus
    By gilchristr in forum The Lich Project
    Replies: 5
    Last Post: 05-31-2015, 04:21 PM
  3. Lich and Avalon... where to extract lich to?
    By Mighty Nikkisaurus in forum The Lich Project
    Replies: 5
    Last Post: 08-07-2014, 05:02 AM
  4. Replies: 2
    Last Post: 01-06-2014, 07:14 PM
  5. Replies: 9
    Last Post: 10-29-2012, 09:05 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
  •