Jump to content

Photo

AddGlobals()


6 replies to this topic

#1 Galactygon

Galactygon

    Nostradoctopus

  • Modders
  • 728 posts
  • Gender:Male
  • Location:Sweden

Posted 14 December 2016 - 04:44 AM

The scripting action AddGlobals() only works for "GLOBAL" variables. This action does nothing for "LOCALS" or "MYAREA" or any other type of variable that is not a "GLOBAL" variable.
 
This example from the IESDP works

IF
  Global("Var1","GLOBAL",0)
THEN
  RESPONSE #100
    SetGlobal("Var1","GLOBAL",75) //Var1 = 75
    SetGlobal("Var2","GLOBAL",25) //Var2 = 25
    AddGlobals("Var1","Var2") //Var1 = 100
END
But this does not:


IF
  Global("Var1","LOCALS",0)
THEN
  RESPONSE #100
    SetGlobal("Var1","LOCALS",75) //Var1 = 75
    SetGlobal("Var2","LOCALS",25) //Var2 = 25
    AddGlobals("Var1","Var2") //Var1 will still be set to 75
END

Edited by Galactygon, 14 December 2016 - 04:45 AM.

Posted Image

Posted Image

#2 Fiann of the Silver Hand

Fiann of the Silver Hand
  • Modders
  • 387 posts
  • Gender:Male
  • Location:MURICA

Posted 14 December 2016 - 03:36 PM

So this is like IncrementGlobal but able to use a GLOBAL variable instead of an integer?


Edited by Fiann of the Silver Hand, 14 December 2016 - 03:38 PM.


#3 Avenger

Avenger
  • Modders
  • 3803 posts
  • Gender:Male
  • Location:Hungary

Posted 14 December 2016 - 11:56 PM

So this is like IncrementGlobal but able to use a GLOBAL variable instead of an integer?

 

I don't understand this question. All the involved variables are integer.



#4 Ardanis

Ardanis

    A very GAR character

  • Modders
  • 2617 posts
  • Gender:Male
  • Location:Saint-Petersburg, Russia

Posted 15 December 2016 - 12:54 AM

So this is like IncrementGlobal but able to use a GLOBAL variable instead of an integer?

 

Yes.


Retired from modding.


#5 Fiann of the Silver Hand

Fiann of the Silver Hand
  • Modders
  • 387 posts
  • Gender:Male
  • Location:MURICA

Posted 15 December 2016 - 09:09 PM

 

So this is like IncrementGlobal but able to use a GLOBAL variable instead of an integer?

 

I don't understand this question. All the involved variables are integer.

 

Ard got me, but yes, I meant literally "GLOBAL" in the script instead of a fixed modder-written number.



#6 Avenger

Avenger
  • Modders
  • 3803 posts
  • Gender:Male
  • Location:Hungary

Posted 19 December 2016 - 01:13 AM

Ah yes. addglobals adds 2 global variables. But you don't have to (and can't) specify the scope (GLOBAL). 



#7 lynx

lynx
  • Modders
  • 3139 posts
  • Gender:Male
  • Location:Ljubljana, Slovenija

Posted 16 March 2018 - 11:11 AM

added note, thanks.


GemRB - IE anywhere.
Mages needed! Looking for Planescape: Torment testers
Play android version IS NOT SUPPORTED ANYMORE: reported bugs will be ignored! Still looking for builders ...




Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users