• 🏆 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!

[JASS] Help

Status
Not open for further replies.
Level 2
Joined
Jun 25, 2005
Messages
23
Are you sure you've set udg_Unit?

Anyways...

Why do you use locations? You can just as easily

call IssuePointOrder(udg_Unit[i],"move",x,y), for example

Oh, by the way, you don't need ==true, except in VERY certain cases (in boolexprs with IsUnitType)


Very sure...


EDIT: Problem solved, stupid mistake of mine.
EDIT: No I cant use '=' knowing it's a boolean, otherwise I get an error, saying "you idiot, change it to ==."
 
Level 2
Joined
Jun 25, 2005
Messages
23
No, what I mean is that

==true is redundant, since the if-statement is checking compared to true anyways.

Would you write if true == true then?

No, you would write if true then

I don't get it...

Can you please put example of what do I do, and what would you change it to?
Because on my script I used boolean variables with arrays, by what you are saying, I could just say... Ex.

If udg_Up[i] then

Don't think that would work.

Here is what I would do.

If udg_Up[i] == true then

Goahead and throw yours in to show me how I could optimize my script more.
 
Level 2
Joined
Apr 20, 2006
Messages
22
Yeah, it's quite easy to understand actually. Whatever you write between the "if" and the "then" will always be boolean; it's either true or it is false (or it's wrong and will cause an error =p). If it's true, it will go into the "then" part of the structure, and if it's false it will go into the "else" part.

To clarify:
JASS:
function Decisional takes nothing returns nothing
    local integer a = GetRandomInt(1, 10)
    if a > 5 then
        call WhateverTheHell(i, want)
    else    
        call SomethingElse(i, "might", want)
    endif
endfunction


Let's say it will random 7 for our integer a, so it will make:
JASS:
if 7>5 then


Obviously, 7 is greater then 5, which makes this statement true and thus will go on to the "then" part of the structure.

Now if you would compare this to what you said you would do, you'd basicly write this:
JASS:
if (7>5)==true then

That might look weird, because you don't use the ==true with integers probably, but it's just to give you an idea. It already checks if the statement is true or false, you don't have to check that yourself with the ==true.

I hope that clarifies it a bit ^^".
 
Status
Not open for further replies.
Top