• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!
deathdoorway
Reaction score
15

Profile posts Latest activity Postings Experience Albums Resources About

  • I think I might write some tutorials, so that way I can just refer you to them
    Ah, terrific :D :D :D :D

    You may be farther in your knowledge than I expected, ok, when you get back from exams, I will post some information about creating triggered effects using JASS, and then using vJASS

    When we get to the vJASS I'll explain some of the most useful features, and I'll go over structs

    After that, I'll go over handles and the various systems people have developed for them
    I'll give you some more examples of declaring strings

    function DeclareMeSomeStrings takes nothing returns nothing
    local string s = "String"
    local string st = "STRING!!!"
    local string hello = "HELLLLOOOOO!!!!"
    local string var = "Don't forget to read my posts bottom to top!"
    endfunction
    Some more examples of declaring locals...

    function BrandNewFunction takes nothing returns nothing
    local integer i
    local integer x
    local unit u //Handle variable
    local group g //Handle variable
    local string s //Strings are special, they create leaks without really leaking
    //don't worry too much about it
    local string MyName = "Herman"
    endfunction

    If you'll notice, you can stick an equals sign next to the name of your variable to assign it to something once it is allocated, this is to make coding easier to read. Also, you may notice what is called a string in the variable 'MyName'

    When you want to use a string, you must have double-quotations on both sides or else the WE might crash!

    With vJASS, it will not crash :D , it will give an error instead
    The most important distinction you must understand when programming in vJASS or JASS is the difference between handle variables and non-handle variables

    I'll go over handles more later, but basically handles are actual objects that exist, and the handle variables simply point to the object, but the variable IS NOT the object. What causes leaks, is when the object is not destroyed. If an object still has variables pointing to it, the object cannot be fully removed

    That is why you must destroy and null certain objects. A few examples of these are unit, group, location, timer, and there are more, but again, when you need to use them you'll be able to learn them
    function ExampleOfLocals takes nothing returns nothing
    local integer MyNameIsi
    endfunction

    This probably looks confusing, but it has three basic parts

    'local' - This part simply lets the processor know that your going to create a local variable

    'integer' - This is where the type of variable is defined, there are many many types of variables in War3, I won't go over all of them, just a few.

    'MyNameIsi' - This is the last part, this is just the name of your variable
    Ok, variables are declared in two ways

    Some variables can be used anywhere in your code, these are called 'globals' (I guess because they can be used anywhere on the globe if your map was a globe?)

    The other variables are called 'locals', these are only used in the function they are called in, if you used GUI alot before, its almost as if the processor creates a brand new variable everytime the function is called

    In vJASS creating globals is very easy, in regular JASS it's a pain in the *ss

    Since we won't be using much of globals just yet, I'll go over declaring local variables...
    I will go over parameters and function return types next time I get on a computer

    I know your probably very anxious to start applying the JASS to your current problems and creations, but you must be very patient, its a whole big process of learning, and it can be very frustrating if you try to apply JASS and you don't fully understand it (yet)
    This is a function to display what calling the other functions look like...

    function CallCustomFunctions takes nothing returns nothing
    call Bob()
    call Frank()
    call WhyDoIHavePeoplesNames()
    call IWantABetterName()
    call Projectile_Child_AwesomeFunction()
    endfunction

    If you'll notice the '()', parantheses are used to denote the parameters the function takes, in out case all these functions do not take parameters, so the brackets (I'll call them brackets for ease) are empty

    If you'll notice, the keyword 'call' is used to let the processor/computer know that you want it to execute a function using the parameters in the brackets
    function Bob takes nothing returns nothing
    endfunction
    function Frank takes nothing returns nothing
    endfunction
    function WhyDoIHavePeoplesNames takes nothing returns nothing
    endfunction
    function IWantABetterName takes nothing returns nothing
    endfunction
    function Projectile_Child_AwesomeFunction takes nothing returns nothing
    endfunction

    These are all just different names you can call your function. Please note, you can't start a function name with a number, and you can't have spaces. You can use underscores, and you can put numbers after the first letter

    Minor syntax rules like that will be easily corrected when using jassnewgen, so you don't need to memorize them, or even know them
    The 'function' part simply lets the computer know you want to create a new custom function

    'the name of the function' is exactly what you'd like your function to be named, it starts one space after the 'function' part

    'takes' must come one space after the name of the function, ALWAYS

    'the parameters the function takes' this we will go over more later, for now we will just use the keyword 'nothing' which tells the computer that you will not pass any parameters when calling the function, again we will go over it in more detail later

    'returns' Another necessary keyword when creating custom functions, this comes one space after the last parameter, in our case one space after 'nothing'

    'the return type of the variable returned' this is also something we will go over later, for now, we use 'nothing'

    So lets create a set of functions [1000 word limit, I will make another post]
    [On a sidenote - I don't always use the JASS tags, if you'd like to use them, simply highlight the text, and click the little button that has a whole bunch of green zeros and ones]
    Ok, so you know what the 'Custom Script' is now

    From there we can start programming

    You say you are familiar with 'call' 'set' and variables...

    I will start with functions and move into calling them and using variables within them

    Every custom JASS function is in this format...

    function ThisIsTheNameOfTheFunction takes nothing returns nothing
    //The code in your function goes here, and, you can use '//' to denote
    //a comment in your code, which is ignored when the computer processes what
    //you have written
    endfunction

    There are 7 significant pieces of information that the computer absolutely needs to create a function

    'function' 'The functions name' 'takes' 'the parameters the function takes' 'returns' 'what variable type the function returns' and finally 'endfunction'

    I wanted to point these all out first before hand in case I don't get to explaining them all
    Sorry I haven't responded, I run out of time very easily, and sometimes the computers I use do not send the messages ><

    What may be of significant help to you is information about handles, but handles are a little advanced in terms of learning JASS / vJASS

    The first thing I can suggest would be to get the jassnewgenpack, which takes care of alot of problems when you are trying to program using JASS

    You can find it on wc3c, just google search jassnewgenpack wc3c and you'll be able to find it.

    If you don't feel like getting that just yet, you don't need it yet, when you learn more you are probably going to want it

    First you will need to locate the custom script, this is in the trigger editor (open the trigger editor), then click on the little scroll at above all the categories. It should be blue if the map has a .w3x extension in its save. If it is a new map, the scroll might be a tan color. If you still can't find it, it should have the map's save name with the extension.

    Once you've selected the custom script, the area where you would normally put GUI functions should be totally empty, and you can type things in there

    Before you save your map, I want you type

    //JASS Goes here

    And nothing else, and then save your map

    After you've done this, let me know and we can move forward from there
  • Loading…
  • Loading…
  • Loading…
  • Loading…
  • Loading…
  • Loading…
Top