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
964
Use TimerUtils instead of CSData.
 

Romek

Super Moderator
Reaction score
964
TimerUtils has timer recycling.
 

Romek

Super Moderator
Reaction score
964
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.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      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