Need help with my raidcure script

Akku

Active Member
This is the code so far i end up with.
The script should cure everyone in the raid if he uses his cure button. all other script functions should ignored if it finds a cure call and the script should cure everyone even if there are 3 calls at the same time.
atm it cures the first one who calls for cure and ignores all others while its curing the first one and i am getting an error in the console but the script keeps running.
error msg:
-->D:/Programme/Innerspace/Scripts/vgshaman.iss:283 MeCasting() wait 1
D:/Programme/Innerspace/Scripts/vgshaman.iss:685 cureCurse() call MeCasting
D:/Programme/Innerspace/Scripts/vgshaman.iss:862 VG_OnIncomingText() call cureCurse
D:/Programme/Innerspace/Scripts/vgshaman.iss:212 Check_Health() do
D:/Programme/Innerspace/Scripts/vgshaman.iss:120 main() call Check_Health
'WaitFrame' is not available in atoms
Dumping script stack
--------------------
code i end up with:
Code:
;================================================
function cureCurse()
{	
			Pawn[${aName}]:Target
			if (${Me.Ability[${cureCurse}].IsReady})
			{
				Me.Ability[${cureCurse}]:Use
				VGExecute /raid Cure ${aName}
				call MeCasting
				return
			}	
}	
;================================================
atom(script) VG_OnIncomingText(string Text, string ChannelNumber, string ChannelName)
{
	if ${Text.Find["CURE <red=>==="]} 
	{
      aName:Set[${Text.Token[2,">"].Token[1,"<"]}]
			call cureCurse       
	}
}
 

Zandros

Script Author: VGA
This is the code so far i end up with.
The script should cure everyone in the raid if he uses his cure button. all other script functions should ignored if it finds a cure call and the script should cure everyone even if there are 3 calls at the same time.
atm it cures the first one who calls for cure and ignores all others while its curing the first one and i am getting an error in the console but the script keeps running.
error msg:
-->D:/Programme/Innerspace/Scripts/vgshaman.iss:283 MeCasting() wait 1
D:/Programme/Innerspace/Scripts/vgshaman.iss:685 cureCurse() call MeCasting
D:/Programme/Innerspace/Scripts/vgshaman.iss:862 VG_OnIncomingText() call cureCurse
D:/Programme/Innerspace/Scripts/vgshaman.iss:212 Check_Health() do
D:/Programme/Innerspace/Scripts/vgshaman.iss:120 main() call Check_Health
'WaitFrame' is not available in atoms
Dumping script stack
--------------------
code i end up with:
Code:
;================================================
function cureCurse()
{	
			Pawn[${aName}]:Target
			if (${Me.Ability[${cureCurse}].IsReady})
			{
				Me.Ability[${cureCurse}]:Use
				VGExecute /raid Cure ${aName}
				call MeCasting
				return
			}	
}	
;================================================
atom(script) VG_OnIncomingText(string Text, string ChannelNumber, string ChannelName)
{
	if ${Text.Find["CURE <red=>==="]} 
	{
      aName:Set[${Text.Token[2,">"].Token[1,"<"]}]
			call cureCurse       
	}
}
Nice coding and a great idea! I have experienced that atoms don't take kindly to any kind of wait/delay so I suggest avoiding them ie Me.Casting has a wait in it.

I would like to make a suggestion... try using variables instead:

(I haven't tested the code but it should give you an idea)

Code:
;establish your variable at the start of the program
variable queued:string MyCursed

;your atom that catches the name of a player that is cursed
atom(script) VG_OnIncomingText(string Text, string ChannelNumber, string ChannelName)
{
	variable string aName
	if ${Text.Find["CURE <red=>==="]} 
	{
		aName:Set[${Text.Token[2,">"].Token[1,"<"]}]
		;Add the name to MyCursed (1st in, 1st out)
		MyCursed:Queue[${aName}]       
	}
}

; call your routine constantly from your main routine
function cureCurse()
{	
	; Check if MyCurse has a name in que
	if !${MyCursed.Peek.Equal[NULL]}
	{
		Pawn[${MyCursed.Peek}]:Target
		wait 3
		if (${Me.Ability[${cureCurse}].IsReady})
		{
			VGExecute /raid Cure ${aName}
			Me.Ability[${cureCurse}]:Use
			wait 3
			call MeCasting
			; Delete 1st name in que
			MyCursed:Dequeue
		}	
		return
	}
	; Not needed but may be of some use by keeping the variable empty
	MyCursed:Clear
}
 

mmoaddict

Original Script Author: VGA
and further

and further down the road you will have problems with que commands slowing everything down. Lately i have converted all my commands to timers. no wait commands. Seems like the never ending evolving scripts. For instance, what would happen if you needed to do a critical heal on the main tank at the same time someone called for that poison cure?
 

Akku

Active Member
@mmoaddict
Well this is for Archon Travix and this char is only in the fight to cure, he does nothing else. This part of the script will be toggle on off with the ui.
Can you explain me the timer thingie pls ?
Atm i use 3 versions of the vgshaman script each modified to the class it is used on.
and there are many wait commands in this scripts

@Zandros123
thanks for the code will try it out. never got a clue how this queue works :)
 

