"Unexpected Endlibrary?" What?

LurkerAspect

Now officially a Super Lurker
Reaction score
118
Hi again :D

This time I have a really annoying problem which is threatening to capsize my whole project at the moment, whenever I try to save the map, Jasshelper jumps in and screams at me for an "unexpected endlibrary". However, when I delete that endlibrary, it doesn't register it as a library, then I get nesting problems :nuts:

Here's where the endlibrary problem is given; this is copy-pasted from JassHelper:
JASS:
endfunction

endlibrary

endlibrary//===========================================================================
// Trigger: ABC
//===========================================================================
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
I'm pretty sure you can't end a library that doesn't exist...
 

LurkerAspect

Now officially a Super Lurker
Reaction score
118
-_-'

That's just an extract from what it said, should I rather post the whole section?
 

quraji

zap
Reaction score
144
In other words, you have two endlibrary's which ends the library, then tries to end one that doesn't exist after that. Delete one.
 

LurkerAspect

Now officially a Super Lurker
Reaction score
118
Well, you see, the problem is that when I delete the one, then it doesn't put another one before the "ABC" trigger. Then it gets buggered, so I have to put it back in, in which case it gets buggered again.
 

T.s.e

Wish I was old and a little sentimental
Reaction score
133
Post the whole trigger above the endlibrary statements please.
 

LurkerAspect

Now officially a Super Lurker
Reaction score
118
jasshelpererror2.jpg


Then if I delete that endlibrary:
jasshelpererror3.jpg

:confused:
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
Post the code of the library causing it, can't do much helping without the code.
 

LurkerAspect

Now officially a Super Lurker
Reaction score
118
JASS:
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//  ~~    Event     ~~    By Jesus4Lyf    ~~    Version 1.02    ~~
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
//  What is Event?
//         - Event simulates Warcraft III events. They can be created,
//           registered for, fired and also destroyed.
//         - Event, therefore, can also be used like a trigger "group".
//         - This was created when there was an influx of event style systems 
//           emerging that could really benefit from a standardised custom
//           events snippet. Many users were trying to achieve the same thing
//           and making the same kind of errors. This snippet aims to solve that.
//
//  Functions:
//         - Event.create()     --> Creates a new Event.
//         - .chainDestroy()    --> Destroys an Event.
//                                  DO NOT use .destroy().
//         - .fire()            --> Fires all triggers which have been
//                                  registered on this Event.
//         - .register(trigger) --> Registers another trigger on this Event.
//
//  Details:
//         - Event is extremely efficient and lightweight.
//         - It is safe to use with dynamic triggers.
//         - Internally, it is just a singularly linked list. Very simple.
//
//  How to import:
//         - Create a trigger named Event.
//         - Convert it to custom text and replace the whole trigger text with this.
//
//  Thanks:
//         - Builder Bob for the trigger destroy detection method.
//         - Azlier for inspiring this by ripping off my dodgier code.
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
library Event
    ///////////////
    // EventRegs //
    ////////////////////////////////////////////////////////////////////////////
    // For reading this far, you can learn one thing more.
    // Unlike normal Warcraft III events, you can attach to Event registries.
    // 
    // Event Registries are registrations of one trigger on one event.
    // These cannot be created or destroyed, just attached to.
    //
    // It is VERY efficient for loading and saving data.
    // 
    //  Functions:
    //         - set eventReg.data = someStruct --> Store data.
    //         - eventReg.data                  --> Retreive data.
    //         - Event.getTriggeringEventReg()  --> Get the triggering EventReg.
    // 
    struct EventReg
        integer data
        method clear takes nothing returns nothing
            set this.data=0
        endmethod
    endstruct
    
    struct Event
        private trigger trig
        private Event next
        static method create takes nothing returns Event
            local Event this=Event.allocate()
            set this.next=0
            return this
        endmethod
        private static Event current
        static method getTriggeringEventReg takes nothing returns EventReg
            return .current
        endmethod
        private static trigger t
        method fire takes nothing returns nothing
            // this = last.
            loop
                set .current=this.next
                exitwhen .current==0
                set .t=.current.trig
                if IsTriggerEnabled(.t) then
                    if TriggerEvaluate(.t) then
                        call TriggerExecute(.t)
                    endif
                    set this=.current
                else
                    call EnableTrigger(.t) // Was trigger destroyed?
                    if IsTriggerEnabled(.t) then
                        call DisableTrigger(.t)
                        set this=.current
                    else // If trigger destroyed...
                        set .current.trig=null
                        set this.next=.current.next
                        call .current.destroy()
                    endif
                endif
            endloop
        endmethod
        method register takes trigger t returns EventReg
            local Event new=Event.allocate()
            set new.next=this.next
            set new.trig=t
            set this.next=new
            call EventReg(new).clear()
            return new
        endmethod
        method chainDestroy takes nothing returns nothing
            loop
                call this.destroy()
                set this=this.next
                exitwhen this==0
                set this.trig=null
            endloop
        endmethod
    endstruct
    
    /////////////////////////////////////////////////////
    // Demonstration Functions & Alternative Interface //
    ////////////////////////////////////////////////////////////////////////////
    // What this would look like in normal WC3 style JASS (should all inline).
    // 
    function CreateEvent takes nothing returns Event
        return Event.create()
    endfunction
    function DestroyEvent takes Event whichEvent returns nothing
        call whichEvent.chainDestroy()
    endfunction
    function FireEvent takes Event whichEvent returns nothing
        call whichEvent.fire()
    endfunction
    function TriggerRegisterEvent takes trigger whichTrigger, Event whichEvent returns EventReg
        return whichEvent.register(whichTrigger)
    endfunction
    
    // And for EventRegs...
    function SetEventRegData takes EventReg whichEventReg, integer data returns nothing
        set whichEventReg.data=data
    endfunction
    function GetEventRegData takes EventReg whichEventReg returns integer
        return whichEventReg.data
    endfunction
    function GetTriggeringEventReg takes nothing returns integer
        return Event.getTriggeringEventReg()
    endfunction

The endlibrary should be right at the bottom, but when I put one there, I get picture A, and if I don't, I get picture B.
 

Gtam

Lerning how to write and read!! Yeah.
Reaction score
164
just take away the second endlibrary and just put library
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
You're positive it's that trigger that's causing it? Tried disabling it?
 

LurkerAspect

Now officially a Super Lurker
Reaction score
118
No, that wasn't the cause. Don't worry, I've solved the problem, but it's revealed a much larger problem to me.

For some reason, before all this happened, most of my endscopes and endlibraries vanished. Don't ask me how, maybe it's a Newgen bug, but I swear they were gone. When I retyped them, they were causing compile errors with the invisible versions.

Anybody heard of that before? :nuts: I think it has something to do with the folding feature of Newgen.
 

Sevion

The DIY Ninja
Reaction score
413
I've never experienced trouble with folding, then again, whenever I fold I unfold it after I'm done.
 

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
Does anyone even use the fold feature?
It's pretty pointless... If you don't want to look at your own code, you shouldn't have written it in the first place.
>.>
 

cleeezzz

The Undead Ranger.
Reaction score
268
i use it sometimes if i use too many long if/then/elses, it starts to get confusing (i indent properly) after it gets too long.

so i just fold the small ones to see clearly that i got them all
 

Sevion

The DIY Ninja
Reaction score
413
When I was getting function names for documentation on ItemGroup (click getLast() in my signature to find it), I folded my functions to see just function <NAME> <ARGS>.

So yes, people do use fold. It's not that they don't want to look at it cuz it sucks, it's just when things get long or you don't want to scroll back and forth so much.
 
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