Jump to content

Checking a script


Caedwyr

Recommended Posts

I'm still wary about writing scripts, so I'd appreciate if someone checked to see if my logic/scripting here is correct.

 

// If virtue is installed we can use it too
IF
  // Virtue is actually installed/working
  Global("VirtueSetup","GLOBAL",1)
  GlobalGT("D0VMIRROR","GLOBAL",0)
  // A Virtue drop has occured
  GlobalsLT("D0VIRTUE","D0VMIRROR")
  // I have the Celestial Mystic Kit
  Kit(Player1,CA#CMYST)
  // Any pending Virtue changes have been applied
  Global("D0Change","GLOBAL",0)
  // The console command to disable Virtue has not been used
  !Global("D0VirtueDisable","GLOBAL",1)
THEN
  RESPONSE #100
 SetGlobal("CACMFal","GLOBAL",3)
END

// Set the fallen variable if Player 1 casts any of these spells.  We'll use the CACMFal when determining if the player is eligible for the kit as well as for making them fall once they have the kit.
IF
  OR(6)	
SpellCast(Player1,"spwi409") // Contagion
SpellCast(Player1,"spwi501") // Animate Dead
SpellCast(Player1,"spwi509") // Feeblemind
SpellCast(Player1,"spwi707") // Cacofiend
SpellCast(Player1,"spwi807") // Summon Fiend
SpellCast(Player1,"spwi905") // Gate
THEN
RESPONSE #100
	SetGlobal("CACMFal","GLOBAL",3)
END

// The actual fall itself
IF
	Kit(Player1,CA#CMYST)
	OR(3)
			!Alignment(Player1,LAWFUL_GOOD)
			ReputationLT(Player1,8)
			GlobalGT("CACMFal","GLOBAL",2)
THEN
	RESPONSE #100
			ActionOverride(Player1,AddKit(1))  // Change it back into a trueclass vanilla mage
			Wait(1)
			ApplySpellRES("CA#FALL",Player1) // No such index
			DisplayStringNoName(Player1,@211)
			PlaySound("REPDOWN")
END

 

Also, is there any way to make one section of scripting take priority over another section (Ignore section 2 if section 1 applies)? Is it just a simple order in which the script is displayed (top down)?

Link to comment

top down... but I have never seen the following, so someone better than i better look at this:

 

GlobalsLT("D0VIRTUE","D0VMIRROR")

 

your

 

IF

OR(6)

SpellCast(Player1,"spwi409") // Contagion

 

 

when is that evaluated?

Link to comment

The

IF
  // Virtue is actually installed/working
  Global("VirtueSetup","GLOBAL",1)
  GlobalGT("D0VMIRROR","GLOBAL",0)
  // A Virtue drop has occured
  GlobalsLT("D0VIRTUE","D0VMIRROR")
  // I have the Celestial Mystic Kit
  Kit(Player1,CA#CMYST)
  // Any pending Virtue changes have been applied
  Global("D0Change","GLOBAL",0)
  // The console command to disable Virtue has not been used
  !Global("D0VirtueDisable","GLOBAL",1)
THEN
  RESPONSE #100
 SetGlobal("CACMFal","GLOBAL",3)
END

Section is copied directly from Refinements with just a couple changes replacing LISwaFal and SWANG with my kit's respective tags. AFAIK it works, though I guess I should drop a line to The_Bigg if you are saying that it won't work as intended.

 

The

 

IF
  OR(6)	
SpellCast(Player1,"spwi409") // Contagion
SpellCast(Player1,"spwi501") // Animate Dead
SpellCast(Player1,"spwi509") // Feeblemind
SpellCast(Player1,"spwi707") // Cacofiend
SpellCast(Player1,"spwi807") // Summon Fiend
SpellCast(Player1,"spwi905") // Gate
THEN
RESPONSE #100
	SetGlobal("CACMFal","GLOBAL",3)
END

I'd like to set the global to 3 if any of those are true. Do I need to break them all into individual checks or can I do the whole group of them together?

Link to comment

Be careful when using Globals* and Locals* -- they were designed for a pretty specific purpose, so you just need to make sure they're doing what you expect (i.e., you know which one you want to be greater in "GT").

 

The SpellCast() thing should be fine. If you want exclusive blocks, you usually just want the higher-priority block first (scripts are evaluated top down), and then set a dummy variable in the first block that can be checked by the second:

IF
Dead("Nalia")
Global("NaliaDied","GLOBAL",1)
Global("WorthlessBitch","GLOBAL",0)
THEN
RESPONSE #100
DoMyStuff()
SetGlobal("WorthlessBitch","GLOBAL",1)
END

IF
Global("HeyILikeNalia","GLOBAL",1)
Global("WorthlessBitch","GLOBAL",0)
THEN
RESPONSE #100
ApplySpell("Nalia",DOWN_SYNDROME)
SetGlobal("HeyILikeNalia","GLOBAL",0)
END

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...