Zandros

Script Author: VGA
and further down the road you will have problems with que commands slowing everything down. Lately i have converted all my commands to timers. no wait commands. Seems like the never ending evolving scripts. For instance, what would happen if you needed to do a critical heal on the main tank at the same time someone called for that poison cure?
The way I write my scripts I find that Heals always comes first, followed by Chains & Counters, then Dots, and finally my actual attack routines.

You can't move onto the next step unless everyone's health is above a certain amount. Chains & Counters are instant with a cooldown effect. Dots lasts for x-amount of time. Attacks are whatever you want the toon to do.

I use (wait 3) immediately after all abilities followed by the IsCasting routine. For some reason, I noticed the system doesn't catch that you are casting or in a cooldown immideately after using the ability unless you use that slight pause of 3/10ths of a second. There are no waits... except immediately after abilities and one inside the IsCasting routine.

I did try encorporating the cancelability command to stop a long casting spell so I can immediately heal or grab that chain/counter. Alas, its not immediate and practically useless or I am just not using it in the right way.
 

mmoaddict

Original Script Author: VGA
@mmoaddict
Well this is for Archon Travix and this char is only in the fight to cure, he does nothing else. This part of the script will be toggle on off with the ui.
Can you explain me the timer thingie pls ?
Atm i use 3 versions of the vgshaman script each modified to the class it is used on.
and there are many wait commands in this scripts
Do what Zandros suggested for now, just understand that your scripts will evolve over time and each stage faces new challenges. VG shaman is a great place to start and get the hang of things. Stick with waits and such till they become a burdon then move on.

Using objects, atoms and timers, instead of functions and waits, has several advantages. One of them being speed. It is a lot more complicated programming and i spend more time planning the logic tree of the script than i do writing the script, but it is fun. The idea with timers is to set time based off how long the script has been running and then add values to it and then create a timer based off the difference.
;******************************
while ${Me.IsCasting}
wait 1
while ${VG.InGlobalRecovery}
wait 1
;*****************************
while ${Me.IsCasting}
{
if ${Emergency.StopCasting}
InteruptCastingATOM
}
while !${Me.Ability[torch].IsReady}
Script:pause
Script:Resume
;*****************************

The torch thing is a little trick i learned to catch the fact that VG.InGlobalRecovery is too fast for its own good. So instead of wait 3.. i only wait the exact amount of time it takes for the client to react based off the common ability torch.

Good luck out there
 

Zandros

Script Author: VGA
Do what Zandros suggested for now, just understand that your scripts will evolve over time and each stage faces new challenges. VG shaman is a great place to start and get the hang of things. Stick with waits and such till they become a burdon then move on.

Using objects, atoms and timers, instead of functions and waits, has several advantages. One of them being speed. It is a lot more complicated programming and i spend more time planning the logic tree of the script than i do writing the script, but it is fun. The idea with timers is to set time based off how long the script has been running and then add values to it and then create a timer based off the difference.
;******************************
while ${Me.IsCasting}
wait 1
while ${VG.InGlobalRecovery}
wait 1
;*****************************
while ${Me.IsCasting}
{
if ${Emergency.StopCasting}
InteruptCastingATOM
}
while !${Me.Ability[torch].IsReady}
Script:pause
Script:Resume
;*****************************

The torch thing is a little trick i learned to catch the fact that VG.InGlobalRecovery is too fast for its own good. So instead of wait 3.. i only wait the exact amount of time it takes for the client to react based off the common ability torch.

Good luck out there
Wow, I like that better than mine! In mine, I included an additional wait because sometime, not always, abilities are still in cooldown even after it shows its not. Here is mine:

Code:
;==============================
;===   IsCasting Routine   ====
;==============================
function IsCasting()
{
	if ${Me.IsCasting} || ${Me.ToPawn.IsStunned} || ${VG.InGlobalRecovery}
	{
		while ${Me.IsCasting} || ${Me.ToPawn.IsStunned} || ${VG.InGlobalRecovery}
		{
			if ${Me.ToPawn.IsStunned}
			{
				if ${doDebug}
				echo "[${Time}] --> STUNNED"
				while ${Me.ToPawn.IsStunned}
				{
					wait 1
				}
			}
		}
		wait 3
		waitframe
	}
}
 

Zandros

Script Author: VGA
Using objects, atoms and timers, instead of functions and waits, has several advantages. One of them being speed. It is a lot more complicated programming and i spend more time planning the logic tree of the script than i do writing the script, but it is fun. The idea with timers is to set time based off how long the script has been running and then add values to it and then create a timer based off the difference.
I absolutely agree with mmoaddict on optimizing the code for speed and having an intelligent strategic approach without using waits or excessive if/then statements. Its challenging, exciting as you discover new ways to do things, and most importantly... FUN!

Below is an example of the brains of one of my scripts. Nothing fancy or spetacular with lots of areas to improve but built upon speed with healing as its main focus.

