Setting one global equal to another, possible?

Post » Wed Jun 20, 2012 11:36 am

So, I have this script that switches spells out on a follower, and I need it to memorize what spells are in what slots. To this end I made it memorize a number (1-16) associated with each spell, and then later I want to set the value of each slot's associated global to the same number. Here is my script:

Scriptname PKRoseLevel extends ReferenceAliasimport ActorGlobalVariable Property PKMoveSlotNum  Auto SPELL Property Absorb  Auto SPELL Property MegaDrain  Auto SPELL Property Growth  Auto SPELL Property StunSpore  Auto SPELL Property PoisonSting  Auto SPELL Property MoveSlot1  Auto SPELL Property MoveSlot2 Auto SPELL Property MoveSlot3  Auto SPELL Property MoveSlot4  Auto ;Uses playerlevel to decide what move to learnSpell Function newMove()   if Game.GetPlayer().GetLevel() == 4PKNewMove.setValue(2)	  return Growth   endIf   if Game.GetPlayer().GetLevel() == 7PKNewMove.setValue(3)	  return PoisonSting   endIf   if Game.GetPlayer().GetLevel() == 10PKNewMove.setValue(4)	  return StunSpore   endIf   if Game.GetPlayer().GetLevel() == 13PKNewMove.setValue(5)	  return MegaDrain   endIf    if Game.GetPlayer().GetLevel() == 16PKNewMove.setValue(6)	  return LeechSeed   endIf     if Game.GetPlayer().GetLevel() == 19PKNewMove.setValue(7)	  return MagicalLeaf   endIf     if Game.GetPlayer().GetLevel() == 22PKNewMove.setValue(8)	  return GrassWhistle   endIf     if Game.GetPlayer().GetLevel() == 25PKNewMove.setValue(9)	  return GigaDrain   endIf    if Game.GetPlayer().GetLevel() == 28PKNewMove.setValue(10)	  return ToxicSpikes   endIf     if Game.GetPlayer().GetLevel() == 31PKNewMove.setValue(11)	  return SweetScent   endIf     if Game.GetPlayer().GetLevel() == 34PKNewMove.setValue(12)	  return Ingrain   endIf     if Game.GetPlayer().GetLevel() == 37PKNewMove.setValue(13)	  return Toxic   endIf    if Game.GetPlayer().GetLevel() == 40PKNewMove.setValue(14)	  return PetalDance   endIf    if Game.GetPlayer().GetLevel() == 43PKNewMove.setValue(15)	  return Aromatherapy   endIf    if Game.GetPlayer().GetLevel() == 46PKNewMove.setValue(16)	  return Synthesis   endIfendFunction;Uses the player decided moveslot to figure out what spell to replaceSpell Function oldMove()   if PKMoveSlotNum.GetValue() == 0	  return MoveSlot1   endIf   if PKMoveSlotNum.GetValue()  == 1	  return MoveSlot2   endIf   if PKMoveSlotNum.GetValue()  == 2	  return MoveSlot3   endIf   if PKMoveSlotNum.GetValue()  == 3	  return MoveSlot4   endIfendFunctionFunction LearnMove();This decides if there is a move in the slot, and then takes it off if they do.   if(oldMove() != None)	  RoseliaActor.RemoveSpell(oldMove())    EndIf;adds the newspell     RoseliaActor.AddSpell(newMove());these replace the correct spellslot with the new spell   if PKMoveSlotNum.GetValue()  == 0	 MoveSlot1 = newMove()     ;here are the problem lines	 Move1Global.setValue(PKNewMove)   endIf   if PKMoveSlotNum.GetValue()  == 1	 MoveSlot2 = newMove()	 Move2Global.setValue(PKNewMove)   endIf   if PKMoveSlotNum.GetValue()  == 2	  MoveSlot3 = newMove()	  Move3Global.setValue(PKNewMove)	     endIf   if PKMoveSlotNum.GetValue()  == 3	 Move4Global.setValue(PKNewMove)   endIfEndFunctionSPELL Property LeechSeed  Auto SPELL Property MagicalLeaf  Auto SPELL Property GrassWhistle  Auto SPELL Property GigaDrain  Auto SPELL Property ToxicSpikes  Auto SPELL Property SweetScent  Auto SPELL Property Ingrain  Auto SPELL Property Toxic  Auto SPELL Property PetalDance  Auto SPELL Property Aromatherapy  Auto SPELL Property Synthesis  Auto Actor Property RoseliaActor  Auto ReferenceAlias Property PokeAlias  Auto GlobalVariable Property Move1Global  Auto GlobalVariable Property Move2Global  Auto GlobalVariable Property Move3Global  Auto GlobalVariable Property Move4Global  Auto GlobalVariable Property PKNewMove  Auto 

