Author Topic: Please help with an "OR" action code line.  (Read 3036 times)

0 Members and 1 Guest are viewing this topic.

Offline vanzelusTopic starter

  • Jr. Member
  • **
  • Posts: 24
  • Activity:
    0%
  • Reputation Power: 1
  • vanzelus has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Please help with an "OR" action code line.
« on: January 04, 2014, 05:28:02 PM »
0
Hi,

Am trying to implement the chivalry cure poison spell into a script that I currently run for my sampire; I only want to use this spell when my character is not in combat and is poisoned.  Is this the correct way to write it?

Code: [Select]
IF ( G Notin #charstatus ) && ( C In #charstatus ) && ( #mana >= 10) && ( %cast_wait_timer <= #scnt2 )
{
    Event Macro 15 201
    Target 5s
    Event Macro 23 0
    Set %cast_wait_timer #scnt2 + 20
    Repeat
    Until C Notin #charstatus Or G in #charstatus
}
Return

Thanks for the inputs.
« Last Edit: January 04, 2014, 07:47:52 PM by vanzelus »

Offline 12TimesOver

  • Another Day, Another Vendetta
  • Global Moderator
  • *
  • *
  • Posts: 3694
  • Activity:
    0%
  • Reputation Power: 41
  • 12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.
  • Gender: Male
  • Respect: +321
  • Referrals: 2
    • View Profile
Re: Please help with an "OR" action code line.
« Reply #1 on: January 04, 2014, 08:19:20 PM »
0
You don't need the parens () unless you're grouping multiple criteria together:

for example
Code: [Select]
IF G Notin #charstatus && C In #charstatus && ( #mana >= 10 || %cast_wait_timer <= #scnt2 )
This treats whatever is within the () as a single qualifier for IF.

X
When they come for me I'll be sitting at my desk
     with a gun in my hand wearing a bulletproof vest
My, my, my how the time does fly
     when you know you're gonna die by the end of the night

Offline vanzelusTopic starter

  • Jr. Member
  • **
  • Posts: 24
  • Activity:
    0%
  • Reputation Power: 1
  • vanzelus has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Please help with an "OR" action code line.
« Reply #2 on: January 04, 2014, 10:02:55 PM »
0
You don't need the parens () unless you're grouping multiple criteria together:

for example
Code: [Select]
IF G Notin #charstatus && C In #charstatus && ( #mana >= 10 || %cast_wait_timer <= #scnt2 )
This treats whatever is within the () as a single qualifier for IF.

X

That || symbol you used, can that be used to change the last line in my snippet

Code: [Select]
Until C Notin #charstatus Or G In #charstatus

to

Code: [Select]
Until C Notin #charstatus || G In #charstatus

Does that still accomplish the purpose that the char only casts cure when out of combat and if a new mob spawns, he'll stop casting even if still poisoned and attack the mob?  The char has protection on so am not accounting for failure due to poison interruption.

Offline Alpha

  • Hero Member
  • *
  • Posts: 583
  • Activity:
    0%
  • Reputation Power: 10
  • Alpha barely matters.Alpha barely matters.
  • Respect: +44
  • Referrals: 0
    • View Profile
Re: Please help with an "OR" action code line.
« Reply #3 on: January 04, 2014, 10:32:05 PM »
0
Something like this is how I'd go about it...   The Repeat loop only loops what's BETWEEN the Repeat / Until  which is nada.


Code: [Select]
Sub Cast_Cure
set %Cast_wait_timer #Scnt2 + 20
CAST:
If G Notin #charstatus && C In #charstatus && #mana >= 10 && %cast_wait_timer <= #scnt2
{
    Event Macro 15 201
    Target 5s
    Event Macro 23 0
    wait 10  ;--- Clean by Fire actually takes time to cure AFTER Targetting Adjust as needed....
    goto CAST
 
}
Return

Offline dxrom

  • Master of the milestones!
  • Elite
  • *
  • *
  • Posts: 1080
  • Activity:
    0%
  • Reputation Power: 15
  • dxrom is working their way up.dxrom is working their way up.dxrom is working their way up.
  • KEYBOARD COWBOY, GREAT SAMURAI OF THE INTERNET.
  • Respect: +100
  • Referrals: 1
    • View Profile
Re: Please help with an "OR" action code line.
« Reply #4 on: January 05, 2014, 02:14:11 AM »
0
Let's not forget parenthesis influence in order of operations... Caution should be executed when throwing them around :>



 ​_██​_
(ಠ​_ృ)
I do say, ol' Chap! Come play EVE Online! Why here is a 21 Day Free Trial!

Offline Endless Night

  • Global Moderator
  • *
  • *
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +393
  • Referrals: 1
    • View Profile
Re: Please help with an "OR" action code line.
« Reply #5 on: January 05, 2014, 06:28:59 AM »
0
That || symbol you used, can that be used to change the last line in my snippet

Code: [Select]
Until C Notin #charstatus Or G In #charstatus

to

Code: [Select]
Until C Notin #charstatus || G In #charstatus


Their is no command "OR" in easyuo.  The command for 'or' in easyuo is "||".  

Therefor you have to do it your revised way .. Until C Notin #charstatus || G In #charstatus


but be carefull with your repeat loop your code WILL get stuck looping and doing nothing if your spell fails so instead of
Repeat
Until C Notin #charstatus || G in #charstatus

Maybe you should change your code to a structure such as this
Repeat
    if blabla
       caste spell
 Until C Notin #charstatus || G in #charstatus
« Last Edit: January 05, 2014, 08:09:49 AM by Endless Night »
Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Offline vanzelusTopic starter

  • Jr. Member
  • **
  • Posts: 24
  • Activity:
    0%
  • Reputation Power: 1
  • vanzelus has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Please help with an "OR" action code line.
« Reply #6 on: January 05, 2014, 07:43:08 AM »
0
Thank you guys for your inputs  :), it's clearer now what the code should be

Tags: