Openkore.com

OpenKore Forums
It is currently 18 Nov 2018, 14:14

All times are UTC - 5 hours [ DST ]





Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Conditional statement fails
PostPosted: 30 Jul 2018, 00:19 
Offline
Noob
Noob

Joined: 06 Jul 2018, 15:27
Posts: 8
I would like to seek help. My conditional statement is not working. I do not understand why.
Code fragment
Code:
      log $.lvl
      log @eval($::char->{jobID})
      if ($.lvl >= "85") {
         log i1
         switch ("@eval($::char->{jobID})") {
            log i2
            case (=~ /1|7|4008|4060|14|4015|4073|5|10|18|4011|4019|4064|4078|2|9|4010|4061|17|4018|4079|4046|24|4215/i) {
               log i3
               $aspdPots = "Berserk Potion"
            }
         }
      } elsif ($.lvl >= "40" && $.lvl < "85") {
         log i4
         $aspdPots = "Awakening Potion"
      } else {
         log i5
         $aspdPots = "Concentration Potion"
      }
      log $aspdPots eee
      do conf useSelf_item_0 $aspdPots
      do conf useSelf_item_0_whenStatusInactive $aspdPots


This is the output
Code:
[macro log] 75
[macro log] 4019
[macro log]  eee
Config 'useSelf_item_0' is Awakening Potion
Config 'useSelf_item_0_whenStatusInactive' is Awakening Potion

To me, the lines 4 & 5 in the output seems to "query" only the useSelf_item_0, instead of "replace" it. Quite evident on line 3.
I also tried removing the "" from the @eval & the numbers but it does not help.
Can you help me spot what is the problem?

Thanks.


Top
 Profile  
 
 Post subject: Re: Conditional statement fails
PostPosted: 30 Jul 2018, 03:22 
Offline
OpenKore Monk
OpenKore Monk
User avatar

Joined: 17 Nov 2017, 23:32
Posts: 466
Location: Genting Highland, Malaysia
So you trying to check useSelf_item speed potion based on level, and change accordingly?
I could think a simple solution if this is what you wanted. :)

Have you tried with eventMacro.pl?
Automacro ConfigKey is what you need, I think. :?

Macro.pl is no longer being updated, though it still working.

_________________

I'll not give answer. I'll just showing you the way to find it
Wiki & Google are your best allies. If you're lazy to read I won't bother answering
Image


Top
 Profile  
 
 Post subject: Re: Conditional statement fails
PostPosted: 03 Aug 2018, 20:30 
Offline
Human
Human

Joined: 26 Jul 2011, 21:03
Posts: 31
try to use some temporary var.
like that
Code:
log $.lvl
templv=$.lvl
if(templv <= 85) {
}


Top
 Profile  
 
 Post subject: Re: Conditional statement fails
PostPosted: 16 Aug 2018, 23:27 
Offline
Noob
Noob

Joined: 06 Jul 2018, 15:27
Posts: 8
I forgot I posted something here. :lol:

But anyway, I was able to figure out now what the problem is.

The condition becomes true if the jobID has 1 or 7 or anything in there. (e.g. 4614 will be true)
So I had separate entry for those "unique" values.

Checked the ConfigKey but it looks quite tedious to me. Maybe in the future. :lol:

Thanks anyway~


Top
 Profile  
 
 Post subject: Re: Conditional statement fails
PostPosted: 17 Aug 2018, 16:04 
Offline
Moderators
Moderators
User avatar

Joined: 16 Dec 2011, 02:53
Posts: 1212
Location: Brazil
gooey wrote:
I forgot I posted something here. :lol:

But anyway, I was able to figure out now what the problem is.

The condition becomes true if the jobID has 1 or 7 or anything in there. (e.g. 4614 will be true)
So I had separate entry for those "unique" values.

Checked the ConfigKey but it looks quite tedious to me. Maybe in the future. :lol:

Thanks anyway~

It's because you're using regular expression to match the pattern. You've used :

1 | 7 -> it means one or seven. They will trigger with 17 too.

2 | 9 -> will catch 4019.


Nice you've learned.

http://jkorpela.fi/perl/regexp.html

Take a look at 'alternative' symbol.

_________________
"'There are three things all wise men fear: the sea in storm, a night with no moon, and the anger of a gentle man.'" :P

viewtopic.php?f=10&t=16117

Thanks for this Eternal! =D <3<3


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group