Page 4 of 4 FirstFirst ... 234
Results 31 to 37 of 37

Thread: sonic sword script need help

  1. #31

    Default

    Using Spell[1025].cast automatically checks for spell failures and will recast.

  2. #32

    Default

    Ok, figured something else out, forgot to add weapon type so only had two variables.
    That's why the script started to try and recast.

    Would this work:

    If script.vars[3]=="" then fput "You need 3 variables!" break

    added just after the line: target_id = nil and just before the comments?
    Last edited by Eliseen; 01-05-2021 at 07:55 PM.

  3. #33

    Default

    If you want to see if a variable doesn't have a value you can use nil.

    So you could do:

    Code:
    if script.vars[3].nil?
         echo "You need 3 variables."
         exit
    end

  4. #34

    Default

    Thanks, I'm slowly getting the hang of this. I was wanting to try the script out walking around town. So not to attack anyone's pets or familiars or such chose bats and balls as the critters. Forgot to add in a weapon, singing sword does not recognize bats as a weapon. It failed to cast twice (armor hindrance it said rolled a 7 and a 1) finally pulled up a broadsword as default.

    I figure if you do like I did and forgot to enter a weapon you would only have 2 variables # 3 would be nil, If you forgot all variables again #3 would be nil. Sort of a catch all. So I got all spelled up this evening so first thing in the morning I'm going to try it out. I think I may have all the bugs worked out, at least I hope so. Darn near ver 1.1.

    Again much thanks.

  5. #35

    Default

    Ok found a little glitch. If you die well it sort of goes off the deep end. How's this look


    if checkdead.nil?
    echo "program exiting."
    exit
    end

    And that would be in the main loop correct?

  6. #36

    Default

    Ok found a little glitch. If you die well it sort of goes off the deep end. How's this look


    if checkdead.nil?
    echo "program exiting."
    exit
    end

    And that would be in the main loop correct?

  7. #37

    Default

    Yeah just do:

    exit if dead?

Posting Permissions

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