Code:
;---------------------------------------------------
;===================================================
;===              Main Routine                  ====
;===================================================
;---------------------------------------------------
function main()
{
	;-------------------------------------------
	; Wait while ISXVG reloads
	;-------------------------------------------
	ext -require isxvg
	do
	{
		waitframe
	}
	while !${ISXVG.IsReady}

	;-------------------------------------------
	; Auto Calculate Abilities to Highest Level
	;-------------------------------------------
	call SetupAbilities

	;-------------------------------------------
	; Identify the Tank, the one we assist in combat
	;-------------------------------------------
	if !${Me.DTarget.ID(exists)}
	{
		Pawn[me]:Target
		wait 5
	}
	Tank:Set[${Me.DTarget.Name}]
	TankID:Set[${Me.DTarget.ID}]

	;-------------------------------------------
	; Load the UI panel
	;-------------------------------------------
	ui -reload "${LavishScript.CurrentDirectory}/Interface/VGSkin.xml"
	ui -reload -skin VGSkin "${Script.CurrentDirectory}/DSC/DSC.xml"

	;-------------------------------------------
	; Setup any Key Bindings
	;-------------------------------------------
	bind -press ATTACK CTRL+A "Script[DSC]:QueueCommand[call AttackIt]"
	bind -press BUFFUP CTRL+B "Script[DSC]:QueueCommand[call BuffIt]"

	;-------------------------------------------
	; Heart of the program where everything happens
	;-------------------------------------------
	while ${isRunning}
	{
		;-------------------------------------------
		; Catch Stuns, Spell Casting, and Cooldowns
		;-------------------------------------------
		call IsCasting

		;-------------------------------------------
		; If we are dead, then freeze everything
		;-------------------------------------------
		if ${GV[bool,DeathReleasePopup]}
		{
			Command:Set["DEAD"]
			while ${GV[bool,DeathReleasePopup]} && ${isRunning}
			{
				wait 10
			}
			Paused:Set[TRUE]
		}

		;-------------------------------------------
		; If we are Paused, then freeze everything
		;-------------------------------------------
		if ${Paused}
		{
			Command:Set["Paused"]
			while ${Paused} && ${isRunning}
			{
				wait 10
			}
			Command:Set["Waiting"]
			FlushQueued
			if !${isRunning}
			{
				break
			}
		}

		;-------------------------------------------
		; If we are drowning, then stop drowning
		;-------------------------------------------
		if ${Me.IsDrowning}
		{
			Me.Inventory[Potion of Deep Breath]:Use
			wait 10
		}

		;-------------------------------------------
		; Set the Loot Flag if target is a corpse
		;-------------------------------------------
		if ${doLoot} && ${Me.Target(exists)} && ${Me.Target.Type.Equal[Corpse]}
		Command:Set["Loot"]

		;-------------------------------------------
		; Set the Harvest Flag if target is harvestable
		;-------------------------------------------
		if (${Me.Target(exists)} && ${Me.Target.Type.Equal[Corpse]} && ${Me.Target.IsHarvestable} && !${Me.InCombat}) || ${GV[bool,bHarvesting]}
		Command:Set["HarvestIt"]

		;-------------------------------------------
		; Set the Encounter Flag if we have an Encounter
		;-------------------------------------------
		if (!${Me.Target(exists)} || ${Me.Target.Type.Equal[Corpse]}) && ${Me.Encounter}>0
		Command:Set["EncounterCheck"]

		;-------------------------------------------
		; Execute any Keybindings and Queued Commands
		;-------------------------------------------
		while ${QueuedCommands}
		{
			ExecuteQueued
			FlushQueued
		}

		;-------------------------------------------
		; Execute the Command
		;-------------------------------------------
		switch ${Command}
		{
		case Waiting
			if !${Me.InCombat}
			{
				if ${GV[bool,bIsAutoAttacking]}
				{
					Me.Ability[Auto Attack]:Use
					wait 10
					waitframe
				}
				call BuffUp
				if ${doHunt} && ${Me.HealthPct}>90 && ${Me.EnergyPct}>90 
				{
					call FindMob
					if ${Me.Target(exists)}
					{
						call AttackIt
					}
				}
			}
			else
			Command:Set["Heal"]
			break

		case Heal
			call Heal
			if ${Return}
			Command:Set["Waiting"]
			else
			Command:Set["ChainCounterRescue"]
			break

		case ChainCounterRescue
			call ChainCounterRescue
			Command:Set["Dots"]
			break

		case Dots
			call Dots
			if ${Return}
			Command:Set["Waiting"]
			else
			Command:Set["Attack"]
			break

		case Attack
			call Attack
			Command:Set["Waiting"]
			break

		case EncounterCheck
			call EncounterCheck
			if ${Return}
			Command:Set["Waiting"]
			else
			Command:Set["HarvestIt"]
			break

		case Loot
			call Loot
			Command:Set["HarvestIt"]
			break

		case HarvestIt
			call HarvestIt
			Command:Set["Waiting"]
			break
		}
	}
}
 

Akku

Active Member
Well this looks a littel to compliated to me.
If i get a script like vgshm i look at the script and understand how it works , so i can change things like i want them to be and add littel other things i find on the forum.
But changing the script into another kind of script is to much for me.
 
Top Bottom