Tutorial vJASS Resources for GUI users

Reaction score
341
vJASS Resources for GUI users
TriggerHappy187

Prelude

Many GUI users tend to ask for systems, spells, snippets or any resource made via triggers.

Now many of these resources have already been made, but they were created in vJASS. GUI'ers they to think 'I don't know vJASS so I can't use this'. That is totally wrong.

If you are one of these people who don't know vJASS but think you need to in order to be able to use a lot of systems written in it, then this tutorial is for you.

Before we get started, I want to clarify that there are systems written in vJASS made specifically for people who use vJASS. Things like custom events for example.

Requirements/Importing

When you see a vJASS resource there are generally requirements.

One requirement is always the same, you need to download Jass New Gen Pack.

It contains a tool called JassHelper which parses vJASS so it's required.

Next it may require external systems. Your going to need to copy those systems into your map. Once all that is done you can copy the script into your map.

This part is important, whenever you have vJASS in your map you must save before you test it (every time).


Configuring

The last part is configuring the code to fit your needs. Any good vJASS resource will contain a globals block. You will be able to edit the values in that block to fit your needs.

Below is an example system. It allows a player to type -kick # and a player will be kicked.

JASS:
library Kick initializer onInit

    globals
        private constant string KICK_STRING = "-kick " // the kick string
        private constant boolean SHOW_SCORE_SCREEN = true // Show score screen for player?
        private constant player HOST = Player(0) // player 1 is player 0 in jass
    endglobals
    
    private function Actions takes nothing returns boolean
        local string s = GetEventPlayerChatString()
        local player p = Player(S2I(SubString(s, StringLength(KICK_STRING), StringLength(s)))+1)
        if p != null then
            if GetLocalPlayer() == p then
                call EndGame(SHOW_SCORE_SCREEN)
            endif
        endif
        return false
    endfunction
    
    private function onInit takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterPlayerChatEvent(t, HOST, KICK_STRING, false)
        call TriggerAddCondition(t, Condition(function Actions))
    endfunction
    
endlibrary


Looks confusing, don't it? Well it's not, the only part you need to worry about is this;

JASS:
//
    globals
        private constant string KICK_STRING = "-kick " // the kick string
        private constant boolean SHOW_SCORE_SCREEN = true // Show score screen for player?
        private constant player HOST = Player(0) // player 1 is player 0 in jass
    endglobals


As of now if the HOST (Player 1) types -kick # then a player will be removed from the game. Now what if you wanted the keyword to be -boot #?

Easy, just change
JASS:
private constant string KICK_STRING = "-kick " // the kick string
to
JASS:
private constant string KICK_STRING = "-boot " // the kick string


You usually only need to modify anything after the equal sign.

The same goes for the rest of the configurables, usually there will be a comment next to them explaining what they do.

Once you have modified everything to your needs, save the map and your system should work.
 

RaiJin

New Member
Reaction score
40
good job triggerhappy this will definetly help a lot of people with kicking, seeing them ask for it a lot aswell +rep:thup:
 
Reaction score
341
this will definetly help a lot of people with kicking

Well the kicking snippet was just an example. I wrote it in like three minutes for this tutorial.

The same rules apply for most other systems.
 

RaiJin

New Member
Reaction score
40
Well the kicking snippet was just an example. I wrote it in like three minutes for this tutorial.

The same rules apply for most other systems.

it is but i still think they will juts use the kick system instead lol :p
 

Jesus4Lyf

Good Idea™
Reaction score
397
It could be a useful example! Let's not teach newbies how to import a crappy kicking system when we can teach them how to import something really good, ey? :)

Also good to teach them to use real resources, not random junk. An example that was specifically written for this tutorial seems illogical anyway, considering the nature of the topic. "Here's what I wrote to fit my tutorial." o.o
 

Romek

Super Moderator
Reaction score
963
Most, if not all systems include importing instructions which can be followed by GUIers.
This is pretty useless.

It's not difficult to read all the comments and stuff at the top of the script to see what should/could be changed.
 

Igor_Z

You can change this now in User CP.
Reaction score
61
This tuturial is exacly for me. I'm one of those GUI'ers. But with your explanation i think this trigger is soo simple... Why not teach us GUI'ers something that we can't do in GUI but we can do easily in JASS?
 
Reaction score
341
Listen, my point is I have seen countless people request things but they say 'no vJASS I don't know it'.

I'm just getting sick of people thinking that way so I wrote this. There are people that think that way and won't even touch vJASS resources.
 

Igor_Z

You can change this now in User CP.
Reaction score
61
Yes you are right... I think I am doing that sometimes. But why when i have GUI? I will look @ a code that i don't know and i don't want to learn it. GUI is just easier. You can't change that for me ;). Thanks for posting that... JASS would be easier for me if people explain things like you did... After each line = explanation...
I need to ask you something... Are you writing that text yourself? If you write it and forget to type 1 space will it malfuntion :p?
 

Jesus4Lyf

Good Idea™
Reaction score
397
>If you write it and forget to type 1 space will it malfuntion :p?
When you save the map it will give you an error (that's the syntax checker).

Although I one did it without a syntax checker, in which case the map simply fails to load. I once forgot a "then" after an if. I learned it the hard way. :(

Edit:
An example that was specifically written for this tutorial seems illogical anyway, considering the nature of the topic. "Here's what I wrote to fit my tutorial."
Graveyarded.

This should demonstrate how to implement a real system, not a system written for the sake of this tutorial. The example used doesn't even expose any JASS functions, and so this doesn't appear to be useful beyond the implementation instructions of the vJass system itself.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top