Page 2 of 6 FirstFirst 1234 ... LastLast
Results 11 to 20 of 55

Thread: sonic sword script need help

  1. #11

    Default

    This should fix it so ;magic recognizes when 1025 is active, if not then I don't know what's going on:

    Code:
    current_room = Room.current.id
    target_id = nil
    
    loop{
    	if checkmana <= 50
    		fput "stop 1025"
    		echo "Running low on mana."
    		wait_until { checkmana(90) }
    	end
    	if !Spell[1025].active? && checkmana(90)
    		fput "spell active"
    		sleep 1
    		Spell[1025].cast(script.vars[1]) if !Spell[1025].active?
    	end
    	fput "tell weapon to return" if Spell[1025].active? && !GameObj.npcs.find{ |i| i.name =~ /#{script.vars[1]}/}
    	target = GameObj.targets.find{|i| i.name =~ /miner|pooka/i }
    	if target
    		if target_id != target.id
    			fput "tell weapon to attack #{target}"
    			target_id = target.id
    		end
    	end
    	if Room.current.id != current_room
    		current_room = Room.current.id
    		fput "tell weapon to cease" if checkpcs
    	end
    	if running? "go2"
    		fput "tell weapon to cease"
    		wait_while{ running?('go2') }
    	end
    	sleep 0.5
    }

  2. #12

    Default

    Ok, so when I ran it I didn't get the problem as before, it does two spell active commands the first before the song is sang and after it's sang. The only difference is this line:
    Singing Sword Song ................. 0:06:22 and it lists all the spells I'm currently using.

  3. #13

    Default

    does it make any difference what the sword is in the room description? for instance if I "sing longsword" I will see "an animated longsword" if I "sing mace" I see "An animated mace" appears and hovers near you. and it's reflected in the room description.

  4. #14

    Default

    Quote Originally Posted by Eliseen View Post
    does it make any difference what the sword is in the room description? for instance if I "sing longsword" I will see "an animated longsword" if I "sing mace" I see "An animated mace" appears and hovers near you. and it's reflected in the room description.
    The script checks for however you started the script. So if you started it with ;sonic mace it should check the room for a mace.

    If you mean for ;magic it shouldn’t matter, the spell is called singing sword and always shows up as that no matter what you sing.
    Last edited by Tgo01; 01-01-2021 at 11:30 PM.

  5. #15

    Default

    So I went hunting with the script you prepared (the second one) and it performed excellently. When I traveled by go2 and the sword got lost the script would do as followqs:
    >tell weapon to return
    You project your command for your animated longsword to return. The air beside you begins to distort, rapidly forming into an animated longsword.
    When a critter came in the sword would respond immediately with:
    >tell weapon to attack pooka
    You project your wish for harm to the ghostly pooka, and your animated longsword begins to respond.
    If I entered an area where there were other folks I'd get:
    >tell weapon to cease
    You project to your animated longsword your desire that it cease its current endeavor.
    The script would occasionally spit out the >spell active Command but that was few and far between. I only made one change and it was in this line:
    if !Spell[1025].active? && checkmana>(90)
    I added the greater than symbol as my mana would usually stay above 90 mana. The one think I think it needs is an embedded command to stop the script. I'm not sure if the upstream_get? command would be the one to use or something else.
    Last edited by Eliseen; 01-02-2021 at 10:59 AM.

  6. #16

    Default

    So these are the parts I'm going to add:
    ###Makes sure you are standing before continuing.
    def this_script_stand_me
    until standing?
    waitrt?
    fput "stand"
    end

    ###Code to stop spell song and exit script.
    toggle_upstream
    command = upstream_get
    if (command =~ /\b(say goodby sword?)i \b$/)fput “Stop 1025”
    break
    end


    Also change this line

    target = GameObj.targets.find{|i| i.name =~ /miner|pooka/i }
    to
    target = GameObj.targets.find{|i| i.name =~ /script.vars[2]|script.vars[3]/i }
    and add to the beginning
    ###Instrunction Var1=weapon, var2=primary critter, var3=secondary critter

    This would allow critters to be defined when starting the script
    Look this over and let me know if there's anything I missed. Thanx
    Last edited by Eliseen; 01-02-2021 at 05:52 PM.

  7. #17

    Default

    If you're calling the this_script_stand_me method within the loop then it should work.

    The easiest way to exit the script is to do ;k sonic (or whatever you named your script.) You could use before_dying to have the script do stuff before it exits.

    For example before the loop add:

    Code:
    before_dying{ 
         waitrt?
         fput "say goodbye sword"
         fput "stop 1025
    }
    That way when you do ;k sonic it will still have your character say "goodbye sword" and then do "stop 1025"

    You would want to do target = GameObj.targets.find{|i| i.name =~ /#{script.vars[2]}|#{script.vars[3]}/i }
    Last edited by Tgo01; 01-02-2021 at 06:03 PM.

  8. #18

    Default

    I liked your idea with ;k ssword (that's it's name) soI incorporated it. So here it is in all it's glory. I'll test it this afternoon after I get spelled up and let you know how it ran.

    current_room = Room.current.id
    target_id = nil

    ### Singing sword utility Ver 1.0
    ### Many thanks to Tgo01 who was instrumental in writing this script as I know nothing about Ruby
    ### Instructions comand format Ssword Var1 var2 var3
    ### Var1 is then name of the item you wish to create.
    ### Var2 is the name of a primary critter that you may be hunting
    ### Var3 is the name of a secondary critter you may encounter in your hunt
    ### Caution this script when activated will emulate the commands you may use manually while you hunt.
    ### Remember the rules no AFK while using this script.


    before_dying{
    waitrt?
    fput "say goodbye sword"
    fput "stop 1025
    }

    loop{
    if checkmana <= 50
    fput "stop 1025"
    echo "Running low on mana."
    wait_until { checkmana(90) }
    end
    if !Spell[1025].active? && checkmana>(90)
    fput "spell active"
    sleep 1
    Spell[1025].cast(script.vars[1]) if !Spell[1025].active?
    end
    fput "tell weapon to return" if Spell[1025].active? && !GameObj.npcs.find{ |i| i.name =~ /#{script.vars[1]}/}
    target = GameObj.targets.find{|i| i.name =~ /script.vars[2]|script.vars[3]/i }
    if target
    if target_id != target.id
    fput "tell weapon to attack #{target}"
    target_id = target.id
    end
    end
    def this_script_stand_me
    until standing?
    waitrt?
    fput "stand"
    end
    if Room.current.id != current_room
    current_room = Room.current.id
    fput "tell weapon to cease" if checkpcs
    end
    if running? "go2"
    fput "tell weapon to cease"
    wait_while{ running?('go2') }
    end
    sleep 0.5
    }
    Thank you....

  9. #19

    Default

    Ok so I'm getting some errors. They look like syntax to me:


    --- Lich: error: ssword:33: syntax error, unexpected keyword_end, expecting '}'
    end
    ^~~
    ssword:51: syntax error, unexpected '}', expecting keyword_end
    C:/Users/Desktop/lich/lich.rbw:2526:in `eval'
    C:/Users/Desktop/lich/lich.rbw:2526:in `block (2 levels) in <class:Script>'

    I counted and matched all parenthesis {} & () and removed the extra "if target" from the above script and the extra "end" that sectioon now reads:

    fput "tell weapon to return" if Spell[1025].active? && !GameObj.npcs.find{ |i| i.name =~ /#{script.vars[1]}/}
    target = GameObj.targets.find{|i| i.name =~ /#{script.vars[2]}|#{script.vars[3]}/i }
    end
    if target_id != target.id
    fput "tell weapon to attack #{target}"
    target_id = target.id
    def this_script_stand_me
    until standing?
    waitrt?
    fput "stand"
    end

    Let me know what else I should be looking for

  10. #20

    Default

    Code:
     current_room = Room.current.id
    target_id = nil
    
    ### Singing sword utility Ver 1.0
    ### Many thanks to Tgo01 who was instrumental in writing this script as I know nothing about Ruby
    ### Instructions comand format Ssword Var1 var2 var3
    ### Var1 is then name of the item you wish to create.
    ### Var2 is the name of a primary critter that you may be hunting
    ### Var3 is the name of a secondary critter you may encounter in your hunt
    ### Caution this script when activated will emulate the commands you may use manually while you hunt.
    ### Remember the rules no AFK while using this script.
    
    
    before_dying{
    	waitrt?
    	fput "say goodbye sword"
    	fput "stop 1025
    }
    
    def this_script_stand_me
    	until standing?
    		waitrt?
    		fput "stand"
    	end
    end
    
    loop{
    	if checkmana <= 50
    		fput "stop 1025"
    		echo "Running low on mana."
    		wait_until { checkmana(90) }
    	end
    	if !Spell[1025].active? && checkmana>(90)
    		fput "spell active"
    		sleep 1
    		Spell[1025].cast(script.vars[1]) if !Spell[1025].active?
    	end
    	fput "tell weapon to return" if Spell[1025].active? && !GameObj.npcs.find{ |i| i.name =~ /#{script.vars[1]}/}
    	target = GameObj.targets.find{|i| i.name =~ /script.vars[2]|script.vars[3]/i }
    	if target
    		if target_id != target.id
    		fput "tell weapon to attack #{target}"
    		target_id = target.id
    	end
    	this_script_stand_me
    	if Room.current.id != current_room
    		current_room = Room.current.id
    		fput "tell weapon to cease" if checkpcs
    	end
    	if running? "go2"
    		fput "tell weapon to cease"
    		wait_while{ running?('go2') }
    	end
    	sleep 0.5
    }

Tags for this Thread

Posting Permissions

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