WC3 Crashes if I declare global leaderboard

Trollvottel

never aging title
Reaction score
262
well its the same for me but if you dont use createLeaderboard() directly there is no error, so how about creating it later?
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
Leaderboard can't be created when players are not even in the game / The game is not even started.
 

Magentix

if (OP.statement == false) postCount++;
Reaction score
107
- Can't declare multiboards at init
- Can't init globals with funciton calls directly?

JASS:
globals
    timer t = CreateTimer()
endglobals


Would prolly crash too?
 
Reaction score
456
It would not. You can do that inside structs, and struct members are global variables.
 

Magentix

if (OP.statement == false) postCount++;
Reaction score
107
Yeah, wasn't sure of my second statement, but I do recall having some compiler error in the past about initializing global stuff with a function
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
>>It would not. You can do that inside structs, and struct members are global variables.
I thought that struct's member are initialized at a InitTrig function which run right after the game started?
 
Reaction score
456
>I thought that struct's member are initialized at a InitTrig function which run right after the game started?
Uh? What are you talking about? They are not initialized anywhere else but in the creation of the struct (allocation function).

Struct:
JASS:
struct MyStruct
    real myreal = 25.00
endstruct


Allocation function of the struct:
JASS:
function s__MyStruct__allocate takes nothing returns integer
 local integer this=si__MyStruct_F
    if (this!=0) then
        set si__MyStruct_F=si__MyStruct_V[this]
    else
        set si__MyStruct_I=si__MyStruct_I+1
        set this=si__MyStruct_I
    endif
    if (this>8190) then
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,1000.,"Unable to allocate id for an object of type: MyStruct")
        return 0
    endif

    set s__MyStruct_myreal[this]=25.00 //Note this line
    set si__MyStruct_V[this]=-1
 return this
endfunction
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
>>Uh? What are you talking about? They are not initialized anywhere else but in the creation of the struct (allocation function).
Well, at least it isn't initialized at the map init. (Which is the map just finished loading, but haven't start while waiting other players)
 

SerraAvenger

Cuz I can
Reaction score
234
You can' t create leader and multi boards at map initialization. It is told even
in GUI.

Sure you can. But you cannot display them.

AND when you use vJass's "global" tags, you cannot call functions within them.

Will now work without any error, there is one limitation though, you can't use functions or non-constant values in the default value, for example you can make a global start on null, 1 , 19923 , 0xFFF, true, false, "Hi" , etc. But you can't make them initialize with any function call or with a native (although it is possible to use a native, most natives tend to crash the thread when used in globals declaration). You can't also assign to another global variable, because there isn't really a way to control to what position of the map would a global declaration go.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top