System Advanced Indexing & Data Storage

monoVertex

I'm back!
Reaction score
460
Please bear with my noobiness, as I am only mapping for the tower contest at the moment. I have 2 questions:

Is this using the userdata field of units? I need a system that is not doing that.

Why do I get a Syntax Error on every line with "static if ... then"?
 

monoVertex

I'm back!
Reaction score
460
Hmm, what should I do then? I have the NewGen editor from the official thread in the WEH forum.

EDIT: Just to make sure, I redownloaded NewGen from Wc3C. Still getting the error.
 

13lade619

is now a game developer :)
Reaction score
399
the Jasshelper included in 1.5d is outdated.

http://www.wc3c.net/showthread.php?t=88142

there. just follow the download on the end of the post.

Vexorian said:
Easiest way to setup jasshelper with grimoire is by downloading the Jass NewGen pack and then just update its jasshelper.exe to the one included in this release.
 

Jesus4Lyf

Good Idea™
Reaction score
397
[edit] Lulz, workaround:
Not guaranteed to work - you should check to see if the struct creation was already successful, incase a unit is made after TU inits. :)

>Is this using the userdata field of units? I need a system that is not doing that.
Then why do you need a system at all. That's the point...
And yes, JassHelper update issue. ;)
 

monoVertex

I'm back!
Reaction score
460
Yeah, that did it. Thanks!

However, it uses the User Data xD. So I can't use it with my current method, I need to change the method I use >.<...

@Jesus: well, Ghan used the data field of his creeps in the contest map, so if I want to use indexing with them, it gets screwed up. And I would like to use his map, as he asked us to do. Meh :p.

EDIT: Nevermind, found another way to solve the problem. And since I already put AIDS in the map, I'll just use it, too lazy to change it back or something xD.
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
Not guaranteed to work - you should check to see if the struct creation was already successful, incase a unit is made after TU inits. :)
Isn't it? After all, there's an if referring to a global boolean that keeps them from initializing until that timer runs. And since it's to start a timer, there's no worry if a unit is created and removed before that comes to pass.

@Jesus: well, Ghan used the data field of his creeps in the contest map, so if I want to use indexing with them, it gets screwed up. And I would like to use his map, as he asked us to do. Meh :p.

EDIT: Nevermind, found another way to solve the problem.
Well, he did say we can change the map to allow for indexers. If you'd like (despite finding a fix on your own), I've posted a UnitUserData-free version of the template map that I made.
 

monoVertex

I'm back!
Reaction score
460
As I said in the original thread, thank you for the map, but, as I said in this thread :)P), I already found a way around, which even proved itself more efficient :D.

