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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Daoshai
Beginner


Joined: 04 Aug 2012
Posts: 13
Location: Milton

PostPosted: Sun Nov 04, 2012 9:39 pm   

Help with a condition
 
Hi, I've been messing around with this script for way to long, hopefully someone can help me out.

I'm trying to finish up a bash script, I've got it almost complete, but sometimes a bash that hits doesn't stun.

Your powerful bash dazes an old man.

The next line will be "Your opponent appears stunned and confused" or you will get nothing but your next round.

I'm trying to make it so if I don't get Your opponent appears stunned and confused as the next line, it'll send bash again

Is that possible?

Thanks,

Daoshai
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4691
Location: Pensacola, FL, USA

PostPosted: Sun Nov 04, 2012 10:06 pm   
 
yees it is, you want the within option, it only checks for x lines
_________________
Discord: Shalimarwildcat
Reply with quote
Daoshai
Beginner


Joined: 04 Aug 2012
Posts: 13
Location: Milton

PostPosted: Sun Nov 04, 2012 10:19 pm   
 
Well here is what I have for one possible dmg message

#TRIGGER {Your bash barely touches (*)} {}
#COND {Your opponent appears (*) stunned and confused.} {#VAR bashMiss 1} {within|param=2}
#COND {@bashMiss = 0} {bash} {within|param=1}


Problem is, both condition are never fulfilled because its one or the other
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4691
Location: Pensacola, FL, USA

PostPosted: Sun Nov 04, 2012 10:54 pm   
 
Then you might do better to toggle a class on and off with #T+ and #T- and have both conditions within it, as separate triggers.

Also, your second condition looks like an expression trigger, or an #IF satement... it shouldnt need to be a condition in the first place.
_________________
Discord: Shalimarwildcat
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Nov 04, 2012 11:51 pm   
 
Yes, it's actually possible, but you will need to use a manual type instead.

Code:
#trigger "tBash" {^Your powerful bash dazes an old man.$} {}
#condition {(*)} {
  #switch (%1)
    ("Your opponent appears stunned and confused") {
      //stuff you wanted to do when you stunned the target
    }
    ("Your powerful bash dazes an old man.") {
      //stuff you wanted to do if there was no stun and the next line was another bash
      #state tBash 1
    }
    {
      //stuff you wanted to do when there was no stun and any other line then the above two happened
      #send bash
      #state tBash 0
    }
} {Within Lines|param=1}


This fully limits the trigger match to the bash line and the one line immediately after it. Since we couldn't match just the stun line, we had to match everything and test it in the code. I gave you a point to do stuff if it was a stun, if it was not a stun but there was another bash (setting the trigger up to again look for the stun message), and if there was no stun and whatever came next was not a bash (send bash).
_________________
EDIT: I didn't like my old signature
Reply with quote
Daoshai
Beginner


Joined: 04 Aug 2012
Posts: 13
Location: Milton

PostPosted: Mon Nov 05, 2012 1:42 am   
 
Heres what my script looks like


Code:

#CLASS {bashtest}
#TRIGGER {You're already engaged this round!} {#IF (@bashRounds = 0) {#ADD bashRounds 1}}
#TRIGGER {Bash whom?} {#IF (@bashRounds = 0) {#ADD bashRounds 1}}
#TRIGGER {Your opponent appears momentarily stunned and confused.} {#IF (@bashRounds = 0) {#ADD bashRounds 1}}
#TRIGGER {Your opponent appears severely stunned and confused.} {#IF (@bashRounds < 5) {#VAR bashRounds 5}}
#TRIGGER {Your opponent appears briefly stunned and confused.} {#IF (@bashRounds < 3) {#VAR bashRounds 3}}
#TRIGGER {EXP: (*)} {
  #IF (@bashRounds > 0) {#ADD bashRounds -1} {}
  #PRIORITY {#IF (@bashRounds = 0) {bash}}
  }
#TRIGGER {Your bash does no damage.} {bash}
#TRIGGER {Your shield bash soundly trounces the air!} {bash}
#TRIGGER {Your shield whooshes through the air.} {bash}

#TRIGGER "tBash1" {^Putting your weight behind your bash, your shield shatters (*) jaw and nearly fractures his skull.$} {}
#COND {(*)} {
  #SWITCH (%1)
    ("Your opponent appears (*) stunned and confused.") {}
    ("Putting your weight behind your bash, your shield shatters (*) jaw and nearly fractures his skull.") {
      #STATE tBash1 1
    }
    {
      #SEND bash
      #STATE tBash1 0
    }
} {Within Lines|param=1}


