Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
bair
Beginner


Joined: 31 Oct 2006
Posts: 22

PostPosted: Tue Oct 31, 2006 8:40 pm   

help w/ triggers
 
So I'm trying to make a script to continuously kill mobs in this zone, I only want it to kill if there are at least 3 mobs in the room, if not I want it to go a direction (i make it go west everytime right now just for testing purposes, because I cant even get it right now). Currently it seems like whenever mobs fly in or leave it doesnt add/subtract the variable correctly, because it always ends up trying to go west too early, and sometimes it doesn't reset the variable correctly when I change rooms, and it will attack in rooms with less than 3 mobs. Please help me revise/fix this, and if you think you have a better method of going about this PLEASE let me know. Here are some of the lines of text from the mud:
A Blue Fairy flies in from the north.
A Wood Nymph walks in from the north.
A Wood Nymph walks north.
The Cluricaun is DEAD!!

Fairy Forest
[Exits: north east]
( 3) A fragrant plant lies here.
( 2) A musical instrument lies here.
Some leaves lie here.
Some wild thyme lies here.
The cluricaun wanders about drunkly.
A beautiful nymph stands here.

And here is what I have so far:

#CLASS {botcity}
#VAR mobsinroom {0} {0}
#TRIGGER {A beautiful nymph stands here.} {#add mobsinroom 1}
#TRIGGER {The Fairy Field} {
#wa 200
#if (@mobsinroom > 2) {
stance mongoose
c gas
}
#if (@mobsinroom <= 2) {
#var mobsinroom 0
west
}
}
#TRIGGER {Fairy Forest} {
#wa 200
#if (@mobsinroom > 2) {
stance mongoose
c gas
}
#if (@mobsinroom <= 2) {
#var mobsinroom 0
west
}
}
#TRIGGER {flies (%w)} {
#if (%1 = south or north or west or east) {#add mobsinroom -1}
#if (%1 = in) {
#add mobsinroom 1
c gas
}
}
#TRIGGER {walks (%w)} {
#if (%1 = south or north or west or east) {#add mobsinroom -1}
#if (%1 = in) {
#add mobsinroom 1
c gas
}
}
#TRIGGER {Outskirts of Fields} {
#wa 200
#if (@mobsinroom > 2) {
stance mongoose
c gas
}
#if (@mobsinroom <= 2) {
#var mobsinroom 0
west
}
}
#TRIGGER {is DEAD!!} {
#add mobsinroom -1
#if (@mobsinroom <= 0) {
#var mobsinroom 0
west
}
}
#TRIGGER {The banshee wails, fortelling death.} {#add mobsinroom 1}
#TRIGGER {The cluricaun wanders about drunkly.} {#add mobsinroom 1}
#TRIGGER {A thestral snorts and stamps his hooves.} {#add mobsinroom 1}
#TRIGGER {A lovely butterfly flutters by.} {#add mobsinroom 1}
#TRIGGER {A small blue fairy flutters his wings and grins.} {#add mobsinroom 1}
#TRIGGER {The unicorn shakes her mane and blinks.} {#add mobsinroom 1}
#TRIGGER {A satyr stands here looking for a female companion.} {#add mobsinroom 1}
#TRIGGER {A tiny pink fairy flutters her wings prettily.} {#add mobsinroom 1}
#TRIGGER {The brownie looks about for household work to be done.} {#add mobsinroom 1}
#TRIGGER {The old leprechaun looks at you and dances a jig.} {#add mobsinroom 1}
#TRIGGER {Entrance to the Fairy Realm} {
#var mobsinroom 0
n
}
#TRIGGER {} {}
#CLASS 0
Reply with quote
Atreides_096
Wanderer


Joined: 21 Jan 2005
Posts: 99
Location: Solvang, CA

PostPosted: Thu Nov 02, 2006 7:17 am   
 
Well this is untested.. and some of this could definitely be written much better in perl... but just as a quick throw-together...

Code:
#CLASS {botcity}
#va MobsInRoom 0 0 {botcity}
#va MobLongDescs {A beautiful nymph stands here.|The banshee wails, fortelling death.|The cluricaun wanders about drunkly.|A thestral snorts and stamps his hooves.|A lovely butterfly flutters by.|A small blue fairy flutters his wings and grins.|The unicorn shakes her mane and blinks.|A satyr stands here looking for a female companion.|A tiny pink fairy flutters her wings prettily.|The brownie looks about for household work to be done.|The old leprechaun looks at you and dances a jig.}
#va RoomsToKillIn {The Fairy Field|Fairy Forest|Outskirts of Fields|Entrance to the Fairy Realm}
#ac {^* {flies|walks}{( in from the| )}%t$} {#if %1=" in from the" {#ad mobsinroom 1} {#ad mobsinroom -1}}
#ac {^{@MobLongDescs}$} {#ad MobsInRoom 1}
#ac {^{@RoomsToKillIn}} {
  MobsInRoom=0
  #alarm RoomCheck +0.2 {
    #if (@mobsinroom>2) {
      stance mongoose
      c gas
      } {
      MobsInRoom=0
      west
      }
    }
  }
 #TRIGGER {^* is DEAD!!} {
  #add mobsinroom -1
  #if (@mobsinroom<=0) {
    mobsinroom=0
    west
    }
  }
#CLASS 0

Main problem seemed to be simple {} positioning... but also had a lot of extra triggers/ifs that aren't super needed *shrug*
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net