Sorry for the off-topic, J4L.
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
Well, it seems not even KT supports starting a timer on AIDS_onCreate for preplaced units. :( (In the end, I shouldn't use TU because it still has a limited amount of timers in hashtable mode, and the default is 256, not nearly enough to have one or more per unit on the map.)

[edit] I was mistaken; KT just needs to be before AIDS in the map (or, [ljass]library AIDS uses optional KT[/ljass]).
[edit 2] OK, what's going on? I swear I tried [ljass]library AIDS uses optional TimerUtils[/ljass] before and it didn't work. Doesn't work for AutoIndex, though.
[edit 3] Mistaken again; it doesn't work simply if KT/TU is before AIDS in the map. Consider adding [ljass]library AIDS uses optional KT, optional TimerUtils[/ljass]?

JASS:
library Ktest requires KT, AIDS
	struct Test extends array
		private static method periodic takes nothing returns boolean
			local unit u = thistype(KT_GetData()).unit
			call BJDebugMsg(GetUnitName(u))
			return false
		endmethod
		method AIDS_onCreate takes nothing returns nothing
			call KT_Add(function thistype.periodic, this, .2)
		endmethod
		
		//! runtextmacro AIDS()
	endstruct
endlibrary
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
Hmm, try this, perhaps?

If you are speed freak, try (Optimized by me, :p):
JASS:
library_once TimerUtils

    globals
        private integer array Data
        private timer array Timer
        private integer tid
    endglobals
    
    function SetTimerData takes timer t, integer value returns nothing
        set tid = GetHandleId(t)
        set Data[tid - (tid / 8191) * 8191] = value
    endfunction

    function GetTimerData takes timer t returns integer
        set tid = GetHandleId(t)
        return Data[tid - (tid / 8191) * 8191]
    endfunction

    globals
        private integer array tH
        private integer tN = 0
        private constant integer HELD=0x28829022
        //use a totally random number here, the more improbable someone uses it, the better.
    endglobals

    function NewTimer takes nothing returns timer
     local timer t
        if (tN == 0) then
            loop
                set t = CreateTimer()
                set tid = GetHandleId(t)
                set tH[0] = tid - (tid / 8191) * 8191
                exitwhen Timer[tH[0]] == null
            endloop
            set Timer[tH[0]] = t
        else
            set tN = tN - 1
        endif
        set Data[tH[tN]] = 0
     return Timer[tH[tN]]
    endfunction

    function ReleaseTimer takes timer t returns nothing
        set tid = GetHandleId(t)
        set tid = tid - (tid / 8191) * 8191
        if (t == null) then
            debug call BJDebugMsg(&quot;Warning: attempt to release a null timer&quot;)
            return
        endif
        debug if (Timer[tid] != t) then
        debug     call BJDebugMsg(&quot;ReleaseTimer: Wrong handle id, only use ReleaseTimer on timers created by NewTimer&quot;)
        debug endif
        call PauseTimer(t)
        set tH[tN] = tid
        if (Data[tH[tN]] == HELD) then
            debug call BJDebugMsg(&quot;Warning: ReleaseTimer: Double free!&quot;)
            return
        endif
        set Data[tH[tN]] = HELD
        set tN = tN + 1
    endfunction

endlibrary
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
Am I correct in my discovery that using addLock on any AIDS struct will put off onDestroy of every AIDS struct? :( That puts a crimp in my plans to have one locked struct with a "removed" boolean, and one unlocked struct that changes that boolean in its onDestroy method, in order to use KT2.
 

Jesus4Lyf

Good Idea™
Reaction score
397
If you are speed freak, try (Optimized by me, :p):
How is that optimised at all? -_-
Am I correct in my discovery that using addLock on any AIDS struct will put off onDestroy of every AIDS struct?
Correct. The method I used in MSX which I linked you works, though.

KT2 can be fixed to have its initialisation run earlier if need be. JassHelper updates have caused this.

I don't think I would use KT2 for something that needs to be stopped from outside of its callback...
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
At this point, the discussion probably should move to the KT2 thread, but since it started here:

I don't think I would use KT2 for something that needs to be stopped from outside of its callback...
It's because aside from that, KT2 is just about perfect for my purpose, which requires at least one timer per unit on the map started at unit creation and stopped at unit removal, at a non-T32 rate, with multiple callbacks. TimerUtils has only one callback per period and would run out of timers at its default settings anyway; KT2 would do the callbacks efficiently, but has problems with starting and stopping, and starting for onCreate with preplaced units with either AIDS or AutoIndex (and yes, I do want to maintain that flexibility).

There doesn't seem to be a timer system that works well for this, so I'm left to create an integrated system with semi-dynamic triggers and timers. Go figure that the first thing I try to create in vJASS ends up being a headache...
 

tooltiperror

Super Moderator
Reaction score
231
I recommend that you add the specifications for the ability at the top of the script to the documentation for Mac Users, since we can't Object Merger.

You know, since some people might not want to copy it from the demo map.
 

Jesus4Lyf

Good Idea™
Reaction score
397
I recommend that you add the specifications for the ability at the top of the script to the documentation for Mac Users, since we can't Object Merger.

You know, since some people might not want to copy it from the demo map.
The specifications are clearly in the code as well as the demo map.
JASS:
//!          external ObjectMerger w3a Adef AIDS anam &quot;State Detection&quot; ansf &quot;(AIDS)&quot; aart &quot;&quot; arac 0

So I don't know what you're asking. :)
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
Copy the "State Detection" ability to your map or just use periodic recycler.
 

Laiev

Hey Listen!!
Reaction score
188
hmm

how replace some function in AutoIndex to AIDS (to use AIDS), because some systems need it... and AIDS ins't compatible :(

example: AutoData, AutoCreate, and AutoDestroy modules
 

Jesus4Lyf

Good Idea™
Reaction score
397
There is a discrepancy in design between AutoIndex and AIDS.

AutoIndex believes structs should be destroyed just before the unit leaves the game.
AIDS believes structs should be destroyed when you're done with them (see locking).
The difference being being able to access the unit from the struct when it is destroyed as the unit leaves.

This means the two can never truly replaces the others' functionality. Or at least not natively.

One of us would need to spend a reasonable deal of work trying to replicate the functionality of the other.

If you don't actually care about that, it is possible for the functionality to be written to make them replacable... but someone has to do it, I guess. I don't know what AutoData is yet, I assume all the functionality you listed is covered in AIDS structs somewhere.

May I ask what it is you need AutoIndex functionality for?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top