JASS 101 Classroom

Status
Not open for further replies.

Hero

─║╣ero─
Reaction score
250
IKK....you do know you can't bold in JASS text...phyr hard coded it like that
 

Omni

Ultra Cool Member
Reaction score
37
thanks for teaching, jou're doing very well but watch out for things like this:
>....nLoc(GetTriggerUnit [ b],[/ b] GetRectCenter(G....
see the " [ b],[/ b] " it confused me very much i thought it was JASS.....
dont do that ever again.

Edit : like hero said =P
 

Omni

Ultra Cool Member
Reaction score
37
(i seem to like this very much)
but for the question i need to get awnsered:
in GUI like you said you usually get BJs
in JASSCraft you use (most of the time like you said) natives
so,
will triggers that i make in JASSCraft be faster than triggers in GUI?
(again:"like you said" BJs are slower than natives(most of the time like you said))

like you said<3

*going to make homework*
 
I

IKilledKEnny

Guest
When coverting GUI to JASS you get the GUI version of the function. Sometimes it's a native, however usually in order to make it clearer for GUIer blizzard made new, simpler functions, but they are slower. However JASS gives you natives and BJs, you can tell what BJs are simply by looking if there is a native or not when clicking on the function name in JASSCraft.

To sum it up:

Coverting GUI triggers usually will result BJs, which calls natives, which means you call at least 2 functions instead of one, and each function call takes time and slows the trigger. However if you know how to use JASSCraft you could find easily natives which are better and faster.
 

elmstfreddie

The Finglonger
Reaction score
203
I thought I had JASSCraft, apparently I have JASS Editor... So I'll go get JASSCraft...
I'll send you my homework soon (I read this a couple of hours ago but before I did my homework I played Soldier Front with some friends xD)

Edit > K I don't like JASSCraft lol
Back to JASS Editor...

Edit > Found the thing in JASSCraft, but it isn't there in JASS Editor!!!
... BACK TO JASSCRAFT >.<

Edit > So where can I find a list of what abilities are?
Wait, nvm, I guess I should just open the object editor eh?

Edit > Does... AHbz sound right?


... K wtf. I suck at this.


... I'm going to play some Soldier Front.
 

chovynz

We are all noobs! in different states of Noobism!
Reaction score
130
Hehe, that's a good start Elm. :) lol You're funny.
IKK, good lesson. Even though English isn't your first language (and it shows sometimes), you explain things which are complicated, quite well. Good Job!
inf.gif


Question: Do you want us to disable the Blizzard spell for Player 3 or one of Player 3's Heros?
 
I

IKilledKEnny

Guest
Thanks Chovynz for kind comments, yes English is not my first language, I hope my mistakes are not too awful, "Word" (the software I'm using) should fix any point any big mistakes.

As for your question, you need to disable the spell Blizzard to a player, not to the single unit. After that set his wood and gold to 500 and display a massage to all players. After that add comments around the function saying what each line does.

Elmstfreddie, 'AHbz' is an integer (well it will be converted into an integer when the function will run), JASS referes to spells (units, buffs, almost everything just to make our lives hard, etc.) as integers, so yes, 'AHbz' is a spell in JASS (Yes it's "Blizzard").
 

elmstfreddie

The Finglonger
Reaction score
203
Thing is, JASSCraft is telling me...
Code:
native SetPlayerAbilityAvailable        takes player whichPlayer, integer abilid, boolean avail returns nothing

So I thought I'd type...

Code:
native SetPlayerAbilityAvailable        takes player(2), integer abilid (I tried some things didn't know what actually worked, because the errors it gave me didn't help me what so ever), boolean avail (boolean avail?! WTF?!) returns nothing

For starters, is that the correct one to use?

(btw, I just copied it from JASSCraft right now, I made without the big space =/)

Oh yes, the error. Statement outside of function
 

DrinkSlurm

Eat Bachelor Chow!
Reaction score
50
I just wanted to double-check. Jasscraft version 1.1.3 is the latest version and the one we should be using, right?
 
I

IKilledKEnny

Guest
It seems like I haven't explained it properly (I'll update the lesson soon with another example). Let's take move unit instantly command (I use it all the time becuase it's simple yet can answer many questions). Look it up in JASSCraft what do you get?

JASS:
native SetUnitPositionLoc  takes unit whichUnit, location whichLocation returns nothing


so let's go over it. native means only that is native, ignore that. SetUnitPositionLoc is the name of the command. From now on it's arguments so, so far it should look like this:



The call is to run the command, and "SetUnitPositionLoc" is the name, now the arguments. It takes a unit and a location, right? So:

JASS:
 call SetUnitPositionLoc(someunit,somelocation)
 

chovynz

We are all noobs! in different states of Noobism!
Reaction score
130
I've looked in JassCraft and tried to search for some of the commands that you want us to use. But I don't know what they look like and some of them are not intutive enough for me to guess. So I opened WE and did the GUI conversion to find out what the commands are. I'm going through now and replacing the BJ's. I hope that's all right?

Eventually I want to be able to build functions without GUI. I was going to just use it for the InitTrig_TheTriggerWeAreMaking down the bottom, but the other commands were beyond me as well. :)

Question: In this case..should I use:
JASS:
call DisplayTextToForce( GetPlayersAll(), &quot;This is a function for Player 3 (Teal)&quot; )

or this?:
JASS:
    if (IsPlayerInForce(GetLocalPlayer(), bj_FORCE_ALL_PLAYERS)) then
        // Use only local code (no net traffic) within this block to avoid desyncs.

        call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, &quot;This is a function for Player 3 (Teal)&quot;)
    endif


