d is not of a type that allows .syntax

GetTriggerUnit-

DogEntrepreneur
Okay, I get this Jasshelper error (yes I got it almost fully working).
Basicly, the only one that gives me this error is d.offsetWTH?
I'm new to vJass (btw)
_I want this spell MUI so I use struct data.

JASS:

scope HookShot initializer Init
    globals
        private constant integer SPELL_ID = 'H00K'
        private constant integer DUMMY_ID = 'dumy'
    endglobals

private struct data
    unit caster
    real offset
    real angle
    real lenght
    location cpoint
    player p
endstruct

function Cond takes nothing returns boolean
    return GetSpellAbilityId() == SPELL_ID
endfunction

function Callback takes nothing returns nothing
    local location spawnpoint
    local unit c
    set d.offset = d.offset + 20.00
    set d.lengh = d.lenght - 0.05
    
    set spawnpoint = PolarProjectionBJ( d.cpoint, d.offset, d.angle )
    set c = CreateUnitAtLoc( p, DUMMY_ID, spawnpoint, d.angle )
    call UnitApplyTimedLife( c, 'BTLF', d.lenght )
        
    call RemoveLocation( spawnpoint)
    set spawnpoint = null
endfunction

function Main takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local timer t
    local location tloc = GetSpellTargetLoc()
    local location uloc = GetUnitLoc( u)
    
    set d.cpoint = uloc
    set d.offset = 0.00
    set d.lengh = 2.00
    set d.angle = AngleBetweenPoints( uloc, tloc)
    set d.p = GetOwningPlayer( u)
    call TimerStart( t, 0.05, true, function Callback)
    
    call RemoveLocation( tloc)
    call RemoveLocation( uloc)
    call RemoveLocation( d.cpoint)
    set u = null
    set t = null
    set tloc = null
    set uloc = null
endfunction

//===========================================================================
function Init takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( t, Condition( function Cond))
    call TriggerAddAction( t, function Main )
endfunction

endscope
 

cleeezzz

The Undead Ranger.
JASS:
scope HookShot initializer Init
    globals
        private constant integer SPELL_ID = 'H00K'
        private constant integer DUMMY_ID = 'dumy'
    endglobals

private struct data
    unit caster
    real offset
    real angle
    real lenght
    location cpoint
    player p
endstruct

function Cond takes nothing returns boolean
    return GetSpellAbilityId() == SPELL_ID
endfunction

function Callback takes nothing returns nothing
    local data d = GetCSData(GetExpiredTimer())
    local location spawnpoint
    local unit c
    set d.offset = d.offset + 20.00
    set d.lengh = d.lenght - 0.05
    
    set spawnpoint = PolarProjectionBJ( d.cpoint, d.offset, d.angle )
    set c = CreateUnitAtLoc( p, DUMMY_ID, spawnpoint, d.angle )
    call UnitApplyTimedLife( c, 'BTLF', d.lenght )
        
    call RemoveLocation( spawnpoint)
    set spawnpoint = null
endfunction

function Main takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local timer t
    local location tloc = GetSpellTargetLoc()
    local location uloc = GetUnitLoc( u)
    local data d = data.create()

    set d.cpoint = uloc
    set d.offset = 0.00
    set d.lengh = 2.00
    set d.angle = AngleBetweenPoints( uloc, tloc)
    set d.p = GetOwningPlayer( u)
    call TimerStart( t, 0.05, true, function Callback)
    call SetCSData(t,d)
    call RemoveLocation( tloc)
    call RemoveLocation( uloc)
    call RemoveLocation( d.cpoint)
    set u = null
    set t = null
    set tloc = null
    set uloc = null
endfunction

//===========================================================================
function Init takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( t, Condition( function Cond))
    call TriggerAddAction( t, function Main )
endfunction

endscope

you didn't use any attachment system so the struct would not be carried over to the callback function
the code now requires CSData