(You can CTRL+F to the word 'problem')

Basically, it won't let me set one global equal to another. How can I do this?
User avatar
LuCY sCoTT
 
Posts: 3410
Joined: Sun Feb 04, 2007 8:29 am

Post » Tue Jun 19, 2012 11:33 pm

Move1Global.setValue(PKNewMove.GetValue())
User avatar
Chloe Mayo
 
Posts: 3404
Joined: Wed Jun 21, 2006 11:59 pm

Post » Wed Jun 20, 2012 1:43 am

Nvm. Worked around it. Here's the new script for those interested:

Scriptname PKRoseLevel extends ReferenceAliasimport ActorGlobalVariable Property PKMoveSlotNum  Auto SPELL Property Absorb  Auto SPELL Property MegaDrain  Auto SPELL Property Growth  Auto SPELL Property StunSpore  Auto SPELL Property PoisonSting  Auto SPELL Property MoveSlot1  Auto SPELL Property MoveSlot2 Auto SPELL Property MoveSlot3  Auto SPELL Property MoveSlot4  Auto ;Uses playerlevel to decide what move to learnSpell Function newMove()   if Game.GetPlayer().GetLevel() == 4PKNewMove.setValue(2)	  return Growth   endIf   if Game.GetPlayer().GetLevel() == 7PKNewMove.setValue(3)	  return PoisonSting   endIf   if Game.GetPlayer().GetLevel() == 10PKNewMove.setValue(4)	  return StunSpore   endIf   if Game.GetPlayer().GetLevel() == 13PKNewMove.setValue(5)	  return MegaDrain   endIf    if Game.GetPlayer().GetLevel() == 16PKNewMove.setValue(6)	  return LeechSeed   endIf     if Game.GetPlayer().GetLevel() == 19PKNewMove.setValue(7)	  return MagicalLeaf   endIf     if Game.GetPlayer().GetLevel() == 22PKNewMove.setValue(8)	  return GrassWhistle   endIf     if Game.GetPlayer().GetLevel() == 25PKNewMove.setValue(9)	  return GigaDrain   endIf    if Game.GetPlayer().GetLevel() == 28PKNewMove.setValue(10)	  return ToxicSpikes   endIf     if Game.GetPlayer().GetLevel() == 31PKNewMove.setValue(11)	  return SweetScent   endIf     if Game.GetPlayer().GetLevel() == 34PKNewMove.setValue(12)	  return Ingrain   endIf     if Game.GetPlayer().GetLevel() == 37PKNewMove.setValue(13)	  return Toxic   endIf    if Game.GetPlayer().GetLevel() == 40PKNewMove.setValue(14)	  return PetalDance   endIf    if Game.GetPlayer().GetLevel() == 43PKNewMove.setValue(15)	  return Aromatherapy   endIf    if Game.GetPlayer().GetLevel() == 46PKNewMove.setValue(16)	  return Synthesis   endIfendFunctionint Function newMovenum()   if Game.GetPlayer().GetLevel() == 4return 2   endIf   if Game.GetPlayer().GetLevel() == 7return 3   endIf   if Game.GetPlayer().GetLevel() == 10return 4   endIf   if Game.GetPlayer().GetLevel() == 13return 5   endIf    if Game.GetPlayer().GetLevel() == 16return 6   endIf     if Game.GetPlayer().GetLevel() == 19return 7   endIf     if Game.GetPlayer().GetLevel() == 22return 8   endIf     if Game.GetPlayer().GetLevel() == 25return 9   endIf    if Game.GetPlayer().GetLevel() == 28return 10   endIf     if Game.GetPlayer().GetLevel() == 31return 11   endIf     if Game.GetPlayer().GetLevel() == 34return 12   endIf     if Game.GetPlayer().GetLevel() == 37return 13   endIf    if Game.GetPlayer().GetLevel() == 40return 14   endIf    if Game.GetPlayer().GetLevel() == 43return 15   endIf    if Game.GetPlayer().GetLevel() == 46return 16   endIfendFunction;Uses the player decided moveslot to figure out what spell to replaceSpell Function oldMove()   if PKMoveSlotNum.GetValue() == 0	  return MoveSlot1   endIf   if PKMoveSlotNum.GetValue()  == 1	  return MoveSlot2   endIf   if PKMoveSlotNum.GetValue()  == 2	  return MoveSlot3   endIf   if PKMoveSlotNum.GetValue()  == 3	  return MoveSlot4   endIfendFunctionFunction LearnMove();This decides if there is a move in the slot, and then takes it off if they do.   if(oldMove() != None)	  RoseliaActor.RemoveSpell(oldMove())    EndIf;adds the newspell     RoseliaActor.AddSpell(newMove());these replace the correct spellslot with the new spell   if PKMoveSlotNum.GetValue()  == 0	 MoveSlot1 = newMove()	 Move1Global.setValueInt(newmovenum())   endIf   if PKMoveSlotNum.GetValue()  == 1	 MoveSlot2 = newMove()	 Move2Global.setValueInt(newmovenum())   endIf   if PKMoveSlotNum.GetValue()  == 2	  MoveSlot3 = newMove()	  Move3Global.setValueInt(newmovenum())	     endIf   if PKMoveSlotNum.GetValue()  == 3	 Move4Global.setValueInt(newmovenum())   endIfEndFunctionevent OnUpdate()LearnMove()endEventSPELL Property LeechSeed  Auto SPELL Property MagicalLeaf  Auto SPELL Property GrassWhistle  Auto SPELL Property GigaDrain  Auto SPELL Property ToxicSpikes  Auto SPELL Property SweetScent  Auto SPELL Property Ingrain  Auto SPELL Property Toxic  Auto SPELL Property PetalDance  Auto SPELL Property Aromatherapy  Auto SPELL Property Synthesis  Auto Actor Property RoseliaActor  Auto ReferenceAlias Property PokeAlias  Auto GlobalVariable Property Move1Global  Auto GlobalVariable Property Move2Global  Auto GlobalVariable Property Move3Global  Auto GlobalVariable Property Move4Global  Auto GlobalVariable Property PKNewMove  Auto 
User avatar
Phoenix Draven
 
Posts: 3443
Joined: Thu Jun 29, 2006 3:50 am

Post » Wed Jun 20, 2012 1:36 pm

Move1Global.setValue(PKNewMove.GetValue())

D'oh!
User avatar
Svenja Hedrich
 
Posts: 3496
Joined: Mon Apr 23, 2007 3:18 pm

Post » Wed Jun 20, 2012 5:12 am

Yeah, its the easy ones that make a person feel dumb. :lmao: And I have felt pretty dumb quite a bit with scripting lately.

I would recommend for cleaner looking script, to move all your 'properties' to the top of the script.
User avatar
brandon frier
 
Posts: 3422
Joined: Wed Oct 17, 2007 8:47 pm


Return to V - Skyrim