Page 10 of 10 FirstFirst ... 8910
Results 91 to 99 of 99

Thread: my script questions

  1. #91

    Default

    Here is my code snippet..

    if line =~ /You are stunned/

    when this example happens, all is good, my if line catches it

    [SMR result: 207 (Open d100: 158)]
    As a canny giant rat focuses on you, an overwhelming pressure assails your mind, rendering you thoughtless!
    You are stunned!

    when this example happens, my if line does not catch it. it seems like anything with a roundtime causes my if line not to catch it

    A long thorny vine suddenly sprouts from the ground and begins to thrash about violently!
    [SMR result: 103 (Open d100: 90, Bonus: 8)]
    The long thorny vine lashes out violently at you, dragging you to the ground!
    ... 15 points of damage!
    Leg sweep keeps your feet overhead.
    You are stunned for 3 rounds!
    Roundtime: 3 sec.

    why is this?

  2. #92

    Default

    Trying to figure out how to detect an area web in the room and then dispel it before moving on. Here is what I got so far. I know the checkroom sticky web part isnt right, thats the part I am trying to figure out.

    [Some Area, Some Room - 12345]
    You notice a giant sticky web.
    Obvious paths: north, east

    Code:
    direction = ["go portal", "ne", "ne", "ne", "n", "n", "n", "n", "e", "e", "n", "nw", "go steps", "n", "go spear", "w", "w", "w", "w", "n", "n", "climb steps", "go arch", "d", "climb steps"]
    
    loop{
    
    move direction[number]
    if checkroom == "a sticky web"
    	if Spell[209].known?
    		Spell[209].cast('web') if Spell[209].affordable?
    	elsif Spell[417].known?
    		Spell[417].cast('web') if Spell[417].affordable?
    	elsif Spell[119].known?
    		Spell[119].cast('web') if Spell[119].affordable?
    	end
    end
    
    number += 1
    number = 0 if number >= direction.count
    
    }
    Last edited by onurb; 12-18-2022 at 11:23 PM.

  3. #93

    Default

    When you use a double equals, you're looking for an exact match. You probably want a regex match. Try something like if checkroom =~ /a sticky web/.

    In situations like these, you may want to echo checkroom to see what you're working with.

  4. Default

    Also of note... the web is identified as "a giant sticky web" and you are only looking for "a sticky web".

  5. #95

    Default

    I dont think checkroom is the proper command though, it says in wiki checkroom checks the room titles. I am looking for a command that checks the room description which I think the "a giant sticky web" falls under.

  6. #96

    Default

    ;repo download webdispel
    I don't want the world; I just want your half.
    Discord BigNasty#8519

  7. #97

    Default

    Quote Originally Posted by Rinualdo View Post
    ;repo download webdispel
    thanks, I did know there was some web dispel scripts out there. just trying to get in the habbit of writing my own to keep learning. but I did find the bit of code I needed on that script that I couldnt figure out

    GameObj.loot.find { |item| item.name =~ /sticky web|cloud/ }

    didnt even think about gameobj commands

    thanks again!

  8. #98

    Default

    trying to understand something here. can you use regexes with split strings, like...

    John kicks Steve in the neck.
    Mike punches Todd in the leg.

    if string =~ /(.*) (.*) (.*) in the (.*).|(.*) (.*) (.*) in the (.*)./

    attacker1 =$1
    action1 = $2
    defender1 = $3
    location1 = $4
    attacker2 = $5
    action2 = $6
    defender2 = $7
    location2 = $8

    Does it work like this? or only works with 1 string?

  9. #99

    Default

    Quote Originally Posted by onurb View Post
    trying to understand something here. can you use regexes with split strings, like...

    John kicks Steve in the neck.
    Mike punches Todd in the leg.

    if string =~ /(.*) (.*) (.*) in the (.*).|(.*) (.*) (.*) in the (.*)./

    attacker1 =$1
    action1 = $2
    defender1 = $3
    location1 = $4
    attacker2 = $5
    action2 = $6
    defender2 = $7
    location2 = $8

    Does it work like this? or only works with 1 string?
    Easiest way to test for this is to plug in all of the information at the following site: https://rubular.com/

    Looks like $1, $2, $3, and $4 would be used for both sentences.

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
  •