Aller au contenu

Photo

SetLocalInt fails???


  • Veuillez vous connecter pour répondre
5 réponses à ce sujet

#1
edmogt1

edmogt1
  • Members
  • 52 messages
    SetLocalInt(GetModule(), "test", 1);
    PrintToLog("test = " + IntToString(GetLocalInt(GetModule(), "test")));

The above code in one of my spell scripts prints this in the log:

test = 0


Why is my SetLocalInt no workee?

:crying:
   
Posted ImagePosted Image

#2
_L_o_B_o_

_L_o_B_o_
  • Members
  • 117 messages
I made the same mistake at the beginning when I was using the SetLocalInt() function.

It can't create a new variable in the object you pass as paremeter. You only can set and get the variables that are already defined. For example, for a module you have to go to File > Manage Modules > Select your module > Properties > At the bottom you'll find a field named Variables. Click there and you'll see which variables are available for that object.

Modifié par _L_o_B_o_, 24 juillet 2010 - 07:13 .


#3
edmogt1

edmogt1
  • Members
  • 52 messages
Ah. I assume then, I can add variables by creating a custom variable 2da?

#4
FergusM

FergusM
  • Members
  • 460 messages
Yes indeed.

#5
AmstradHero

AmstradHero
  • Members
  • 1 239 messages
You can also give this project a shot which gets around the 2da editing hassle.

#6
Obadiah

Obadiah
  • Members
  • 5 718 messages
Huh, wasted a couple of hours trying to figure out the problem with my script until I found this.