(and btw, you never created the struct, you must create it by doing (struct name).create(), in your case, data.create()

and you must set it to a variable in order to use it

local (struct name) (variable)
set (variable) = (struct name).create()

in your case

local data d
set d = data.create()

or you could skip a step like i did in the code

local data d = data.create()
 

cleeezzz

The Undead Ranger.
http://www.wc3c.net/showthread.php?t=80534

16.0 for 1.23b patch
15.3 for current


>>>>Oh and, in the call TimerStart, what does the boolean means?
periodic or not

if true, the timer will restart when it expires. so

call TimerStart(t,1,true,function hi)
would run function hi every second

call TimerStart(t,1,false,function hi)
would run function hi only once
 

GetTriggerUnit-

DogEntrepreneur
>>>>Oh and, in the call TimerStart, what does the boolean means?
periodic or not

if true, the timer will restart when it expires. so

call TimerStart(t,1,true,function hi)
would run function hi every second

call TimerStart(t,1,false,function hi)
would run function hi only once
Do I need a special system for CSData?

and, how can I stop the function to be ran?
 

cleeezzz

The Undead Ranger.
>Do I need a special system for CSData?
not that i know of, unless you dont have newgen?

>and, how can I stop the function to be ran?
stop the timer?
 

T.s.e

Wish I was old and a little sentimental
Sure. Just remember to pause the timer before destroying it, or else it will bug up and continue to run, after what I've heard.

Something like this perhaps?

JASS:
// Structs and such

private function CB takes nothing returns nothing
    local data d = GetCSData(GetExpiredTimer())
    set d.counter = d.counter + 1
    if d.counter < 50 then
       // Do your things, including nulling of handles within this block
    
    else
        call PauseTimer(GetExpiredTimer())
        call DestroyTimer(GetExpiredTimer())
        call d.destroy()
        return
     endif
endfunction

private function Actions takes nothing returns nothing
    local timer t = CreateTimer()
    local data d = data.create()
    set d.counter = 0
    call TimerStart(t, 0.035, true, function CB)
    // Your other actions go here, of course.
    set t = null
endfunction
 

Romek

Super Moderator
Staff member
Use TimerUtils instead of CSData.
 

Romek

Super Moderator
Staff member
TimerUtils has timer recycling.
 

Romek

Super Moderator
Staff member
Obviously CSData won't leak; It's a system which doesn't even create handles... :confused:
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    check out this place apparently it is the best roommate site out there roommates.com lol
  • Varine Varine:
    The homeless people reminded me of New York
  • Varine Varine:
    I'll check it out, my lease expires in like a few months so I need to figure something out.
  • Varine Varine:
    I tried to open a food truck in Sandpoint a few years ago but the city said no, then like two years later they passed new laws to encourage it and gave them all fucking tax breaks and shit. And at that point I didn't have enough money to go buy one so I was way too late to the game once other cities realized they could just bring their existing truck there, or sell their brick and mortar.
  • Varine Varine:
    I do like food trucks though, they're way more fun than restaurants and usually I also get some of that tip money there.
  • Varine Varine:
    Restaurants are really hard if you don't have a back up source of income to fund them sometimes, in my experience most owners either got really really lucky, had existing money that allowed them to buy an already successful one, or they have family money to fall back on for loans. It's few and far between to see very inspiring success stories where the person actually got it through hard work and perseverance. I thought about opening one lots and I always just end up not thinking it'll work. I would much rather just find someone that has that money and go work for them
  • The Helper The Helper:
    i am not talking about opening a brick and mortar I am talking about food trucks though I have seen some brick and mortar mexican places open up during covid that are doing good because there food is awesome!
  • The Helper The Helper:
    Food trucks are killing out here because Bars cannot open unless they sell food and the governor ok'd the use of a food truck in front as serving food
  • The Helper The Helper:
    Just not enough food trucks
  • The Helper The Helper:
    a buddy of mine just opened up a food truck and he is killing it but he is a great cook and has awesome food right in the middle of the pandemic too food trucks are immune to pandemic because they are take out in Texas you will always be able to get take out or delivery
  • The Helper The Helper:
    He is in the different food facebook groups in houston and posts videos of him making his food
  • The Helper The Helper:
    he is killing it
  • jonas jonas:
    @Varine with the restaurants, there surely is a lot of luck and hard work but most restaurants fail because they suck. Flair isn't right, economics not well thought through, food is mediocre or sucks, location is bad, etc. If you're thinking about opening one, make sure you're looking at the stories of those that would be playing at your level, don't let your hopes be dragged down by all the subpar restaurants out there.
  • jonas jonas:
    I'm a bit worried about the future of data science, there's an influx of incompetent people hired by incompetent managers, that can't last. But I'm sure smart data scientists will always be useful and hireable. Same as smart security people.
  • jonas jonas:
    My sister in law worked in a vegan food truck, the owners were also making a killing, added several trucks and opened two restaurants over 5 years
  • Ghan Ghan:
    The CompTIA stuff is pretty much crap unfortunately. The places that ask for those low-level certs aren't likely places you want to work. For IT you really want a degree, but in the meantime you need to figure out some way to learn the skills. Cybersecurity is really hot right now so competition is fierce.
  • tom_mai78101 tom_mai78101:
    I realized I don't have anything much to say, other than "Good luck!". Compared to other places, I'm just very lucky we didn't have a lot of surges of cases coming in.
  • The Helper The Helper:
    My daughter just got back from school at Georgetown TX, outside of Austin and said there were 100 cases in the last week but she also said nobody was wearing a mask anywhere so people mask up and stay safe!
    +2
  • thewrongvine thewrongvine:
    happy thanksgiving folks!
    +1
  • Ralle Ralle:
    PLOOB
  • Varine Varine:
    @Gyah Yeah I figured they aren't particularly valuable, but they'll at the least act as a baseline for some entry level work somewhere.
  • Varine Varine:
    I now see how horribly I spelled @Ghan
  • Varine Varine:
    I had a rough morning
  • The Helper The Helper:
    that field is going to explode and though there is competition there is going to be room for all levels in the coming years imho.
  • tom_mai78101 tom_mai78101:
    Why are we competing for rough mornings? :(

    Members online

    Affiliates

    Hive Workshop
    Top