• 🏆 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!

vJASS error w/ Faux CSCache library

Status
Not open for further replies.
Level 3
Joined
Jan 23, 2013
Messages
20
I wanted to use the two libraries: Faux HandleVars & CSCache as a "bandage" for a map from before patch 1.23 but the Faux CSCache library gave me an error in which this library refers to the CSSafeCache reading it as a scope.

First line: library CSCache initializer init requires CSSafeCache

Can anybody help me with this one or help me manualy rewrite the script?

JASS:
library CSCache initializer init requires CSSafeCache

 globals
    private hashtable ht
 endglobals
 

    // too bad the Handle vars' old functionality forces me to make these things
    // inline-unfriendly
    function SetTableObject takes string subject,  string label, agent value returns nothing
        if(value==null) then
            call RemoveSavedHandle( ht, StringHash(subject), StringHash(label))
        else
            call SaveAgentHandle( ht, StringHash(subject), StringHash(label), value)
        endif
    endfunction




    function GetTableHandle takes string subject, string label returns agent
        debug call BJDebugMsg("[debug] What the heck? Why would you call HandleHandle I guess this was caused by a search and replace mistake")
        return null
    endfunction

    // these are inline friendly, ok, maybe they aren't because jasshelper does not recognize
    // GetHandleId as non-state changing. But they will be once I fix jasshelper...



    // got bored so I now use a textmacro...
    //! textmacro FAUX_HANDLE_VARS_GetTableHandle takes NAME, TYPE
         function SetTable$NAME$ takes string subject,  string label, $TYPE$ value returns nothing
             if(value==null) then
                call RemoveSavedHandle( ht, StringHash(subject), StringHash(label))
             else
                call Save$NAME$Handle( ht, StringHash(subject), StringHash(label), value)
             endif
         endfunction

         function GetTable$NAME$ takes string subject, string label returns $TYPE$
             return Load$NAME$Handle( ht, StringHash(subject), StringHash(label))
         endfunction
    //! endtextmacro
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("Player","player")
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("Widget","widget")
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("Destructable","destructable")
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("Item","item")
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("Unit","unit")
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("Ability","ability")
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("Timer","timer")
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("Trigger","trigger")
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("TriggerCondition","triggercondition")
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("TriggerAction","triggeraction")
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("TriggerEvent","event")
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("Force","force")
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("Group","group")
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("Location","location")
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("Rect","rect")
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("BooleanExpr","boolexpr")
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("Sound","sound")
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("Effect","effect")
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("UnitPool","unitpool")
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("ItemPool","itempool")
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("Quest","quest")
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("QuestItem","questitem")
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("DefeatCondition","defeatcondition")
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("TimerDialog","timerdialog")
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("Leaderboard","leaderboard")
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("Multiboard","multiboard")
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("MultiboardItem","multiboarditem")
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("Trackable","trackable")
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("Dialog","dialog")
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("Button","button")
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("TextTag","texttag")
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("Lightning","lightning")
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("Image","image")
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("Ubersplat","ubersplat")
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("Region","region")
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("FogState","fogstate")
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("FogModifier","fogmodifier")
    //! runtextmacro FAUX_HANDLE_VARS_GetTableHandle("Hashtable","hashtable")

    function CS_KillTrigger takes trigger t returns nothing
    // let em leak
    endfunction

    // too bad the Handle vars' old functionality forces me to make these things
    // inline-unfriendly
    function AttachObject takes agent subject,  string label, agent value returns nothing
        call SetTableObject( GetAttachmentTable(subject) , label, value)
    endfunction




    function GetAttachedHandle takes agent subject, string label returns agent
        debug call BJDebugMsg("[debug] What the heck? Why would you call HandleHandle I guess this was caused by a search and replace mistake")
        return null
    endfunction

    // these are inline friendly, ok, maybe they aren't because jasshelper does not recognize
    // GetHandleId as non-state changing. But they will be once I fix jasshelper...



    // got bored so I now use a textmacro...
    //! textmacro FAUX_HANDLE_VARS_GetAttachedHandle takes NAME, TYPE
         function Attach$NAME$ takes agent subject,  string label, $TYPE$ value returns nothing
             call SetTable$NAME$( GetAttachmentTable(subject), label, value)
         endfunction

         function GetAttached$NAME$ takes agent subject, string label returns $TYPE$
             return GetTable$NAME$( GetAttachmentTable(subject), label)
         endfunction
    //! endtextmacro
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("Player","player")
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("Widget","widget")
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("Destructable","destructable")
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("Item","item")
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("Unit","unit")
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("Ability","ability")
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("Timer","timer")
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("Trigger","trigger")
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("TriggerCondition","triggercondition")
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("TriggerAction","triggeraction")
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("TriggerEvent","event")
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("Force","force")
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("Group","group")
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("Location","location")
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("Rect","rect")
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("BooleanExpr","boolexpr")
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("Sound","sound")
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("Effect","effect")
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("UnitPool","unitpool")
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("ItemPool","itempool")
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("Quest","quest")
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("QuestItem","questitem")
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("DefeatCondition","defeatcondition")
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("TimerDialog","timerdialog")
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("Leaderboard","leaderboard")
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("Multiboard","multiboard")
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("MultiboardItem","multiboarditem")
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("Trackable","trackable")
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("Dialog","dialog")
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("Button","button")
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("TextTag","texttag")
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("Lightning","lightning")
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("Image","image")
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("Ubersplat","ubersplat")
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("Region","region")
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("FogState","fogstate")
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("FogModifier","fogmodifier")
    //! runtextmacro FAUX_HANDLE_VARS_GetAttachedHandle("Hashtable","hashtable")
    
    
    private function init takes nothing returns nothing
        set ht=InitHashtable()
    endfunction

endlibrary
 

Attachments

  • Script.7z
    42.8 KB · Views: 27
Last edited:
Status
Not open for further replies.
Top