Help with Buffing script

Jarlax

Active Member
Hey gang,

I am trying to write a script to automate most of my second characters abilities. My second char is a shaman. Right now I have him following me, healing me, and looting. But I am having trouble with having the character buff me. I have been using the scripts from Zeek and Kram as examples (thank you guys) and here an example of what I am doing:

Code:
	;If our buff is gone, or has less than 60 seconds, rebuff
	if "!${Me.Effect[${Buff1}](exists)} || ${Me.Effect[${Buff1}].TimeRemaining}<=60 && ${HowManyBuffs}>=1"
		{
			Pawn[me]:Target
			Me.Ability[${Buff1}]:Use
			call MeCasting
			wait 3
			
			Pawn[id,${TankID}]:Target
			Me.Ability[${Buff1}]:Use
			call MeCasting
		}
I figured that the shaman could use himself as the timer and when he needs the buffs, go ahead and cast them on the tank as well. What is happening is that the shaman is seeing that he needs the buff and casting on himself, and then he casts a second time but on himself again instead of targeting the tank?!?

Am I missing something obvious with this one? Is there a better way to write this?

Thanks for your help
 

aChallenged1

Active Member
Try keeping your tank as defensive target. Do a check before casting (even on shammy) to ensure he is your defensive target, then cast. See if that helps.

I'm not sure how the Shaman class works yet, though my sigo plays one. I'll ask later about how buffing works.
 

adakos

Active Member
Why not just download VGshaman ?


if you need help, paste the entire script you are using, so we can see if there is a problem with your functions, calls, variables, etc.

now for the fun part:

Pawn[id,${TankID}]:Target --> some people have reported problems with this.
try vgexecute "/target name"


-Adakos
 

Xeon

Active Member
Jarlax said:
Code:
			Pawn[me]:Target
			Me.Ability[${Buff1}]:Use
			call MeCasting
			wait 3
			
			Pawn[id,${TankID}]:Target
			Me.Ability[${Buff1}]:Use
			call MeCasting
		}
You are waiting 1/3 of a second after switching targets... If you have a slow link or the server is not fast enough to get your switch of targets...

So, a simple check:
Code:
while ${Me.Target.ID} != ${TankID}
   wait 5
 

Cr4zyb4rd

Active Member
Code:
wait 50 ${Me.Target.ID} == ${TankID}
is even simpler, and has the dual advantages of ending the wait as soon as the target changes, and not risking a never-ending loop
 

Temil2005

Active Member
Code:
wait 50 ${Me.Target.ID} == ${TankID}
how exactly does that work? .. I understand somewhat of what you are saying, but dont understand how that format would do what you say?
 

Gameross

Active Member
It's waits for 50 ticks(5 seconds) *OR* until the expression "${Me.Target.ID} == ${TankID}" comes true.
 

Cr4zyb4rd

Active Member
from http://www.lavishsoft.com/wiki/index.php/Command:Wait

Description

Pauses execution of this script for a specified amount of time, given in tenths of seconds (deciseconds). A condition may be supplied in order to continue execution early. The condition and end time will be checked once per frame.
So the above quoted code will wait for 5 seconds, or until the target ID is the same as TankID, whichever comes first (checking every frame). Whereas Xeon's loop will check the target ID, wait 1/2 of a second, check again, etc forever, even if the condition never happens (due to lag or the target dying, or whatever)

This is the standard way to script waits, but can also bite you in the ass. Suppose I want to loot a chest, and wait until I'm done looting...so I do something like this (pseudo-code)
Code:
call grab_the_phat_loot
wait 50 ${Me.Not_Looting}
Looks good, but what if there's a little bit of lag between me starting to loot and the client realizing what I've done? It will just skip right over the wait, so I'm stuck doing something ugly like
Code:
call grab_the_phat_loot
; wait until i've started looting
wait 50 ${Me.Looting}
; wait until i'm done looting
wait 50 ${Me.Not_Looting}
not very pretty, and there's a dozen other ways you could write it, but that's the type of thing you've got to do if you really want a script to execute as fast as possible and not be filled with "magic numbers" that you have to fiddle with and adjust.

To get even deeper, the 50 I kept using above is a magic number too...it's almost impossible to write code that doesn't use a few here and there. Thankfully, we can do something like this
Code:
#define DEFAULT_WAIT_TIME 50
and use that definition elsewhere in our code
Code:
; cr4zy's way
wait DEFAULT_WAIT_TIME ${some_condition}
; xeonx's way
while ${Me.Target.ID} != ${TankID}
   wait DEFAULT_WAIT_TIME
sure, we could have used a variable for this, but the #define command was designed for just this type of "magic number", that doesn't need to change while the script is running, but can be easily changed in the code. Notice there's no ${} wrapped around it...that's because #define is handled by the pre-processor. LavishScript will detect these before the script ever starts to execute, so the final effect at run-time is just as if you'd done a search and replace of one DEFAULT_WAIT_TIME with the number 50 in your text editor.
 

Temil2005

Active Member
It's waits for 50 ticks(5 seconds) *OR* until the expression "${Me.Target.ID} == ${TankID}" comes true.
hmm, didnt know this was posable..
could you also use the following, assuming you know 100% that the expression will happen, just wait for it to? ..

Code:
wait ${Me.Target.ID} == ${TankID}
 
Top Bottom