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
rgross
Newbie


Joined: 27 Dec 2005
Posts: 6

PostPosted: Tue Dec 27, 2005 9:56 pm   

If statement problem
 
Not sure what's up here. I have the following trigger setup. However, none of the if statements seem to function as I intend. Essentially any time the line "You have learned something new about" comes up, and the following text happens to be any of the following 'if's', all trigs go off. My intention is it to fire for spellcast nature when that notches, spellcast generic that notches, etc... Any suggestions?

Code:
You have learned something new about (*)!


Code:
#mes Notch %1
#cap Flee
#win Flee %time( hh:mm:ss)
#if (%1 = 'spellcast nature') {
  #win Flee @nature
  #var nature1 @nature
  #var nature 0
  }
#if (%1 = 'spellcast generic') {
  #win Flee @generic
  #var generic1 @generic
  #var generic 0
  }
#if (%1 = 'spellcast necromancy') {
  #win Flee @necromancy
  #var necromancy1 @necromancy
  #var necromancy 0
  }
#if (%1 = 'spellcast invocation') {
  #win Flee @invocation
  #var invocation1 @invocation
  #var invocation 0
  }
#if (%1 = 'spellcast healing') {
  #win Flee @healing
  #var healing1 @healing
  #var healing 0
  }
#if (%1 = 'spellcast teleportation') {
  #win Flee @teleportation
  #var teleportation1 @teleportation
  #var teleportation 0
  }
#if (%1 = 'spellcast summoning') {
  #win Flee @summoning
  #var summoning1 @summoning
  #var summoning 0
  }
#if (%1 = 'spellcast protection') {
  #win Flee @protection
  #var protection1 @protection
  #var protection 0
  }
#if (%1 = 'spellcast divination') {
  #win Flee @divination
  #var divination1 @divination
  #var divination 0
  }
#if (%1 = 'spellcast enchantment') {
  #win Flee @enchantment
  #var enchantment1 @enchantment
  #var enchantment 0
  }
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Tue Dec 27, 2005 10:33 pm   
 
try:
#mes Notch "%-1"
#cap Flee
#win Flee %time( hh:mm:ss)
#if ("%-1" = 'spellcast nature') {
etc
_________________
http://www.Aardwolf.com
Reply with quote
rgross
Newbie


Joined: 27 Dec 2005
Posts: 6

PostPosted: Tue Dec 27, 2005 10:46 pm   
 
Tried that but got the same result.

Code:
#mes Notch "%-1"
#cap Flee
#win Flee %time( hh:mm:ss)
#if ("%-1" = 'spellcast nature') {
  #win Flee @nature
  #var nature1 @nature
  #var nature 0
  }
#if ("%-1" = 'spellcast generic') {
  #win Flee @generic
  #var generic1 @generic
  #var generic 0
  }
#if ("%-1" = 'spellcast necromancy') {
  #win Flee @necromancy
  #var necromancy1 @necromancy
  #var necromancy 0
  }
#if ("%-1" = 'spellcast invocation') {
  #win Flee @invocation
  #var invocation1 @invocation
  #var invocation 0
  }
#if ("%-1" = 'spellcast healing') {
  #win Flee @healing
  #var healing1 @healing
  #var healing 0
  }
#if ("%-1" = 'spellcast teleportation') {
  #win Flee @teleportation
  #var teleportation1 @teleportation
  #var teleportation 0
  }
#if ("%-1" = 'spellcast summoning') {
  #win Flee @summoning
  #var summoning1 @summoning
  #var summoning 0
  }
#if ("%-1" = 'spellcast protection') {
  #win Flee @protection
  #var protection1 @protection
  #var protection 0
  }
#if ("%-1" = 'spellcast divination') {
  #win Flee @divination
  #var divination1 @divination
  #var divination 0
  }
#if ("%-1" = 'spellcast enchantment') {
  #win Flee @enchantment
  #var enchantment1 @enchantment
  #var enchantment 0
  }
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Wed Dec 28, 2005 6:21 am   
 
Lemme point ya in the right direction.

#if ("%1" = "spellcast enchantment") {
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
rgross
Newbie


Joined: 27 Dec 2005
Posts: 6

PostPosted: Wed Dec 28, 2005 3:47 pm   
 
Made that change, and now rather than all of them firing, none of them fire. The only parts that fire are the first two lines that aren't within an if statement.

Code:
#mes Notch %1
#cap Flee
#win Flee %time( hh:mm:ss)
#if ("%1" = "spellcast nature") {
  #win Flee @nature
  #var nature1 @nature
  #var nature 0
  }
#if ("%1" = "spellcast generic") {
  #win Flee @generic
  #var generic1 @generic
  #var generic 0
  }
#if ("%1" = "spellcast necromancy") {
  #win Flee @necromancy
  #var necromancy1 @necromancy
  #var necromancy 0
  }
#if ("%1" = "spellcast invocation") {
  #win Flee @invocation
  #var invocation1 @invocation
  #var invocation 0
  }
#if ("%1" = "spellcast healing") {
  #win Flee @healing
  #var healing1 @healing
  #var healing 0
  }
#if ("%1" = "spellcast teleportation") {
  #win Flee @teleportation
  #var teleportation1 @teleportation
  #var teleportation 0
  }
#if ("%1" = "spellcast summoning") {
  #win Flee @summoning
  #var summoning1 @summoning
  #var summoning 0
  }
#if ("%1" = "spellcast protection") {
  #win Flee @protection
  #var protection1 @protection
  #var protection 0
  }
#if ("%1" = "spellcast divination") {
  #win Flee @divination
  #var divination1 @divination
  #var divination 0
  }
#if ("%1" = "spellcast enchantment") {
  #win Flee @enchantment
  #var enchantment1 @enchantment
  #var enchantment 0
  }
Reply with quote
shalimar
GURU


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

PostPosted: Wed Dec 28, 2005 5:31 pm   
 
cause you need the %-1 again
_________________
Discord: Shalimarwildcat
Reply with quote
rgross
Newbie


Joined: 27 Dec 2005
Posts: 6

PostPosted: Wed Dec 28, 2005 5:35 pm   
 
Switched to %-1, still not firing. Sad
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Wed Dec 28, 2005 6:57 pm   
 
%-1 is not supported in triggers, only in Alias's Shalimar :p


#if ("%1" = "spellcast enchantment") {

This is an EXACT match so if your trigger is capturing "Spellcast Enhancment" or "Spellcast Enhancment " (not the space) then it won't match, You can solve this by either change "spellcast enhancment" to the exact pattern, or use a case insensitve #IF as shown below

#IF (%lower("%1") = "spellcast enhancment") {


Depending on the circumstances when I am doing string matches I usually run it through a function that %trims/%lowers (among others) this example is shown below

#FUNC trimcase {%lower(%trim("%1"))}
#IF (@trimcase("%1")="spellcast enhancment") {
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
rgross
Newbie


Joined: 27 Dec 2005
Posts: 6

PostPosted: Wed Dec 28, 2005 7:25 pm   
 
Trimming it seemed to do the trick. Thanks
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