• 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.

Undeclared Variable in JASS

Status
Not open for further replies.
Level 4
Joined
Apr 19, 2013
Messages
86
Hey guys,

This probably will just take a second, but I've spent over an hour trouble shooting this JASS compile error. I'm using Anachron's inventory system, and all I want this to do is to disable one of my triggers called "AncientOre" as the item is dropped, then enable it again after Anachron's system completes the drop action.

Have a look:

JASS:
library CIEvents
endlibrary

module CIEvents
    public method pick takes CustomItem ci returns boolean
        if .checkPickup(ci) and IsUnitType(.carrier,UNIT_TYPE_STRUCTURE)== false and ( GetItemTypeId(ci.getHandle()) != 'I00G' ) then
            call ci.pick(.carrier)
            call .addItem(ci)
            return true
        endif
        
        return false
    endmethod
    
    public method drop takes CustomItem ci returns boolean
        if .hasItem(ci) then
            call DisableTrigger(AncientOre)
            call ci.drop(.carrier)
            return .remItem(ci)
            call EnableTrigger(AncientOre)
        endif
        
        return false
    endmethod
    
    public method pawn takes CustomItem ci returns boolean
        if .hasItem(ci) then
            call ci.pawn(.carrier)
            return true
        endif
        
        return false
    endmethod
    
    public method use takes CustomItem ci returns boolean
        if .hasItem(ci) then
            call ci.use(.carrier)
            return true
        endif
        
        return false
    endmethod
endmodule

The error says that AncientOre is an undeclare variable. But it's a real, living breathing trigger in my map.

I spelled it right and everything. And if spelling is not the issue, where am I suppose to declare this variable? I tried every place under the sun.

thanks for looking
 
Level 4
Joined
Apr 19, 2013
Messages
86
Yeah, that's the confusing part. I didn't think it was a variable at all.

AncientOre is just a trigger in my map, i want to disable it during the drop item process because if its active during this process it will not function correctly.

I've never had to disable a trigger in JASS before, I didn't think it'd be this hard.

Is it necessary to declare a trigger as a variable in this instance?
 
Level 4
Joined
Apr 19, 2013
Messages
86
Hey, sry for the wait

I tried, closest I got was this

JASS:
This debugs the static ifs */
library CIEvents
    globals
        private trigger AncientOre
endlibrary

said it was an error, nested global.

but, that's where the other globals are when I looked at the other triggers he wrote. I must be missing something obvious.
 
Level 11
Joined
Oct 11, 2012
Messages
711
Hey, sry for the wait

I tried, closest I got was this

JASS:
This debugs the static ifs */
library CIEvents
    globals
        private trigger AncientOre
endlibrary

said it was an error, nested global.

but, that's where the other globals are when I looked at the other triggers he wrote. I must be missing something obvious.

Can you refer to my preview post to see if that's the problem?

Edit: you are also missing one line in your global declaration
JASS:
library CIEvents
    globals
        private trigger AncientOre
    endglobals //you missed this
endlibrary

But I suggest you delete this global declaration first and try my method in the preview post. If that does not solve your problem, then try to declare the global variable.
 
Status
Not open for further replies.
Top