Results 1 to 6 of 6

Thread: Tiny Script

  1. #1

    Default Tiny Script

    Can you ruby folks check out this script and let me know if it will work?

    Goal:

    1. Ensure that character is standing up.
    2. If not standing up, then attempt to stand. Repeat as necessary until character is standing.
    3. If character is standing, then aim for the head, go to offensive stance, then ambush (note, this script assumes that the character is hidden, but I would prefer to take the assumption out of the equation). In other words, what if the character wasn't hidden and I had to stand. I would like to hide before I go through the ambush routine.
    4. Wait for the ambush RT to expire, then go to Defensive Stance.
    5. Check to see if the character is hidden. If not, then attempt to hide a maximum of three times. If not hidden after three attempts, give up trying to hide.
    6. End the script


    Code:
    waitrt?
    if !standing?
    	waitrt?
    	fput "stand"
    	waitrt?
    else
    	multifput "aim head", "stance off", "ambush"
    	waitrt?
    	fput "stance def"
    	3.times do
    		if !hidden?
    				waitrt?
    				fput "hide"
    				waitrt?
    		end
    	end
    end
    Do you think it would be better to break these individual "checks" (i.e., check standing, check hidden) into their own separate routines? If so, can you help me with breaking them out?

    I plan to make a script for each body part that can be ambushed. This particular one will be called ambushHead.lic. The alias in StormFront will be /x;ambushHead/r. I'll assign this alias to a Macro, then map the macro to one of the key bindings on my Nostromo Keypad.

    Thanks for your help.
    A Vvrael witch shudders, her form suddenly contracting convulsively.
    The ground beneath your feet suddenly frosts and rumbles violently!
    [SMR result: 93 (Open d100: -32, Bonus: 61)]
    You dodge out of the way!
    !SPR>sta
    ...wait 4 seconds.
    !SPR>
    Icy stalagmites burst from the ground beneath you!
    [SMR result: 213 (Open d100: 88, Bonus: 61)]
    ... 55 points of damage!
    Incredible strike pierces your heart and runs you clean through!

    It seems you have died, my friend.

  2. #2

    Default

    The script posted above seems to be "mostly working," meaning that while hunting with a partner, the script sometimes missed that an action failed to be executed.

    From what I understand, the reason why is because "fput" only reads the very NEXT line given from the game after it "fputs" the command to the game. So when the script gets to the line that reads, "fput "stance def" the script is only going to look at the very next line received from the game after entering "stance def" at the prompt. If that line happens to be "You are now in a defensive stance," then it's all good (the script will not see a "failed attempt" at going stance defensive - it saw a successful attempt). If, on the other hand, the next line the game spits out is "XXX swings his *thus-and-so weapon* at *thus-and-so creature*," then the script hangs because it's only looking at the very next line. So this explains (I think) why I would sometimes hang-up when hunting in a group and would stand there in offensive stance and not going defensive and hiding, and whatnot.

    So, after some more reading, I believe the following corrections will fix this tiny script:

    Code:
    waitrt?
    if !standing?
    	waitrt?
    	fput "stand", "you stand back up"
    	waitrt?
    else
    	multifput "aim head", "stance off", "ambush"
    	waitrt?
    	fput "stance def", "you are now in a defensive stance"
    	3.times do
    		if !hidden?
    				waitrt?
    				fput "hide"
    				waitrt?
    		end
    	end
    end
    The first argument of "fput" is the command while all other arguments coming after are the "successful game strings" that the fput command looks for to continue on with the script. If it does not see those arguments, then it continues to execute the command until it sees the correct output.

    Have I interpreted what I read correctly? Can you see any place where this script could be further refined?
    A Vvrael witch shudders, her form suddenly contracting convulsively.
    The ground beneath your feet suddenly frosts and rumbles violently!
    [SMR result: 93 (Open d100: -32, Bonus: 61)]
    You dodge out of the way!
    !SPR>sta
    ...wait 4 seconds.
    !SPR>
    Icy stalagmites burst from the ground beneath you!
    [SMR result: 213 (Open d100: 88, Bonus: 61)]
    ... 55 points of damage!
    Incredible strike pierces your heart and runs you clean through!

    It seems you have died, my friend.

  3. #3

    Default

    I think your order is a bit wonky.

    The way I'm reading it:
    Stand if not standing
    Then do the ambush bit
    Then hide

    You probably want to hide before the ambush part. Also consider using while statements instead of if statements.

    (Sorry I'm not sure how to do the code block. If you let me in on that secret I'll post some)

  4. Default

    There's a lot of valid way to accomplish this. I would do something like this to start:

    Code:
    waitrt?
    fput "stand" until standing? unless standing?
    waitrt?
    3.times do
        break if hiding?
        fput "hide"
        waitrt?
    end
    multifput "aim head", "stance off", "ambush"
    waitrt?
    fput "stance def" until checkstance "defensive"
    The biggest differences here are the order of operations (as noted in the previous reply) and some additional status checking. In the hiding loop there's no sense in performing all three iterations if you're already hiding so I'm checking to see if we can break out of the loop before doing any work. The second and last lines are basically spamming a command until the condition is met (standing or in stance defensive).

    Note: I don't think this script will work as expected unless you have a valid target for the ambush command. Maybe take a look at splitting the ambush command out by itself and use dothistimeout to capture the game response and end the script if an invalid target error message is received.

  5. #5

    Default

    Thanks for the replies - I meant to reply with additional information, but got extremely busy at work and simply didn't have time to run this ground at that time...

    Anyhow...

    Quote Originally Posted by Vanatar View Post
    There's a lot of valid way to accomplish this. I would do something like this to start:

    Code:
    waitrt?
    fput "stand" until standing? unless standing?
    waitrt?
    3.times do
        break if hiding?
        fput "hide"
        waitrt?
    end
    multifput "aim head", "stance off", "ambush"
    waitrt?
    fput "stance def" until checkstance "defensive"
    The biggest differences here are the order of operations (as noted in the previous reply) and some additional status checking. In the hiding loop there's no sense in performing all three iterations if you're already hiding so I'm checking to see if we can break out of the loop before doing any work. The second and last lines are basically spamming a command until the condition is met (standing or in stance defensive).

    Note: I don't think this script will work as expected unless you have a valid target for the ambush command. Maybe take a look at splitting the ambush command out by itself and use dothistimeout to capture the game response and end the script if an invalid target error message is received.
    Thanks for the reply and the suggestion. A couple of notes of clarification:

    I do want to hide last, as I typically stalk with the hunting party...the good news is that your script can be easily edited to move the order of operations where I want them, so many thanks for putting it together.

    I think we're accomplishing the same thing with our respective hiding routines - the only difference I can see between our scripts is that you are breaking out of the hiding routine if I am hiding (break if hiding?), while my script only executes the hiding routine if I'm not hidden (if !hidden?). In both scripts, the script will attempt to hide a maximum number of 3 times before giving up and moving on (useful when fighting a critter with good perception). In any case, your routine is more efficient as it has fewer lines to do the same work, so I'm going to use yours. Also, your checkstance defensive line in your code is the ticket I was looking for. Thanks a lot! .

    Finally, I was hoping you could look at the block of code below. What I want it to do is:

    1. Check to see if I have enough mana to cast 903. If yes, go to offensive stance, incant minor water, wait for the cast RT to expire, then go defensive stance,
    2. If the script sees the line, "The water completely drenches", then I want it to execute the alias I wrote that channels Minor Shock (Note: Minor Shock script is identical to this one, except 903 is changed to 901, and there is no "Watchfor" line,
    3. If I don't have enough mana to cast 903, then I want the script to let me know that I'm out of mana and then cast Arcane Blast instead.


    The part I'm wanting to know is whether or not I did the "Watchfor" bit correctly (line 6), and whether or not this script will behave as I enumerated above.

    Thanks.

    Code:
    waitrt?
    if Spell[903].affordable?
    	multifput "stance off", "incant 903", "stance def"
    	waitcastrt?
    	fput "stance def"
    	Watchfor.new "The water completely drenches" {fput \x;minorShockChannel\r}
    else
    	echo ""
    	echo ""
    	echo "**********YOU ARE OUT OF MANA - CASTING ARCANE BLAST INSTEAD**********"
    	echo ""
    	echo ""
    	fput "incant 1700"
    	waitrt?
    	fput "stance def"
    end
    A Vvrael witch shudders, her form suddenly contracting convulsively.
    The ground beneath your feet suddenly frosts and rumbles violently!
    [SMR result: 93 (Open d100: -32, Bonus: 61)]
    You dodge out of the way!
    !SPR>sta
    ...wait 4 seconds.
    !SPR>
    Icy stalagmites burst from the ground beneath you!
    [SMR result: 213 (Open d100: 88, Bonus: 61)]
    ... 55 points of damage!
    Incredible strike pierces your heart and runs you clean through!

    It seems you have died, my friend.

  6. Default

    I cancelled my GS sub so haven't kept up with the forums recently...

    The biggest difference in the hiding code is the original block will always loop thrice and check the conditional. The updated code will break out of the loop entirely if you're hidden and move on.

    I can took a look at the 903 script too if you still have questions about it.

Similar Threads

  1. Replies: 7
    Last Post: 03-30-2019, 02:54 PM
  2. Need just a tiny bit of help
    By nunye in forum The Lich Project
    Replies: 2
    Last Post: 10-20-2016, 01:59 AM
  3. Replies: 0
    Last Post: 02-17-2015, 11:10 PM
  4. Anyone help me with a tiny script, please?
    By Sihaya in forum Miscellaneous Scripts
    Replies: 19
    Last Post: 07-13-2011, 08:33 PM
  5. Gnomes are tiny....right?
    By Kurili in forum Mechanics Complaints
    Replies: 23
    Last Post: 11-28-2003, 07:42 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
  •