d is not of a type that allows .syntax

GetTriggerUnit-

DogEntrepreneur
Reaction score
129
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
 

Knight7770

Hippopotomonstrosesquiped aliophobia
Reaction score
187
Shouldn't it be 'data' instead of 'd'?
 

GetTriggerUnit-

DogEntrepreneur
Reaction score
129
Well, I don't know, I'm new of about 2 days to vJass.
Oh and, in the call TimerStart, what does the boolean means?
 

Knight7770

Hippopotomonstrosesquiped aliophobia
Reaction score
187
I don't know any vJass. Try it.
 

cleeezzz

The Undead Ranger.
Reaction score
268
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.
Reaction score
268
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
Reaction score
129
>>>>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.
Reaction score
268
>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?
 

GetTriggerUnit-

DogEntrepreneur
Reaction score
129
Ty
Just another, where can I call it, in which function?
Edit:
In the Callback ,I add this after, lets say 50 excution?
 

T.s.e

Wish I was old and a little sentimental
Reaction score
133
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
Reaction score
963
Use TimerUtils instead of CSData.
 

Romek

Super Moderator
Reaction score
963
TimerUtils has timer recycling.
 

Romek

Super Moderator
Reaction score
963
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.
  • Varine Varine:
    I ordered like five blocks for 15 dollars. They're just little aluminum blocks with holes drilled into them
  • Varine Varine:
    They are pretty much disposable. I have shitty nozzles though, and I don't think these were designed for how hot I've run them
  • Varine Varine:
    I tried to extract it but the thing is pretty stuck. Idk what else I can use this for
  • Varine Varine:
    I'll throw it into my scrap stuff box, I'm sure can be used for something
  • Varine Varine:
    I have spare parts for like, everything BUT that block lol. Oh well, I'll print this shit next week I guess. Hopefully it fits
  • Varine Varine:
    I see that, despite your insistence to the contrary, we are becoming a recipe website
  • Varine Varine:
    Which is unique I guess.
  • The Helper The Helper:
    Actually I was just playing with having some kind of mention of the food forum and recipes on the main page to test and see if it would engage some of those people to post something. It is just weird to get so much traffic and no engagement
  • The Helper The Helper:
    So what it really is me trying to implement some kind of better site navigation not change the whole theme of the site
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air

      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