• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] vJass clarifacation

Status
Not open for further replies.
Level 29
Joined
Jul 29, 2007
Messages
5,174
Ok, I read a tut (the only one I found lol) on vJass at thehelper and I couldn't not notice that the only 2 things that seemed to be usefull were the Libararies and Structs.

Now just to clarify if I understood them right:

Libararies basicly allow use to use functions inside the trigger like we normally use them in the map header ?

Structs basicly allow us to create our "own" variables ?


I also couldn't not notice that structs do not completly remove the need of the handle vars but instead make it so that we only need to store all the data at once instead of each variable in a diffrent call.
 

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
543
the code inside th library will moved to the start of the map (under the globals).
struct are a "set" of vars. structs are basicly integer representing an index for an array.
Btw, there more usefull things vJass gives us.

e: why gets a d m i n censored?
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
struct creates arrayed variables...
but they like grouped

ex:
JASS:
struct S
unit u
real r
endstruct

function lol takes nothing returns nothing
local S a = S.create() // create is one of base methods of struct
// "a" is an integer variable here and it represents the array index
// create() acts like "Find a non used integer"
// so everytime you create it returns a non used index for "S"
// when you say a.destroy() it cleans the variables of "a" index and frees that integer for "S" so you can use it again
set a.u = GetTriggerUnit()// "u" is a struct member type of unit as we declared up there
// And "u" variable of "a" struct became Triggering Unit
endfunction

Question: What is the point here that allows us to store structs in timers
Answer: vJass doesnt store anything in timer. Its the Jass Part of it

JASS:
struct S
unit u
endstruct

function SPARTATIMER takes nothing returns nothing
local timer t = GetExpiredTimer()
local S b = GetHandleInt(t,"attach3d")
call KillUnit(b.u)
endfunction

function LALALALA takes nothing returns nothing
local timer t = CreateTimer()
local S a = S.create()
call SetHandleInt(t,"attach3d",a)
set a.u = GetTriggerUnit()
StartTehTim3r(t)
endfunction

Well I used SetHandleInt here but I suggest you to create a global integer variable and
set OMGINTEGER[H2I(t)-0x100000] = a
 
Level 6
Joined
Jun 30, 2006
Messages
230
I also couldn't not notice that structs do not completly remove the need of the handle vars but instead make it so that we only need to store all the data at once instead of each variable in a diffrent call.

Yes, and a big reason structs are so useful is because of this. It is considerably faster than storing each one at a time. While you can use Handle Vars to store this "one call", gamecache's are slow compared to even more arrays. I recommend using Cohadar's ABC to do attaching. It's not really better than other systems (perhaps ever so slightly faster), but I like the feel and style.
 
Level 6
Joined
Jun 30, 2006
Messages
230
ABC sucks

What do you have against ABC? You've said it sucks, but you have NEVER given reasons. I want one good reason, just one. ABC is fast and clean. It's actually cleaner than Vexorian's CSData. I haven't done comparisons on speed, but I believe it's slightly faster as well.

Ghostwolf, don't take anyone's opinion on this. Use it and decide for yourself. That's why I gave you those links, to help you decide.
 
Last edited:

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
543
Ghostwolf, don't take anyone's opinion on this. Use it and decide for yourself. That's why I gave you those links, to help you decide.

That's right.

I use my own system which is faster and saver than abc.
 
Level 6
Joined
Jun 30, 2006
Messages
230
Edit: The server went down while I was editing this, it was meant to be:
I use my own system which is faster and saver than abc.

Prove it. I highly doubt your claim. In fact, I'd go so far as to post your system so I can tear it to pieces. To be 'safer' than Vexorian's Caster System is very, very unlikely, and Cohadar's ABC can support up to 3 collisions (I might add Vexorian's Caster System does not even do this), even though it is unlikely you will ever have 1 collision. I bet you don't even know what collisions are.

Anyways, Ghostwolf, ABC is a TON faster than Handle Vars, it's not even close. CSData is also a lot faster than Handle Vars, so I'd recommend you use one of the two.

The problem with using your own is a standard. Someone else wants your spell, what do they do? They already have to copy the trigger, but then they have to copy your system as well and figure out how to use it. Most likely they already have a system, and $100 says that it will be ABC, Vexorian's Caster System, or Handle Vars, and Handle Vars is very slow.

Also, you can get help easier with spells if you use an existing system. People are really willing to help with a specific trigger, but if they have to learn an entire system first, good luck with that!
 
Last edited:
Level 20
Joined
Apr 22, 2007
Messages
1,960
Blue_Jeans said:
It's actually cleaner than Vexorian's CSData.
If Vexorian's CSData works like Pandamine's HSAS, or grim001's DataSystem, then I'm pretty sure that ABC IS slower than those. The only issue with set Data[H2I(handle)-0x100000] = struct -type systems is that you have to be sure to null all local handles, which isn't much of a problem anyway for two reasons:
  • You should always AVOID non-nulled handle leaks, because they do lag after a while
  • Most of these systems have backup data arrays, so they won't work only if you get to around 30000 null-handle leaks, which is, anyway, REALLY bad for your map.
 
Level 6
Joined
Jun 30, 2006
Messages
230
Cleaner and Faster are different thing in my point of view. I mentioned I wasn't sure which of the systems were faster, ABC or CSData, although I think it is ABC. I haven't ever actually tested them head to head.
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
ABC is long to look super cool
all it does is "OMGINTEGERVARIABLE[H2I(t)-0x10000] = <structvar>"
 

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
543
I tested my system with the new natives (stopwatch).
Im not a spell-maker who presents the spells; im only doing spells for my maps.
I know what collision is- in my test map, my system can handle a collision of 50000 (or so :) ).
 
Status
Not open for further replies.
Top