#TRIGGER "tBash2" {^(*) nearly falls to the ground when you hit him with your shield.$} {}
#COND {(*)} {
  #SWITCH (%1)
    ("Your opponent appears (*) stunned and confused.") {}
    ("(*) nearly falls to the ground when you hit him with your shield.") {
      #STATE tBash2 1
    }
    {
      #SEND bash
      #STATE tBash2 0
    }
} {Within Lines|param=1}

#TRIGGER "tBash3" {^You nearly flatten (*).$} {}
#COND {(*)} {
  #SWITCH (%1)
    ("Your opponent appears (*) stunned and confused.") {}
    ("You nearly flatten (*).") {
      #STATE tBash3 1
    }
    {
      #SEND bash
      #STATE tBash3 0
    }
} {Within Lines|param=1}

#TRIGGER "tBash4" {^You hear bones cracking when you hit (*) with your shield.$} {}
#COND {(*)} {
  #SWITCH (%1)
    ("Your opponent appears (*) stunned and confused.") {}
    ("You hear bones cracking when you hit (*) with your shield.") {
      #STATE tBash4 1
    }
    {
      #SEND bash
      #STATE tBash4 0

#TRIGGER "tBash5" {^You slam your shield into (*), crushing the breath from his lungs.$} {}
#COND {(*)} {
  #SWITCH (%1)
    ("Your opponent appears (*) stunned and confused.") {}
    ("You slam your shield into (*), crushing the breath from his lungs.") {
      #STATE tBash5 1
    }
    {
      #SEND bash
      #STATE tBash5 0

#TRIGGER "tBash6" {^
#TRIGGER {You hear a nice resounding thud when you hit (*) with your shield.$} {}
#COND {(*)} {
  #SWITCH (%1)
    ("Your opponent appears (*) stunned and confused.") {}
    ("You hear a nice resounding thud when you hit (*) with your shield.") {
      #STATE tBash6 1
    }
    {
      #SEND bash
      #STATE tBash6 0

#TRIGGER "tBash7" {^(*) is thrown back head over feet by your incredible shield strike.$} {}
#COND {(*)} {
  #SWITCH (%1)
    ("Your opponent appears (*) stunned and confused.") {}
    ("(*) is thrown back head over feet by your incredible shield strike.") {
      #STATE tBash7 1
    }
    {
      #SEND bash
      #STATE tBash7 0

#TRIGGER "tBash8" {^You clearly surprise (*) with your shield bash.$} {}
#COND {(*)} {
  #SWITCH (%1)
    ("Your opponent appears (*) stunned and confused.") {}
    ("You clearly surprise (*) with your shield bash.") {
      #STATE tBash8 1
    }
    {
      #SEND bash
      #STATE tBash8 0

#TRIGGER "tBash9" {^Your bash barely touches (*).$} {}
#COND {(*)} {
  #SWITCH (%1)
    ("Your opponent appears (*) stunned and confused.") {}
    ("Your bash barely touches (*).") {
      #STATE tBash9 1
    }
    {
      #SEND bash
      #STATE tBash9 0
#CLASS 0


The problem is I have multiple bash dmg messages. Looks like I have some syntax errors, not sure where though.
Thanks for the help guys
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Mon Nov 05, 2012 6:18 am   
 
Looks like you're missing the closing } from all of your switches and triggers from tBash4 down.
_________________
EDIT: I didn't like my old signature
Reply with quote
Daoshai
Beginner


Joined: 04 Aug 2012
Posts: 13
Location: Milton

PostPosted: Tue Nov 06, 2012 2:57 pm   
 
Code:

#CLASS {bashtests}
#TRIGGER {You're already engaged this round!} {#IF (@bashRounds = 0) {#ADD bashRounds 1}}
#TRIGGER {Bash whom?} {#IF (@bashRounds = 0) {#ADD bashRounds 1}}
#TRIGGER {Your opponent appears momentarily stunned and confused.} {#IF (@bashRounds = 0) {#ADD bashRounds 1}}
#TRIGGER {Your opponent appears severely stunned and confused.} {#IF (@bashRounds < 5) {#VAR bashRounds 5}}
#TRIGGER {Your opponent appears briefly stunned and confused.} {#IF (@bashRounds < 3) {#VAR bashRounds 3}}
#TRIGGER {EXP: (*)} {
  #IF (@bashRounds > 0) {#ADD bashRounds -1} {}
  #PRIORITY {#IF (@bashRounds = 0) {bash}}
  }
#TRIGGER {Your bash does no damage.} {bash}
#TRIGGER {Your shield bash soundly trounces the air!} {bash}
#TRIGGER {Your shield whooshes through the air.} {bash}
#TRIGGER "tBash1" {^Putting your weight behind your bash, your shield shatters (*) jaw and nearly fractures his skull.$} {}
#COND {(*)} {
  #SWITCH (%1)
    ("Your opponent appears (*) stunned and confused.") {
   }
    ("Putting your weight behind your bash, your shield shatters (*) jaw and nearly fractures his skull.") {
      #STATE tBash1 1
    }
    {
      #SEND bash
      #STATE tBash1 0
    }
} {Within Lines|param=1}
#TRIGGER "tBash2" {^(*) nearly falls to the ground when you hit him with your shield.$} {}
#COND {(*)} {
  #SWITCH (%1)
    ("Your opponent appears (*) stunned and confused.") {
   }
    ("(*) nearly falls to the ground when you hit him with your shield.") {
      #STATE tBash2 1
    }
    {
      #SEND bash
      #STATE tBash2 0
    }
} {Within Lines|param=1}
#TRIGGER "tBash3" {^You nearly flatten (*).$} {}
#COND {(*)} {
  #SWITCH (%1)
    ("Your opponent appears (*) stunned and confused.") {}
    ("You nearly flatten (*).") {
      #STATE tBash3 1
    }
    {
      #SEND bash
      #STATE tBash3 0
    }
} {Within Lines|param=1}
#TRIGGER "tBash4" {^You hear bones cracking when you hit (*) with your shield.$} {
   }
#COND {(*)} {
  #SWITCH (%1)
    ("Your opponent appears (*) stunned and confused.") {}
    ("You hear bones cracking when you hit (*) with your shield.") {
      #STATE tBash4 1
    }
    {
      #SEND bash
      #STATE tBash4 0
   }
} {Within Lines|param=1}
#TRIGGER "tBash5" {^You slam your shield into (*), crushing the breath from his lungs.$} {
   }
