• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • 💡 We're thrilled to announce that our upcoming texturing contest is in the works, and we're eager to hear your suggestions! Please take this opportunity to share your ideas in this theme discussion thread for the Texturing Contest #34!
  • 🏆 Hive's 7th HD Modeling Contest: Icecrown Creature is now open! The frozen wastes of Icecrown are home to some of Azeroth’s most terrifying and resilient creatures. For this contest, your challenge is to design and model a HD 3D monster that embodies the cold, undead, and sinister essence of Icecrown! 📅 Submissions close on April 13, 2025. Don't miss this opportunity to let your creativity shine! Enter now and show us your frozen masterpiece! 🔗 Click here to enter!

Difference between Integer A, Integer B, custom integer?

Status
Not open for further replies.
Level 7
Joined
Jun 15, 2010
Messages
218
what is the differance of these 3 actions?:

  • For each (Integer A) from 1 to 10, do (Actions)
    • Loop - Actions
  • For each (Integer B) from 1 to 10, do (Actions)
    • Loop - Actions
  • For each (Integer QB_Level) from 1 to 10, do (Actions)
    • Loop - Actions

edit: i get it now:) thanks for he explenation.
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,243
Custom variable is better since it's faster.

  • For each (Integer A) from 1 to 10, do (Actions)
    • Loop - Actions
->
JASS:
set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = 10
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop

  • For each (Integer i) from 1 to 10, do (Actions)
    • Loop - Actions
->
JASS:
set udg_i = 1
    loop
        exitwhen udg_i > 10
        set udg_i = udg_i + 1
    endloop
One less variable setting.

And when you call the variable inside the loop:
  • Set ID = (Integer A)
->
JASS:
set udg_ID = GetForLoopIndexA()
So that calls a function that returns the value set to bj_forLoopAIndex.

  • Set ID = i
->
JASS:
set udg_ID = udg_i
No function call.
 
Integer A and B are blizzard global variables used in for functions!
It was faster for programmers to just pick 1 (usually A) variable already used with function and do what they need to do...
Still there was situations when they needed 2 functions so they added Integer B for just in case!
For function with custom variable is default one, basic thing :)
 
Status
Not open for further replies.
Top