I Want To Learn

hellmonja27

Member
Reaction score
16
i've been using GUI for more or less 2 years now and i think it's 1 of the main factors i'm having trouble learning JASS. So far i've understood the basics but along the way i quit for a while. When i came back all this new stuff are already out: Structs, CSCache, vJASS, the NewGen Pack... i still haven't mastered Kattana's Handles and everyone's saying it's obsolete. So i need help badly. what i would like to know is:

1. Is there ANY other mirror for the NewGen Pack besides the one on dl.dropbox? i still can't download it. and what's the oldest patch version that the Pack can handle?

2. i have emjl3r's tutorial on Structs. But i need more info on it. It seems rather complicated.

3. Do you guys know any good tutorial for vJASS?

4. Does anyone have a good tutorial for Vex's Caster System? the CSCache and all those systems and what not?

5. Is there even hope for me yet?

that's all for now. thank you for any useful leads i can get...

EDIT: I just found Romek's vJASS tutorial. i'll try to read that 1st before asking again...
 

Bribe

vJass errors are legion
Reaction score
67
1. NewGen can be found in many places. You could even get someone here to send it to you (I don't have it atm, so I can't help)

2. Structs...

thistype.allocate() gets a new integer from 1-8190 so you can use it in an array.
this.destroy() puts the integer back so its index can be reused (MUI).

Beyond that, I plan to write a JASS/vJass tutorial to put the stuff in simpler language than existing tutorials.

3. "vJass: Uncomplicating the Complicated" is the most well-written tutorial I know of on this subject.

4. Vex's system is good when you get higher in the understanding of vJass. Those are not simple tools at the moment.

5. Chillax, once you break in to programming vJass, other programming languages seem simple enough as well. Just some features you probably would never use in JASS, vJass and many other programming languages, for that matter.
 

hellmonja27

Member
Reaction score
16
5. Chillax, once you break in to programming vJass, other programming languages seem simple enough as well. Just some features you probably would never use in JASS, vJass and many other programming languages, for that matter.

thanks, that's reassuring. ok so here's where i'm at: i have this old AoS map, bunch of spells all in GUI. i really love this map no matter how much it sucks and i said i'm gonna go all the way this time.

my 1st objective is to make all the spells MUI. since Kattana leaks a lot (like others say) i need (for now) something that would help me avoid more global vars. so would you recommend i concentrate on structs or something entirely different?...
 

Bribe

vJass errors are legion
Reaction score
67
Why are you focusing on removing globals? At this point, you should be focusing on removing unnecessary handles and leaks.
 

hellmonja27

Member
Reaction score
16
i, well, i thought if you want to make a spell MUI you need to remove globals. i have lots of waits and stuff that should be in timers on that map. i kinda get how to avoid leaks but i don't know about unnecessary handles...
 

Laiev

Hey Listen!!
Reaction score
188
1 - NewGen

4 - as Bribe said, Vex resources is a bit hard to understand when you're learning Jass/vJass, also CS should be avoid since it is just to compile old maps
 

luorax

Invasion in Duskwood
Reaction score
67
A better NewGen (in my opinion)

*THIS* is a great tutorial about structs.. also *THIS* can also help you to learn a bit more about structs.