The first is easier to use, but the second makes it one less function call. So which one do we use?
 
I

IKilledKEnny

Guest
> I just wanted to double-check. Jasscraft version 1.1.3 is the latest version and the one we should be using, right?

As far as I know, yes, this is the version I'm using. Any update should be noted in the link I gave in the 2ed lesson.

> Chovynz

The first function is better. The second one is doing somthing which is odd, it checks if a local player (usually used to show somthing only to one player, however showing massage is by default showed only to the picked player) is inside a force, and if it is then it shows him the chat massage, however no reason to do that.

So the first one shows a massage to all players in force, while the second one is doing it in a longer way that should result showing a private action, however showing chat massage is private already, thus it is useless.
 

chovynz

We are all noobs! in different states of Noobism!
Reaction score
130
The second one is what is called by DisplayTextToForce.

Copied from Jasscraft:
JASS:
function DisplayTextToForce takes force toForce, string message returns nothing
    if (IsPlayerInForce(GetLocalPlayer(), toForce)) then
        // Use only local code (no net traffic) within this block to avoid desyncs.

        call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, message)
    endif
endfunction


So this is a BJ right? One of those ones that make it easier for people to use, but still a BJ. So if we want to speed up (optimize) the trigger, shouldn't we make it one less function call? (as an example)
 
I

IKilledKEnny

Guest
Whatever it is, from my understanding it does the same thing, but it's simply not native (no "native" appears before the function). Even if it doesn't do the same thing use "DisplayTextToForce" because that is what requested in the assignment.
 

chovynz

We are all noobs! in different states of Noobism!
Reaction score
130
Whatever it is, from my understanding it does the same thing, but it's simply not native (no "native" appears before the function). Even if it doesn't do the same thing use "DisplayTextToForce" because that is what requested in the assignment.

ok. :)
 

Slywolf15

Member
Reaction score
5
Ok I am using JASS Craft right now. Now when disabling blizzard for player 2 am I supposed to use brackets? I was just a bit confused since I was kinda looking at how it is done on the bottom of jass craft. Anyway this is what I have so far.

Code:
function Trig_Assignment_2 Actions takes nothing returns nothing
  call SetPlayerAbilityAvailable takes player Player(2), integer AHbz, boolean false returns nothing
endfunction
 
I

IKilledKEnny

Guest
After the word "takes" you put the values in brackets and seperate them with a comma (",").

I updated the last JASSCraft and commands chapter with an example and a challenge, so whoever is having a hard time understanding it go on and read my update.
 

elmstfreddie

The Finglonger
Reaction score
203
Sorry if I wrote native, I just quickly opened JASSCraft and copied and pasted lol

I'm pretty sure I had call there, maybe not though =/

Edit > I'm a miracle worker. I only get 1 error now! (lol)
Edit > OK, almost got it. I need to know how to declare that AHbz is an ability, and not anything else. Should I write...
Can't think of anything. Like, maybe, GetAbility"AHbz" (I made that up, it's wrong, I know lol)
 

chovynz

We are all noobs! in different states of Noobism!
Reaction score
130
Sorry if I wrote native, I just quickly opened JASSCraft and copied and pasted lol

I'm pretty sure I had call there, maybe not though =/

Edit > I'm a miracle worker. I only get 1 error now! (lol)
Edit > OK, almost got it. I need to know how to declare that AHbz is an ability, and not anything else. Should I write...
Can't think of anything. Like, maybe, GetAbility"AHbz" (I made that up, it's wrong, I know lol)

'AHbz'
 
Status
Not open for further replies.
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top