Trigger failing

Posted by Excalibur on Mon 16 Sep 2002 02:55 PM — 6 posts, 21,403 views.

#0
Im not sure if any of you are familiar to it, but the mud i play is Darklord. Anyways, Like I said in my last post, I have auction triggers so somebody can send me a tell and I will reply with the items I am trying to sell. At first I had no problem with the triggers, they were working great, then I had a very immature player "spam" me telling me the word list. Which in turn spams both of our screans. Well, after getting some help from a person on here, and a friend, I figured out a simple way to "Gag" the player. I am also looking into what Shadow told me about the scripts.

The problem is not that though, for some reason, every since I "gaged" the player, my triggers are not working right for anyone! :( Ill give you an example of my trigger.
Example:

Trigger: ^(.*?) tells you\, \'list\'$
Send:
reply +=-=->>>*| Excalibur's Shop |*<<<-=-=+
reply What Do You Need?
Reply Lights
reply Rings
Reply Neck
Reply Armor
reply Head
reply Legs
reply Feet
reply Hands
reply Arms
Reply Shields
reply Robes
reply Belts
reply Bracelets
reply Weapons
reply Held
reply Face
reply Misc

In the boxes on the left these are the ones I have checked:
Enabled, Ignor Case, and Regular Expression.

All the auction triggers I have are set up exactly like that, they just have me replying a different message. Yet they dont always work right... Can someone help me out?


(Also, I was wondering if some one can help explain what Shadow said in the last post in a little simpler form, hehe I am sort of confused, and need help)
USA #1
Ok. We have an Excalibur on ours as well, so I made an inaccurate assumption about what I was dealing with. lol

On the mud I play tells are like>

Fred tells you: Hello, how are
you.

This is a simple example, since I didn't want to type a full length line. Basically, it indents the line and autowraps. Convenient for a shop, but also a major pain for gag triggers or any other situation where you want to grap the entire tell.

From your post here it seems you don't have such a command, or haven't tried using it, so lets try something else. ;) lol

First the new alias>

<aliases>
  <alias
    name="Auction_Com"
    script="Auction"
    match="auctions:(\w)?( .*)?"
    enabled="y"
    regexp="y"
    ignore_case="y"
  >
  </alias>
</aliases>

This matches on 'auction:<word> <Any block of non-spaces>', so 'auction:lights', 'auction:lights Globe of light', etc.
should work.

sub Auction(name, output, wilds)
  dim Item, Rest, temp, loc
  Item = lcase(wilds(1))
  Rest = wilds(2)
  selects case wilds(1)
    case "lights"
      temp = world.getvariable("lights")
      if left(Rest,1) = "-" then 'This is to delete it if it starts with -.
        Rest = right(Rest,len(Rest) - 1) ' Return all but first letter.
        loc = instr(temp, Rest) 'See if such a thing is in the list.
        if loc then
          'Replace first instance of the item.
          temp = replace(temp,Rest & ",","",loc,1)
        else
          world.note "No such item to delete.
        end if
      else
        if len(Rest) > 0 then ' You may just want to look at your own list. ;)
          temp = temp + Rest + ","
        else
          world.note temp
        end if
      end if
      world.setvariable "lights",temp
    case "rings"
      temp = world.getvariable("rings")
      if left(Rest,1) = "-" then
        Rest = right(Rest,len(Rest) - 1) 
        loc = instr(temp, Rest)
        if loc then          
          temp = replace(temp,Rest & ",","",loc,1)
        else
          world.note "No such item to delete."
        end if
      else
        if len(Rest) > 0 then
          temp = temp + Rest + ","
        else
          world.note temp
        end if
      end if
      world.setvariable "rings",temp
    case "neck"
      temp = world.getvariable("neck")
      if left(Rest,1) = "-" then
        Rest = right(Rest,len(Rest) - 1) 
        loc = instr(temp, Rest)
        if loc then          
          temp = replace(temp,Rest & ",","",loc,1)
        else
          world.note "No such item to delete."
        end if
      else
        if len(Rest) > 0 then
          temp = temp + Rest + ","
        else
          world.note temp
        end if
      end if
      world.setvariable "neck",temp