About MUI: the best way to make the spells MUI is using structs with an indexing system (like J4L's AIDS). But if you think MPI is far enough then you can make arrays from the globals, and use the player ids as indexes. That's all.
 

hellmonja27

Member
Reaction score
16
4 - as Bribe said, Vex resources is a bit hard to understand when you're learning Jass/vJass, also CS should be avoid since it is just to compile old maps

well that's good to know. at least it'll lessen the stuff i need to learn for now...:D

A better NewGen (in my opinion)

*THIS* is a great tutorial about structs.. also *THIS* can also help you to learn a bit more about structs.

About MUI: the best way to make the spells MUI is using structs with an indexing system (like J4L's AIDS). But if you think MPI is far enough then you can make arrays from the globals, and use the player ids as indexes. That's all.

hey thanks man! i was wondering if Vex did a manual on vJASS like he did with JASS. saved all of them. this'll be very useful.:thup:

as for making spells MPI, yes it is possible since my map is an AoS (i know, another one) but i'm planning on making a hero that copies other heroes so that might become a problem...
 

Jesus4Lyf

Good Idea™
Reaction score
397
Hm, you want to write spells with structs?
Maybe you need SpellStruct.

Kinda don't need to know anything about structs. Just..
JASS:
struct MySpell extends SpellStruct
    implement SpellStruct
    
    // put your "globals" here. Example:
    //private unit UnitToKillYou

    // put your "functions" here. Example:
    //private method setDistanceToUnit takes unit from, unit to, real dist returns nothing
    //    local real x=GetUnitX(to)-GetUnitX(from)
    //    local real y=GetUnitY(to)-GetUnitY(from)
    //    local real factor=dist/SquareRoot(x*x+y*y)
    //    call SetUnitX(to,GetUnitX(from)+x*factor)
    //    call SetUnitY(to,GetUnitY(from)+y*factor)
    //    // you have access to all your "globals", but it's auto MUI.
    //endmethod

    // Then your event stuff here, see SpellStruct documentation for more information.
    // Example:
    method onEffect takes nothing returns nothing
        // put here what you want your spell to do.
    endmethod
    
    // You need this. Just make sure you set the abil at least.
    private static method onInit takes nothing returns nothing
        set thistype.abil='A000' // change this to whatever abil you're scripting for.
    endmethod
endstruct

It has a built in timer system and stuff too..
 

Bribe

vJass errors are legion
Reaction score
67
Jesus4Lyf, I don't recommend implementing any modules or AIDS textmacros at the top of structs because vJass compiles them all very poorly. Instead of top-sort, which would be logical, the functions get mangled into trigger-evaluations.

JASS:

struct guy
    static method a takes nothing returns nothing
        call b()
    endmethod
    
    static method b takes nothing returns nothing
    endmethod
endstruct


That gets compiled into something like:

JASS:

function a takes nothing returns nothing
    call TriggerEvaluate(s_guy__generated_b_trigger)
endfunction

function b takes nothing returns nothing
endfunction

function s_guy__generated_b takes nothing returns boolean
    return false
endfunction
 

Jesus4Lyf

Good Idea™
Reaction score
397
Jesus4Lyf, I don't recommend implementing any modules or AIDS textmacros at the top of structs because vJass compiles them all very poorly. Instead of top-sort, which would be logical, the functions get mangled into trigger-evaluations.
SpellStruct works around function pointers, so I believe it's not the case. The module does not call anything, it saves the event response functions to a hashtable. :)
 

Bribe

vJass errors are legion
Reaction score
67
JASS:

    method onEffect takes nothing returns nothing
        // put here what you want your spell to do.
    endmethod


That will be be called via TriggerEvaluate, same with AIDS_onCreate, AIDS_onDestroy, etc.
 

Jesus4Lyf

Good Idea™
Reaction score
397
JASS:

    method onEffect takes nothing returns nothing
        // put here what you want your spell to do.
    endmethod


That will be be called via TriggerEvaluate, same with AIDS_onCreate, AIDS_onDestroy, etc.
Actually, my bad, it's not function pointer based... it uses interfaces. AIDS uses a delegate to make things optional. This isn't possible with SpellStruct because there's something broken in JassHelper between delegates and inheritance, off memory, and SpellStruct uses the same underlying arrays for default SpellStruct members (rather than duplicating them for each module implementation). In short, it wouldn't be possible to make the event response methods optional using both inheritance and TriggerEvaluate.

I think that's how it went... :confused:

Any more on this needs to be posted in the SpellStruct thread, as any continuation is a horrible thread-jack, really. :p
 

hellmonja27

Member
Reaction score
16
spell struct looks cool but i still want to learn how to make and use structs in case i need to customize of something. either way i saved your spell struct, i bet it'll come in handy. thanks!...
 

tooltiperror

Super Moderator
Reaction score
231
Here, learn first by learning what a struct, really is.

JASS:

struct Person
endstruct

function foo ...
    local Person fooperson = Person.create()
endfunction


That creates a new person named "fooperson".

You can also set variables for each person.

JASS:

struct Person
    integer age
endstruct

function foo ...
    local Person fooperson = person.create()
    set fooperson.age=24
    call BJDebugMsg(I2S(fooperson.age)) //BJDebugMsg takes a string, I2S changes an integer into a string
endfunction


This has tremendous use for things like spells.
 

hellmonja27

Member
Reaction score
16
Here, learn first by learning what a struct, really is.

JASS:

struct Person
endstruct

function foo ...
    local Person fooperson = Person.create()
endfunction


That creates a new person named "fooperson".

You can also set variables for each person.

JASS:

struct Person
    integer age
endstruct

function foo ...
    local Person fooperson = person.create()
    set fooperson.age=24
    call BJDebugMsg(I2S(fooperson.age)) //BJDebugMsg takes a string, I2S changes an integer into a string
endfunction


This has tremendous use for things like spells.

JASS:
struct Person

ok so the struct's name is Person?

JASS:
local Person fooperson = person.create()

shouldn't it be "local unit fooperson?" or isn't this an actual syntax? sorry, it's just that i haven't had my hands on vJASS and i don't what are the new syntax there.
JASS:

call BJDebugMsg(I2S(fooperson.age)) //BJDebugMsg takes a string, I2S changes an integer into a string


this really confuses me. why does it need to take a string? does it do that so the "struct function" can use it?...
 

Bribe

vJass errors are legion
Reaction score
67
JASS:
BJDebugMsg("Hello, world")


Obviously takes a string. If that is too much, you shouldn't be looking into structs at this level.
 

saw792

Is known to say things. That is all.
Reaction score
280
JASS:
struct Person
...
endstruct

Declares a new struct called 'Person'. Think of a Person as a new type, meaning you can declare Person variables:
JASS:
local Person fooperson = Person.create()

Declares a new variable of type Person named fooperson, and assigns it to a newly created Person (an "instance" of Person).
JASS:
struct Person
    integer age
endstruct
This time, the Person struct contains some other data, the age of the person (an integer). This operates in a similar way to the structure of the primitive unit data type. Units have a whole bunch of data associated to them such as x and y position, type id, model, etc. Similarly, our new data type called Person has it's age associated to it. Every new (instance of) Person will have a unique age.
JASS:
local Person fooperson = Person.create()
local Person barperson = Person.create()
set fooperson.age = 12
set barperson.age = 90
call BJDebugMsg(I2S(fooperson.age))
call BJDebugMsg(I2S(barperson.age))
This time we are declaring two different Person variables, and assigning them to two different (instances of) 'Persons'. Each time you call Person.create() it gives back a unique Person, so even though the two declarations look the same they actually assign different values to the two Person variables.

Next we set the age of the first person to be 12. Then we set the age of the second person to be 90. Finally we print a message onto the screen telling us what the age of fooperson and barperson are. This will print '12', and then '90', showing us that the age attribute is unique to each Person (just like in real life :O).

BJDebugMsg is a blizzard-provided function that makes a message (in the form of a string) appear on the screen. I2S is a function that converts an integer into it's string equivalent. A Person's age is an integer, so it needs to be converted to a string before BJDebugMsg can display it properly.
JASS:
call BJDebugMsg(fooperson.age)
This will cause a syntax error, as BJDebugMsg doesn't know how to make an integer appear on the screen, it can only handle strings. This is what tooltiperror means when he says that BJDebugMsg "takes" a string as an argument.

EDIT: Bribe, don't say things like that unless you are going to attempt to explain. You just discourage people that way.
 

hellmonja27

Member
Reaction score
16
ok i get it now. BJDebugMsg is just used to verify if each age is assigned to each unit. i thought it was some obscure code specifically used for structs.
EDIT: Bribe, don't say things like that unless you are going to attempt to explain. You just discourage people that way.
nah, that's ok Saw. Bribe has helped alot lately. i think what Bribe is saying is i should learn more basic stuff 1st before moving to structs since i'm not familiar with the BJDebugMsg function. honestly it's the 1st time i've encountered it...
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top