#COND {(*)} {
  #SWITCH (%1)
    ("Your opponent appears (*) stunned and confused.") {}
    ("You slam your shield into (*), crushing the breath from his lungs.") {
      #STATE tBash5 1
    }
    {
      #SEND bash
      #STATE tBash5 0
   }
} {Within Lines|param=1}
#TRIGGER "tBash6" {^You hear a nice resounding thud when you hit (*) with your shield.$} {
   }
#COND {(*)} {
  #SWITCH (%1)
    ("Your opponent appears (*) stunned and confused.") {}
    ("You hear a nice resounding thud when you hit (*) with your shield.") {
      #STATE tBash6 1
    }
    {
      #SEND bash
      #STATE tBash6 0
   }
} {Within Lines|param=1}
#TRIGGER "tBash7" {^(*) is thrown back head over feet by your incredible shield strike.$} {
   }
#COND {(*)} {
  #SWITCH (%1)
    ("Your opponent appears (*) stunned and confused.") {}
    ("(*) is thrown back head over feet by your incredible shield strike.") {
      #STATE tBash7 1
    }
    {
      #SEND bash
      #STATE tBash7 0
   }
} {Within Lines|param=1}
#TRIGGER "tBash8" {^You clearly surprise (*) with your shield bash.$} {
   }
#COND {(*)} {
  #SWITCH (%1)
    ("Your opponent appears (*) stunned and confused.") {}
    ("You clearly surprise (*) with your shield bash.") {
      #STATE tBash8 1
    }
    {
      #SEND bash
      #STATE tBash8 0
   }
} {Within Lines|param=1}
#TRIGGER "tBash9" {^Your bash barely touches (*).$} {
   }
#COND {(*)} {
  #SWITCH (%1)
    ("Your opponent appears (*) stunned and confused.") {}
    ("Your bash barely touches (*).") {
      #STATE tBash9 1
    }
    {
      #SEND bash
      #STATE tBash9 0
   }
} {Within Lines|param=1}

#CLASS 0


Still have a syntax error. Not sure =/

Opps, just realized I'm in a CMUD forum, I'm on ZMUD. My apologies, what would I need to change?
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4691
Location: Pensacola, FL, USA

PostPosted: Tue Nov 06, 2012 7:04 pm   
 
the #SWITCHes into nested #IFs i believe
_________________
Discord: Shalimarwildcat
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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