Continued next post. ;)
USA #2

    case "armor"
      temp = world.getvariable("armor")
      if left(Rest,1) = "-" then
        Rest = right(Rest,len(Rest) - 1) 
        loc = instr(temp, Rest)
        if loc then          
          temp = replace(temp,Rest & ",","",loc,1)
        else
          world.note "No such item to delete."
        end if
      else
        if len(Rest) > 0 then
          temp = temp + Rest + ","
        else
          world.note temp
        end if
      end if
      world.setvariable "armor",temp
    case "head"
      temp = world.getvariable("head")
      if left(Rest,1) = "-" then
        Rest = right(Rest,len(Rest) - 1) 
        loc = instr(temp, Rest)
        if loc then          
          temp = replace(temp,Rest & ",","",loc,1)
        else
          world.note "No such item to delete."
        end if
      else
        if len(Rest) > 0 then
          temp = temp + Rest + ","
        else
          world.note temp
        end if
      end if
      world.setvariable "head",temp
    case "legs"
      temp = world.getvariable("legs")
      if left(Rest,1) = "-" then
        Rest = right(Rest,len(Rest) - 1) 
        loc = instr(temp, Rest)
        if loc then          
          temp = replace(temp,Rest & ",","",loc,1)
        else
          world.note "No such item to delete."
        end if
      else
        if len(Rest) > 0 then
          temp = temp + Rest + ","
        else
          world.note temp
        end if
      end if
      world.setvariable "legs",temp
    case "feet"
      temp = world.getvariable("feet")
      if left(Rest,1) = "-" then
        Rest = right(Rest,len(Rest) - 1) 
        loc = instr(temp, Rest)
        if loc then          
          temp = replace(temp,Rest & ",","",loc,1)
        else
          world.note "No such item to delete."
        end if
      else
        if len(Rest) > 0 then
          temp = temp + Rest + ","
        else
          world.note temp
        end if
      end if
      world.setvariable "feet",temp
    case "hands"
      temp = world.getvariable("hands")
      if left(Rest,1) = "-" then
        Rest = right(Rest,len(Rest) - 1) 
        loc = instr(temp, Rest)
        if loc then          
          temp = replace(temp,Rest & ",","",loc,1)
        else
          world.note "No such item to delete."
        end if
      else
        if len(Rest) > 0 then
          temp = temp + Rest + ","
        else
          world.note temp
        end if
      end if
      world.setvariable "hands",temp
    case "arms"
      temp = world.getvariable("arms")
      if left(Rest,1) = "-" then
        Rest = right(Rest,len(Rest) - 1) 
        loc = instr(temp, Rest)
        if loc then          
          temp = replace(temp,Rest & ",","",loc,1)
        else
          world.note "No such item to delete."
        end if
      else
        if len(Rest) > 0 then
          temp = temp + Rest + ","
        else
          world.note temp
        end if
      end if
      world.setvariable "arms",temp
    case "shields"
      temp = world.getvariable("shields")
      if left(Rest,1) = "-" then
        Rest = right(Rest,len(Rest) - 1) 
        loc = instr(temp, Rest)
        if loc then          
          temp = replace(temp,Rest & ",","",loc,1)
        else
          world.note "No such item to delete."
        end if
      else
        if len(Rest) > 0 then
          temp = temp + Rest + ","
        else
          world.note temp
        end if
      end if
      world.setvariable "shields",temp
    case "robes"
      temp = world.getvariable("robes")
      if left(Rest,1) = "-" then
        Rest = right(Rest,len(Rest) - 1) 
        loc = instr(temp, Rest)
        if loc then          
          temp = replace(temp,Rest & ",","",loc,1)
        else
          world.note "No such item to delete."
        end if
      else
        if len(Rest) > 0 then
          temp = temp + Rest + ","
        else
          world.note temp
        end if
      end if
      world.setvariable "robes",temp
    case "belts"
      temp = world.getvariable("belts")
      if left(Rest,1) = "-" then
        Rest = right(Rest,len(Rest) - 1) 
        loc = instr(temp, Rest)
        if loc then          
          temp = replace(temp,Rest & ",","",loc,1)
        else
          world.note "No such item to delete."
        end if
      else
        if len(Rest) > 0 then
          temp = temp + Rest + ","
        else
          world.note temp
        end if
      end if
      world.setvariable "belts",temp


Continued in next post again... (Nick this 6000 character thing it a major pain...) :p
USA #3

    case "bracelets"
      temp = world.getvariable("bracelets")
      if left(Rest,1) = "-" then
        Rest = right(Rest,len(Rest) - 1) 
        loc = instr(temp, Rest)
        if loc then          
          temp = replace(temp,Rest & ",","",loc,1)
        else
          world.note "No such item to delete."
        end if
      else
        if len(Rest) > 0 then
          temp = temp + Rest + ","
        else
          world.note temp
        end if
      end if
      world.setvariable "bracelets",temp
    case "weapons"
      temp = world.getvariable("weapons")
      if left(Rest,1) = "-" then
        Rest = right(Rest,len(Rest) - 1) 
        loc = instr(temp, Rest)
        if loc then          
          temp = replace(temp,Rest & ",","",loc,1)
        else
          world.note "No such item to delete."
        end if
      else
        if len(Rest) > 0 then
          temp = temp + Rest + ","
        else
          world.note temp
        end if
      end if
      world.setvariable "weapons",temp
    case "held"
      temp = world.getvariable("held")
      if left(Rest,1) = "-" then
        Rest = right(Rest,len(Rest) - 1) 
        loc = instr(temp, Rest)
        if loc then          
          temp = replace(temp,Rest & ",","",loc,1)
        else
          world.note "No such item to delete."
        end if
      else
        if len(Rest) > 0 then
          temp = temp + Rest + ","
        else
          world.note temp
        end if
      end if
      world.setvariable "held",temp
    case "face"
      temp = world.getvariable("face")
      if left(Rest,1) = "-" then
        Rest = right(Rest,len(Rest) - 1) 
        loc = instr(temp, Rest)
        if loc then          
          temp = replace(temp,Rest & ",","",loc,1)
        else
          world.note "No such item to delete."
        end if
      else
        if len(Rest) > 0 then
          temp = temp + Rest + ","
        else
          world.note temp
        end if
      end if
      world.setvariable "face",temp
    case "misc"
      temp = world.getvariable("misc")
      if left(Rest,1) = "-" then
        Rest = right(Rest,len(Rest) - 1) 
        loc = instr(temp, Rest)
        if loc then          
          temp = replace(temp,Rest & ",","",loc,1)
        else
          world.note "No such item to delete."
        end if
      else
        if len(Rest) > 0 then
          temp = temp + Rest + ","
        else
          world.note temp
        end if
      end if
      world.setvariable "misc",temp
    case "gag"
      temp = world.getvariable("gag")
      if left(Rest,1) = "-" then
        Rest = right(Rest,len(Rest) - 1) 
        loc = instr(temp, Rest)
        if loc then          
          temp = replace(temp,Rest & ",","",loc,1)
        else
          world.note "No such person being gagged."
        end if
      else
        if len(Rest) > 0 then
          temp = temp + Rest + ","
        else
          world.note temp
        end if
      end if
      world.setvariable "gag",temp
  end select
