|
Kush Newbie
Joined: 31 May 2016 Posts: 8 Location: Yorkshire, England
|
Posted: Tue May 31, 2016 9:36 pm
Nested If's |
I am having some problems using #if multiple times in a trigger to set variables . I have managed to make this work with multiple triggers for each @grouperX. This is super messy and seems very backwards. So now I am attempting the same but with just one trigger set.. Currently with little success!
So here's what I have tried:-
Pattern : ^There is a sudden white flash around %w
Value: #IF (%1=@grouper1) {#VAR group1strength 5} {#IF (%1=@grouper2) {#VAR group2strength 5} {#IF (%1=@grouper3) {#VAR group3strength 5}}}
Ive also tried this:-
Pattern : ^There is a sudden white flash around %w
Value : #IF (%1=@grouper1) {#VAR group1strength 5}
#IF (%1=@grouper2) {#VAR group2strength 5}
Ive tried structuring it differently and have had some positive results, but it only seems to affect the first @groupXstrength variable
I have little coding experience and have only been playing around with zmud for a few weeks now, any help would be greatly appreciated.
Kush |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Tue May 31, 2016 9:41 pm |
It looks like you formatted and wrote your #IFs correctly, either format should work the first is more efficient. I would say the problem is that you forgot the parenthesis to capture a value in the pattern:
^There is a sudden white flash around (%w) |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
Kush Newbie
Joined: 31 May 2016 Posts: 8 Location: Yorkshire, England
|
Posted: Tue May 31, 2016 9:47 pm |
Omg it was that simple! I cannot believe it, 7hrs+ smashing stuff around in the value box. Never thinking it might be my capture pattern...
Thank you so much for the quick reply! So very happy this is working now :P
Kush |
|
|
|
Kush Newbie
Joined: 31 May 2016 Posts: 8 Location: Yorkshire, England
|
Posted: Wed Jun 01, 2016 12:38 am |
It is working perfectly for my previous trigger:-
Pattern: ^There is a sudden white flash around (%w)
Value :
#ECHO Works
#IF (%1=@grouper1) {#VAR group1strength 0} {#IF (%1=@grouper2) {#VAR group2strength 0} {#IF (%1=@grouper3) {#VAR group3strength 0} {#IF (%1=@grouper4) {#VAR group4strength 0} {#IF (%1=@grouper5) {#VAR group5strength 0}}}}}
But, for my next trigger it is not working:-
Pattern:
The wobbling orange glow around (%w) * becomes flickering yellow
Value:
#ECHO Works
#IF (%1=@grouper1) {#VAR group1strength 1} {#IF (%1=@grouper2) {#VAR group2strength 1} {#IF (%1=@grouper3) {#VAR group3strength 1} {#IF (%1=@grouper4) {#VAR group4strength 1} {#IF (%1=@grouper5) {#VAR group5strength 1}}}}}
Returns:
[The wobbling orange glow around (%w) * becomes flickering yellow-> #ECHO Works
#IF (leyan=@grouper1) {#VAR group1strength 1} {#IF (leyan=@grouper2) {#VAR group2strength 1} {#IF (leyan=@grouper3) {#VAR group3strength 1} {#IF (leyan=@grouper4) {#VAR group4strength 1} {#IF (leyan=@grouper5) {#VAR group5strength 1}}}}}]
Works
Its capturing but isn't changing the values of @groupXstrength variables. I think I may be missing a trick in the capture again, but I have tried iteration after iteration to no avail again. Seems I am unable to grasp pattern matching firmly no matter how much I google. Any thoughts?
Kush |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4690 Location: Pensacola, FL, USA
|
Posted: Wed Jun 01, 2016 1:49 pm |
Aren't there more than just the two possible colors in the shield?
Are you sure the @grouperX variables are properly defined?
Your #IFs are testing "leyan" not %1 |
|
_________________ Discord: Shalimarwildcat |
|
|
|
Kush Newbie
Joined: 31 May 2016 Posts: 8 Location: Yorkshire, England
|
Posted: Wed Jun 01, 2016 4:37 pm |
There are 6 levels of shield colour defined by a gauge button from min-level 0 to max-level 5 for each of the @grouperX variables
I have 12 different triggers to change to the different levels of shield, each of them has and identical #IF statement with the only value changing being the @groupXstrength variable
I assign the @grouperX with a #prompt for each using a push button and I am sure @grouperX variables are correct
%1 should equal Leyan in the capture
As should @grouper2 in the #IF
This one works and assigns the correct @groupstrength to the @grouperX:-
Pattern: There is a sudden white flash around Leyan von Toke
Trigger: ^There is a sudden white flash around (%w)
Value: #IF (%1=@grouper1) {#VAR group1strength 0} {#IF (%1=@grouper2) {#VAR group2strength 0} {#IF (%1=@grouper3) {#VAR group3strength 0} {#IF (%1=@grouper4) {#VAR group4strength 0} {#IF (%1=@grouper5) {#VAR group5strength 0}}}}}
This however triggers but does no assign any @groupXstrength variables:-
Pattern: The wobbling orange glow aroung Leyan von Toke becomes flickering yellow
Trigger: The wobbling orange glow around (%w) * becomes flickering yellow
Value: #IF (%1=@grouper1) {#VAR group1strength 1} {#IF (%1=@grouper2) {#VAR group2strength 1} {#IF (%1=@grouper3) {#VAR group3strength 1} {#IF (%1=@grouper4) {#VAR group4strength 1} {#IF (%1=@grouper5) {#VAR group5strength 1}}}}} |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4690 Location: Pensacola, FL, USA
|
Posted: Wed Jun 01, 2016 4:53 pm |
I assume that 'aroung' was a manual typing error?
Other then that, i don't see any issues.
The second pattern doesn't have the start of line anchor, but that shouldn't matter really.
Check for leading spaces? |
|
_________________ Discord: Shalimarwildcat |
|
|
|
Kush Newbie
Joined: 31 May 2016 Posts: 8 Location: Yorkshire, England
|
Posted: Wed Jun 01, 2016 5:08 pm |
Seems it was the capitalisation of @grouperX variable that stopped this working, it was not matching the captured text. Thank you very much for making me recheck, I will put a notice in the #Prompt 's to remind myself of this.
The only issue I have now is:-
Pattern :- The wobbling orange glow around (%w) * becomes flickering yellow
Trigger: - The wobbling orange glow around Leyan Von becomes flickering yellow ---- Captures and triggers properly
Trigger: - The wobbling orange glow around Leyan Von toke weed and stuff becomes flickering yellow ----- Captures and triggers properly
But.
Trigger: - The wobbling orange glow around Leyan becomes flickering yellow -- Does not trigger
Some players may have surnames and some may not, is * not the correct wildcard?
Apologies for my noob questions, the forums and you guys have been a massive help! |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4690 Location: Pensacola, FL, USA
|
Posted: Wed Jun 01, 2016 5:22 pm |
better would be to just use (*) and then pull the name out from that with %word(%1, 1)
|
|
_________________ Discord: Shalimarwildcat |
|
|
|
Kush Newbie
Joined: 31 May 2016 Posts: 8 Location: Yorkshire, England
|
Posted: Wed Jun 01, 2016 5:34 pm |
Amazing! Thank you very much for your time, it really is appreciated. all are working as they should!
Thanks again
Kush |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Wed Jun 01, 2016 5:45 pm |
Quote: |
Some players may have surnames and some may not, is * not the correct wildcard? |
Your current pattern would not match when a player has only a single name, because you have " * " after the capture, spelling that out if the forum makes it hard to see: [space][asterisk][space]. That means there must be 2 [space] characters between the name and "becomes flicker". Shalimar's suggestion of switching to * to capture all the words and then using %word to reduce to just the first one eliminates that problem.
At the same time you can deal with that issue of case sensitivity using either %upper or %lower on both sides.
Trigger: The wobbling orange glow around (*) becomes flickering yellow
Value:
FadeTarget=%lower(%word(%1,1))
#IF (@FadeTarget=@grouper1) {#VAR group1strength 1} {#IF (@FadeTarget=@grouper2) {#VAR group2strength 1} {#IF (@FadeTarget=@grouper3) {#VAR group3strength 1} {#IF (@FadeTarget=@grouper4) {#VAR group4strength 1} {#IF (@FadeTarget=@grouper5) {#VAR group5strength 1}}}}}
And in the buttons that do the #PROMPT you change it to use %prompt something like:
grouper1=%lower(%prompt("Enter name for party member 1."))
Or get really fancy and think about automating the capture of party member's names. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4690 Location: Pensacola, FL, USA
|
Posted: Wed Jun 01, 2016 5:49 pm |
%proper will match the mud output
or we could skip that altogether and use %match(%1, @grouperX) since that would ignore case |
|
_________________ Discord: Shalimarwildcat |
|
|
|
|
|