Need Example of Slide Spell with Structs

emjlr3

Change can be a good thing
Reaction score
395
rofl none of that makes any sense to me grim, is it sorta like vexs? which is what i use, however it looks like urs can have more total
 

grim001

New Member
Reaction score
10
Well you know how you can only attach one integer to something with CSData?

Well imagine declaring 20 copies of CSData, now you can attach 20 different integers with 20 different function names.

Now imagine making it attach some other kind of thing just by changing every instance of the word "integer" to a different type such as "real" or "unit"

Only real purpose now is to attach integers to things to retrieve a struct..
 

emjlr3

Change can be a good thing
Reaction score
395
could you give an example of yours usage grim?

I am more of a visual learner
 

Tom Jones

N/A
Reaction score
437
JASS:
//Imagine that grims system is right above this comment.
//! runtextmacro DS_Declare("Unit","unit")
//Now we're able to store units, by using SetUnit(), and getting them again by using GetUnit().

scope test
globals
    private timer t
endglobals

function Timer_Actions takes nothing returns nothing
    set u = GetUnit(GetExpiringTimer())

    call UnitDamageTarget(u,u,15,false,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHKNOWS)
    set u = null
endfunction

function...
    local unit u = GetTriggerUnit()
    local integer i = GetData(t)

    if i == 0 then
        call TimerStart(t,0.05,true,function Timer_Actions)
    endif
    set i = i+1 
    call SetData(t,i)    
    call SetUnit(t,u)
    set u = null
endfunction
endscope
@Grim.
The system storage is limited to one handle type per handle right?
 

substance

New Member
Reaction score
34
JASS:
struct TimedFade
unit fader
integer alpha = 255
integer interval
integer maxinteger
endstruct
	
function UnitFadeTimedAction takes nothing returns nothing
    local TimedFadeData data = GetData(GetExpiredTimer())
    
	if (data.maxinteger > 0) then
		set data.alpha = data.alpha - R2I(((0.05*data.interval+1)))
		call SetUnitVertexColor(u,data.alpha,data.alpha,data.alpha,data.alpha)
	else
		call ReleaseTimer(t)
	endif
	set data.maxinteger = data.maxinteger - 1
endfunction

function UnitFadeTimed takes unit u, real time, real percent returns nothing
	local timer t = NewTimer()
	local TimedFadeData data = TimedFadeData.create()
	
	if (time == 0) then
		call SetUnitVertexColor(u,255,255,255,0)
		return
	endif
	if (percent > 100) or (percent <= 0) then
		set percent = 100
	endif
	if (percent != 100) then
		set percent = RAbsBJ(percent-100)
	endif
	set data.interval = R2I(((data.alpha/time)+1))
	set data.maxinteger = R2I((((time*(percent/100))/0.05)+1))
	if (data.maxinteger <= 0) then
		return
	endif
	
	call SetData(t, integer(data))
	call TimerStart(t,0.05,true,function UnitFadeTimedAction)
endfunction


A more practical example, imo. However I dont normally attatch to timers.
 

grim001

New Member
Reaction score
10
The system storage is limited to one handle type per handle right?

You could define SetUnit and SetUnit2 and SetUnit3 ad infinitum to attach as many as you wanted, but it makes more sense to just use this to attach integers that point to structs.
 

Tom Jones

N/A
Reaction score
437
You could define SetUnit and SetUnit2 and SetUnit3 ad infinitum to attach as many as you wanted, but it makes more sense to just use this to attach integers that point to structs.
Yes agreed, though if your all ready are using the New Gen editor, or vJass in general, I would say that it's easier to simply declare an integer array and an integer for indexing.
 

grim001

New Member
Reaction score
10
Actually attaching (at least integers) to timers, triggers and units is still needed at times.
 

--Thanatos--

New Member
Reaction score
33
Gah.. So it was supposed to be like this?

JASS:

struct idu
    unit caster
    integer level
endstruct

//and then use this?

function whoa takes nothing returns nothing
    local timer mytimer = GetExpiredTimer()
    local idu mystruct = GetData(mytimer,idu)
endfunction

function TimerStarting takes nothing returns nothing
    local timer Blah = CreateTimer()
    local idu mystruct = idu.create()
    call SetData(Blah,mystruct)
    call TimerStart(Blah,3204239.,false,function whoa)
endfunction


Also... will this be a Handle Stack in the end?
 

substance

New Member
Reaction score
34
You dont have to specificy when using GetData:
JASS:
local idu mystruct = GetData(mytimer)


Also you should typecast the struct/integer:
JASS:
call SetData(Blah,integer(mystruct))
 

grim001

New Member
Reaction score
10
No, it is not a stack. But you could write a stack system and use this to attach an integer pointing to the stack.
 

--Thanatos--

New Member
Reaction score
33
Ok this started to piss me off.
OffTopic: JassNewGen
It worked at last morning, the mockery that says: "Map couldn't be found" and blah. >_> Now it couldn't give me Syntax Checks. And I couldn't test my map with ur DataSystem. (Must disable the trigger, dunno why, if I don't it will only show the Main Menu on the Test).
 
Reaction score
456
You always need to save before testing, if you have done changes in the map, else it will most likely go to main screen.
 

--Thanatos--

New Member
Reaction score
33
I always save. The annoying word "Map Couldn't be found" is the main misery, I couldn't even see the Syntax Errors.
 

--Thanatos--

New Member
Reaction score
33
Bump.

Aw,, come on help me. T_T

EDIT: NVM Found out Jass NewGen cannot check maps with long name. >_>
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Howdy
  • 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 Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top