end sub


Ok, next post will be the trigger for the tell, etc. Though it will probably end up being 3-4 posts. lol
USA #4
For your trigger the idea would be much the same as now.

In the simplest form you would use:

Trigger: ^(.*?) tells you\, \'list\'$
expand variables: on
Send:
reply +=-=->>>*| Excalibur's Shop |*<<<-=-=+
reply What Do You Need?
Reply @lights
reply @rings
Reply @neck
Reply @armor
reply @head
reply @legs
reply @feet
reply @hands
reply @arms
Reply @shields
reply @robes
reply @belts
reply @bracelets
reply @weapons
reply @held
reply @face
reply @misc

But that leaves you right back where you where, so instead we make it>

Trigger: ^(.*?) tells you\, \'list (\w)?\'$
Script: Tell_Auction
regexp: yes

And this>

sub Tell_Auction (name, output, wilds)
  dim person, fnd, gags, asked
  gags = world.getvariable("gag")
  person = lcase(wilds(1))
  fnd = instr(gags,person) ' Is it someone who we are ignoring?
  if fnd = 0 then
    world.send "reply +=-=->>>*| Excalibur's Shop |*<<<-=-=+"
    asked = lcase(wilds(2))
    select case asked
      case "lights"
        world.send "reply " & world.getvariable("lights")
      case "rings"
        world.send "reply " & world.getvariable("rings")
      case "neck"
        world.send "reply " & world.getvariable("neck")
      case "armor", "armour" 'In case of any brits out there. ;)
        world.send "reply " & world.getvariable("armor")
      case "head"
        world.send "reply " & world.getvariable("head")
      case "legs"
        world.send "reply " & world.getvariable("legs")
      case "feet"
        world.send "reply " & world.getvariable("feet")
      case "hands"
        world.send "reply " & world.getvariable("hands")
      case "arms"
        world.send "reply " & world.getvariable("arms")
      case "shields"
        world.send "reply " & world.getvariable("shields")
      case "robes"
        world.send "reply " & world.getvariable("robes")
      case "belts"
        world.send "reply " & world.getvariable("belts")
      case "bracelets"
        world.send "reply " & world.getvariable("bracelets")
      case "weapons"
        world.send "reply " & world.getvariable("weapons")
      case "held"
        world.send "reply " & world.getvariable("held")
      case "face"
        world.send "reply " & world.getvariable("face")
      case "misc"
        world.send "reply " & world.getvariable("misc")
      case "all"
        world.send "reply " & world.getvariable("lights")
        world.send "reply " & world.getvariable("rings")
        world.send "reply " & world.getvariable("neck")
        world.send "reply " & world.getvariable("armor")
        world.send "reply " & world.getvariable("head")
        world.send "reply " & world.getvariable("legs")
        world.send "reply " & world.getvariable("feet")
        world.send "reply " & world.getvariable("hands")
        world.send "reply " & world.getvariable("arms")
        world.send "reply " & world.getvariable("shields")
        world.send "reply " & world.getvariable("robes")
        world.send "reply " & world.getvariable("belts")
        world.send "reply " & world.getvariable("bracelets")
        world.send "reply " & world.getvariable("weapons")
        world.send "reply " & world.getvariable("held")
        world.send "reply " & world.getvariable("face")
        world.send "reply " & world.getvariable("misc")
      case else
        world.send "reply Please select an item type: all, lighs, rings, neck, armor, head, legs, feet, hands, arms, shields, robes, belts, bracelets, weapons, help, face, misc."
    end select
  end if
end sub


I have not tried any of this, so you may want to have it double checked first. ;) But it will limit the spam by only showing the specific items they are looking for and lets you gag the truly abnoxious.
Australia Forum Administrator #5
Quote:

Continued in next post again... (Nick this 6000 character thing it a major pain...) :p


I put that in to stop spamming from mischevious users. I have modified the forum software to make that an option, and removed the limit from posts by you (Shadowfyr) and Magnum.