• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Problem

Status
Not open for further replies.
Level 1
Joined
Aug 11, 2014
Messages
4
Stopped save map. Pls guys help me. Before everything was fine.
This is spell
 

Attachments

  • Flicker by Sunn (3).w3x
    67.5 KB · Views: 21
  • 3.png
    3.png
    1.6 MB · Views: 54
Level 1
Joined
Aug 2, 2014
Messages
1
You are using $ in your variable names, this isnt a valid variable name and therefore wont compile. Remove the $ signs and it should work/find your next error :)

Edit: Dont know anything about macros so i might be wrong..
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,180
The macro was incorrectly declared and used (syntax error).

It was given as...
JASS:
//!textmacro ALLOCATE takes NAME 
globals
    integer $NAME$I  = 0
    private integer $NAME$FreeAm = 0
    private integer $NAME$MaxId  = 0  
    private integer array $NAME$FreeAr
    private boolean array $NAME$IsUsed
endglobals

function $NAME$alloc takes nothing returns nothing
    if $NAME$FreeAm == 0 then
        set $NAME$MaxId = $NAME$MaxId + 1
        set $NAME$I = $NAME$MaxId
    else
        set $NAME$I = $NAME$FreeAr[$NAME$FreeAm]
        set $NAME$FreeAm = $NAME$FreeAm - 1  
    endif
    set $NAME$IsUsed[$NAME$I] = true
endfunction

function $NAME$clean takes integer index returns nothing
    set $NAME$IsUsed[index] = false
    set $NAME$FreeAm = $NAME$FreeAm + 1
    set $NAME$FreeAr[$NAME$FreeAm] = index
endfunction
//!endtextmacro
//!runtextmacro ALLOCATE ("te_")
//!runtextmacro ALLOCATE ("sh_")

But should have been...

JASS:
//! textmacro ALLOCATE takes NAME 
globals
    integer $NAME$I  = 0
    private integer $NAME$FreeAm = 0
    private integer $NAME$MaxId  = 0  
    private integer array $NAME$FreeAr
    private boolean array $NAME$IsUsed
endglobals

function $NAME$alloc takes nothing returns nothing
    if $NAME$FreeAm == 0 then
        set $NAME$MaxId = $NAME$MaxId + 1
        set $NAME$I = $NAME$MaxId
    else
        set $NAME$I = $NAME$FreeAr[$NAME$FreeAm]
        set $NAME$FreeAm = $NAME$FreeAm - 1  
    endif
    set $NAME$IsUsed[$NAME$I] = true
endfunction

function $NAME$clean takes integer index returns nothing
    set $NAME$IsUsed[index] = false
    set $NAME$FreeAm = $NAME$FreeAm + 1
    set $NAME$FreeAr[$NAME$FreeAm] = index
endfunction
//! endtextmacro
//! runtextmacro ALLOCATE ("te_")
//! runtextmacro ALLOCATE ("sh_")

Basically...
JASS:
//!textmacro ALLOCATE takes NAME 
//!endtextmacro
//!runtextmacro ALLOCATE ("te_")
//!runtextmacro ALLOCATE ("sh_")
Are all interpreted as comments unless there is a space after the '!'. It is possible that a custom vjass compiler was used or an old/alternative version which had less strict syntax. It clearly is explained in the vjass manual that there must be a space for it to register as a macro correctly.

Give me spell's map file I will correct it ;)
You could have just told him it instead of trying to act all smart and all knowing. Which reminds me...
Lol you can't use '$' symbol in JASS , nor in GUI , y'know...
That was not helpful at all.
 
Level 1
Joined
Aug 11, 2014
Messages
4
The macro was incorrectly declared and used (syntax error).

It was given as...
JASS:
//!textmacro ALLOCATE takes NAME 
globals
    integer $NAME$I  = 0
    private integer $NAME$FreeAm = 0
    private integer $NAME$MaxId  = 0  
    private integer array $NAME$FreeAr
    private boolean array $NAME$IsUsed
endglobals

function $NAME$alloc takes nothing returns nothing
    if $NAME$FreeAm == 0 then
        set $NAME$MaxId = $NAME$MaxId + 1
        set $NAME$I = $NAME$MaxId
    else
        set $NAME$I = $NAME$FreeAr[$NAME$FreeAm]
        set $NAME$FreeAm = $NAME$FreeAm - 1  
    endif
    set $NAME$IsUsed[$NAME$I] = true
endfunction

function $NAME$clean takes integer index returns nothing
    set $NAME$IsUsed[index] = false
    set $NAME$FreeAm = $NAME$FreeAm + 1
    set $NAME$FreeAr[$NAME$FreeAm] = index
endfunction
//!endtextmacro
//!runtextmacro ALLOCATE ("te_")
//!runtextmacro ALLOCATE ("sh_")

But should have been...

JASS:
//! textmacro ALLOCATE takes NAME 
globals
    integer $NAME$I  = 0
    private integer $NAME$FreeAm = 0
    private integer $NAME$MaxId  = 0  
    private integer array $NAME$FreeAr
    private boolean array $NAME$IsUsed
endglobals

function $NAME$alloc takes nothing returns nothing
    if $NAME$FreeAm == 0 then
        set $NAME$MaxId = $NAME$MaxId + 1
        set $NAME$I = $NAME$MaxId
    else
        set $NAME$I = $NAME$FreeAr[$NAME$FreeAm]
        set $NAME$FreeAm = $NAME$FreeAm - 1  
    endif
    set $NAME$IsUsed[$NAME$I] = true
endfunction

function $NAME$clean takes integer index returns nothing
    set $NAME$IsUsed[index] = false
    set $NAME$FreeAm = $NAME$FreeAm + 1
    set $NAME$FreeAr[$NAME$FreeAm] = index
endfunction
//! endtextmacro
//! runtextmacro ALLOCATE ("te_")
//! runtextmacro ALLOCATE ("sh_")

Basically...
JASS:
//!textmacro ALLOCATE takes NAME 
//!endtextmacro
//!runtextmacro ALLOCATE ("te_")
//!runtextmacro ALLOCATE ("sh_")
Are all interpreted as comments unless there is a space after the '!'. It is possible that a custom vjass compiler was used or an old/alternative version which had less strict syntax. It clearly is explained in the vjass manual that there must be a space for it to register as a macro correctly.


You could have just told him it instead of trying to act all smart and all knowing. Which reminds me...

That was not helpful at all.

:piru:Thank You
 
Status
Not open for further replies.
Top