|
MaQ Newbie
Joined: 11 Oct 2004 Posts: 7
|
Posted: Mon Oct 11, 2004 10:22 am
Help with some If statements |
Just wanted some help with a problem, or some better ideas...
I want to pull a string of letters from my hp bar individually.
ABCDE for example. I am doing this buy using the (?) like so,
(?)(?)(?)(?)(?) which grabs the characters seperately like i want.
I then created the following if statements that dont work. Any help would be appreciated.
#IF (%1 = A or %2 = A or %3 = A or %4 = A or %5 = A) {@var1 = 1}
#IF (%1 != A or %2 != A or %3 != A or %4 != A or %5 != A) {@var1 = 2}
Im trying to get some letters off my hpbar to find out if i have certain skills turned on or not if anyone has done this or knows of a better way, or can help me with my way id appreciate it.
Thanks |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Mon Oct 11, 2004 10:43 am |
Use (?????) or (&5) in your pattern.
Do not use @ when assigning variables unless you mean to make an indirect reference.
Also the logical reverse of a series of OR conditions is a series of AND NOT conditions. When doing this it is simpler to pull the NOT out and use () to control the order of operations. To simply the whole thing use %pos in the #IF, for example:
#IF (%pos("A","%1") {var1=1} {var1=2} |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
MaQ Newbie
Joined: 11 Oct 2004 Posts: 7
|
Posted: Mon Oct 11, 2004 11:25 am |
Ok, thanks for the quick response.
I changed the (?)(?) to (??)like you said but then when i tested, it responded with
%1 xx
where i need them to be seperate so i use (?)(?) so i get
%1 x
%2 x
see the ABCDEF i used in my first example may be ACD or AEF, the variables change depending on what skills im using so i need to find a way to see if certain letter are in my hpbar or not.
Now im not quite folowing you on the
#IF(%pos("A",%1) does this part check to see if there is an "A" as the first letter?
and what if "A" is the second letter and not the first.?
then the {var1=1} for if its true and then {var1=2} if its false, IF im guessing right then i shoulb be able to make a line like so.
#IF(%pos("A",%1) {var1=1} {var1=2}
#IF(%pos("A",%2) {var1=1} {var1=2}
#IF(%pos("A",%3) {var1=1} {var1=2}
#IF(%pos("A",%4) {var1=1} {var1=2}
#IF(%pos("A",%5) {var1=1} {var1=2}
This would check if there was an "A" in and of the positions and then adjust the apropriate variable.
Thanks for the help, and working with a newbie.... |
|
|
|
MaQ Newbie
Joined: 11 Oct 2004 Posts: 7
|
Posted: Mon Oct 11, 2004 11:55 am |
LOL i just realized that my post wont work,
#IF(%pos("A",%1) {var1=1} {var1=2}
#IF(%pos("A",%2) {var1=1} {var1=2}
#IF(%pos("A",%3) {var1=1} {var1=2}
#IF(%pos("A",%4) {var1=1} {var1=2}
#IF(%pos("A",%5) {var1=1} {var1=2}
will always leave the var1 with the value of 2 because one of the values will not = "A"
any help would be great |
|
|
|
MaQ Newbie
Joined: 11 Oct 2004 Posts: 7
|
Posted: Mon Oct 11, 2004 12:05 pm |
I tried using this but it only takes the first value
#IF (%pos( "A", %1, %2, %3, %4, %5)) {var1=1} {var1=2} |
|
|
|
MaQ Newbie
Joined: 11 Oct 2004 Posts: 7
|
Posted: Mon Oct 11, 2004 12:23 pm |
Well after doing some research i figured out what you were trying to teach me. I got it working and your way of doing it was much easier and i learned, thanks alot
|
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Mon Oct 11, 2004 12:24 pm |
Please read #HELP %pos
//The (*) is the ABCD part of your pattern since you think it unnec to give a complete example. Also using boolean True/False 1/0 variables would be the way to go. I am not sure if %pos is case sensitive so make sure the first part of pos is the same case as your prompt.
#TRIGGER "Prompt" {Yourpattern (*)} {
#IF (%pos(A,%1)) {varA=1} {var1=0}
#IF (%pos(B,%1)) {varB=1} {varB=0}
#IF (%pos(C,%1)) {varC=1} {varB=0}
IF D
IF E etc
} "" {prompt|nocr} |
|
|
|
MaQ Newbie
Joined: 11 Oct 2004 Posts: 7
|
Posted: Mon Oct 11, 2004 12:40 pm |
Thank you for your comments, yes i read the help on #pos and thats what keyed me in on what I was doing wrong. The only reason i didnt show my actual HPbar is becaue it long and my prompt is kinda complicated. I guess i just wanted to make it simpler to work with. But here is my hp bar and my answer to my problem if anyone want to look at it or give anymore improvements
ORIGINAL HP BAR
HP[730/730] SP[60/60] ST[61.09%] PP[99.66%] CF[1/32%] FF[MAX] E[24%] N PADBHVF
TRIGGER PROMPT
HP~[(%d)~/(%d)~] SP~[(%d)~/(%d)~] ST~[(%d)~.(%d)~%~] PP~[(%d)~.(%d)~%~] CF~[(%d)~/(%d)~%~] FF~[(%*)~] E~[(*)~] (*) (??????)
#IF (%pos( "H", "%14")) {hyper=1} {hyper=2}
#IF (%pos( "B", "%14")) {bio=1} {bio=2}
#IF (%pos( "A", "%14")) {adren=1} {adren=2}
#IF (%pos( "V", "%14")) {pers=1} {pers=2}
#IF (%pos( "D", "%14")) {diss=1} {diss=2}
I just wanted to say thanks again for the help.
I apologize if i seemed rude by not showing my details at first. |
|
|
|
|
|