|
rgross Newbie
Joined: 27 Dec 2005 Posts: 6
|
Posted: 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
} |
|
|
|
|
Vitae Enchanter
Joined: 17 Jun 2005 Posts: 673 Location: New York
|
Posted: Tue Dec 27, 2005 10:33 pm |
try:
#mes Notch "%-1"
#cap Flee
#win Flee %time( hh:mm:ss)
#if ("%-1" = 'spellcast nature') {
etc |
|
|
|
rgross Newbie
Joined: 27 Dec 2005 Posts: 6
|
Posted: 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
} |
|
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Wed Dec 28, 2005 6:21 am |
Lemme point ya in the right direction.
#if ("%1" = "spellcast enchantment") { |
|
|
|
rgross Newbie
Joined: 27 Dec 2005 Posts: 6
|
Posted: 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
} |
|
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4691 Location: Pensacola, FL, USA
|
Posted: Wed Dec 28, 2005 5:31 pm |
cause you need the %-1 again
|
|
_________________ Discord: Shalimarwildcat |
|
|
|
rgross Newbie
Joined: 27 Dec 2005 Posts: 6
|
Posted: Wed Dec 28, 2005 5:35 pm |
Switched to %-1, still not firing.
|
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: 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") { |
|
|
|
rgross Newbie
Joined: 27 Dec 2005 Posts: 6
|
Posted: Wed Dec 28, 2005 7:25 pm |
Trimming it seemed to do the trick. Thanks
|
|
|
|
|
|