|
noz Beginner
Joined: 28 Nov 2004 Posts: 10
|
Posted: Sun Nov 28, 2004 3:47 am
If statement going crazy on me |
ok, I have been working with this for hours and I can't figure out what is wrong. What I want to do is set up a trigger that will read my prompt and store certain info to variables that I can send to a status window. Here are a couple sample prompts from the game:
H:269 M:308 E:1247 W:1443 <eb pdb>
H:269 M:308 E:1247 W:1443 <-b pdb>
H:269 M:308 E:1247 W:1443 <eb pb>
I made a trigger for the prompt which looks like this:
H:%n M:%n E:%n W:%n ~<(*)~>
the part that I want to store is the last part "<eb pdb>" (with each letter standing for a certain condition, such as 'e' is equilibrium, first 'b' is balance, and so on). I tried to make it so that if %1 (which is what ever is in between < >) was equalled to something like 'eb' then the variable equilibrium would be equal to YES and the variable balance would be equal to yes, if the p is shown in the display then variable prone would be equal to Yes, etc. and if the letter wasn't shown in the prompt then the variable matching it would be equal to NO. This is the trigger that I wrote. it looks fine to me, but when i save it and go back to the game it spams my screen with messages saying "I dont understand" and things like that. well here it is:
#TRIGGER {H:%n M:%n E:%n W:%n ~<(*)~>} {#if (%1=eb pdb) {equilibrium = Yes;Balance = Yes;prone = Yes;deaf = Yes;Blind = Yes};;#if (%1=eb pd) {equilibrium = Yes;Balance = Yes;Prone = Yes;Deaf = Yes;Blind = no};;#if (%1=eb pb) {equilibrium = Yes;Balance = Yes;prone = Yes;deaf = No;Blind = Yes};;#if (%1=eb p) {equilibrium = Yes;Balance = Yes;prone = Yes;deaf = No;Blind = No};;#if (%1=eb d) {equilibrium = Yes;Balance = Yes;prone = No;deaf = Yes;Blind = No};;#if (%1=eb b) {equilibrium = Yes;Balance = Yes;prone = No;deaf = No;Blind = Yes};;#if (%1=e- pdb) {equilibrium = Yes;Balance = No;prone = Yes;deaf = Yes;Blind = Yes};;#if (%1=e- pd) {equilibrium = Yes;Balance = No;Prone = Yes;Deaf = Yes;Blind = no};;#if (%1=e- pb) {equilibrium = Yes;Balance = No;prone = Yes;deaf = No;Blind = Yes};;#if (%1=e- p) {equilibrium = Yes;Balance = No;prone = Yes;deaf = No;Blind = No};;#if (%1=e- d) {equilibrium = Yes;Balance = No;prone = No;deaf = Yes;Blind = No};;#if (%1=e- b) {equilibrium = Yes;Balance = No;prone = No;deaf = No;Blind = Yes};;#if (%1=-b pdb) {equilibrium = No;Balance = Yes;prone = Yes;deaf = Yes;Blind = Yes};;#if (%1=-b pd) {equilibrium = No;Balance = Yes;Prone = Yes;Deaf = Yes;Blind = no};;#if (%1=-b pb) {equilibrium = No;Balance = Yes;prone = Yes;deaf = No;Blind = Yes};;#if (%1=-b p) {equilibrium = No;Balance = Yes;prone = Yes;deaf = No;Blind = No};;#if (%1=-b d) {equilibrium = No;Balance = Yes;prone = No;deaf = Yes;Blind = No};;#if (%1=-b b) {equilibrium = No;Balance = Yes;prone = No;deaf = No;Blind = Yes};;#if (%1=-- pdb) {equilibrium = No;Balance = No;prone = Yes;deaf = Yes;Blind = Yes};;#if (%1=-- pd) {equilibrium = No;Balance = No;Prone = Yes;Deaf = Yes;Blind = no};;#if (%1=-- pb) {equilibrium = No;Balance = No;prone = Yes;deaf = No;Blind = Yes};;#if (%1=-- p) {equilibrium = No;Balance = No;prone = Yes;deaf = No;Blind = No};;#if (%1=-- d) {equilibrium = No;Balance = No;prone = No;deaf = Yes;Blind = No};;#if (%1=-- b) {equilibrium = No;Balance = No;prone = No;deaf = No;Blind = Yes}} "afflictions" {nocr|prompt}
any help you can give would be greatly appreciated. if you need further info to help, then please just ask and I will tell you what I can. |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Sun Nov 28, 2004 9:39 am |
ok assuming if you don't have e or b it gives you a -, and if you are not affected with pdb they don't show up. I would also use a data-record and 1/0 for on and off its easier to manage this way (If you want to try this way lemme know) but this is based off of what you have provided.
#TRIGGER "affprompt" {H:%n M:%n E:%n W:%n ~<({-|e})({-|b})(*)~>} {
#IF ("%1"="e") {#VAR equilibrium "Yes"} {#VAR equilibrium "No"}
#IF ("%2"="b") {#VAR balance "Yes"} {#VAR balance "No"}
#IF (%pos( "p", "%3")) {#VAR prone "Yes"} {#VAR prone "No"}
#IF (%pos( "b", "%3")) {#VAR blind "Yes"} {#VAR blind "No"}
#IF (%pos( "d", "%3")) {#VAR deaf "Yes"} {#VAR deaf "No"}
} "afflictions" {nocr|prompt}
Used Pretty Print
Syntax Colourizer
Edit: I adjusted the pattern to only match on -/e or -/b however the original will still work this is just a stricter match. |
|
|
|
noz Beginner
Joined: 28 Nov 2004 Posts: 10
|
Posted: Sun Nov 28, 2004 8:52 pm |
thanks! that works perfectly for what I'm trying to do. I appreciate it
|
|
_________________
|
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Tue Nov 30, 2004 2:45 am |
This is just a simple rewrite to use 1/0 for Yes and No, this route offers much more flexibilty then yes/no and is less error prone
#TRIGGER "affprompt" {H:%n M:%n E:%n W:%n ~<({-|e})({-|b})(*)~>} {
#IF ("%1"="e") {#VAR equilibrium 1} {#VAR equilibrium 0}
#IF ("%2"="b") {#VAR balance 1} {#VAR balance 0}
#IF (%pos( "p", "%3")) {#VAR prone 1} {#VAR prone 0}
#IF (%pos( "b", "%3")) {#VAR blind 1} {#VAR blind 0}
#IF (%pos( "d", "%3")) {#VAR deaf 1} {#VAR deaf 0}
} "afflictions" {nocr|prompt} |
|
|
|
zeather483 Newbie
Joined: 18 Oct 2008 Posts: 4
|
Posted: Sun Jun 09, 2013 1:37 pm |
how would i rewrite this trigger to also allow me to save h: m: e: w: to seperate variables
|
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sun Jun 09, 2013 3:04 pm |
() is used in trigger patterns to capture stuff and put it into the %1...%99 variables. In the code, you would then assign those %1...%99 variables to regular variables.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
|
|