Jass Actions x Conditions

Yoww89

New Member
Put everything in the conditions and make the conditions return false (the last line should always be return false).

This is the most efficient and stable way to do things.

Use timers instead of TriggerSleepAction. :)
I just want someone to explain me why would use conditions instead of actions for the whole trigger be better, since conditions returns a boolean and actions return nothing?

Trigger:
- Event
- Conditions
- Actions

If we put all the "actions" code into the conditions, and have the condition then return false, the real Actions (which will be blank) will never be run. Efficient. :)
Wouldn't it be the same the opposite way? If all my code stand in the actions function and I insert no condition function?
 

Yoww89

New Member
Okay, who uses waits anyway? :p
I don't want to seem rude but how does that answer my question?
 

Accname

2D-Graphics enthusiast
I guess he is talking about the overhead when using actions. I dont use Jass, i see no point in using it.
But i can very well imagine that the way the wc3 engine is dealing with triggers might not give a 100% efficiency when calling the actions after checking the conditions and having the trigger only run its conditions and skipping actions entirely could potentially increase the performance slightly.
This is an old conflict in scripting whether to go for performance or readability of the code. Using functions and structs itself is making the script lower then to write the entire programm into one single gigantic block of code but who the hell would be able to understand that?
 

Yoww89

New Member
Wow! You mean you stick to GUI?? That's something I would honestly never expect from someone with that much rep and posts. I'm not saying it's bad though.

Anyway I just can't get what's his point. I mean:

>Option 1: Put your whole code inside the Conditions Function and delete the Actions Function. BUT you'll have to return false at the end of Conditions Function.

>Option 2: Put your whole code inside the Actions Function and delete the Conditions Function. Nothing more.

J4L: Option 1 is more efficient.
o_O WHY?
 

Accname

2D-Graphics enthusiast
Look, wc3 uses a system for ingame triggers.

Those ingame triggers are not like the "real" script of the actual game running in the back.

For each trigger there is a certain system, like a checklist on which it is going through.

It starts with the event. Check.
Goes to the conditions, now, are they all true or false?
False. Check. End from here, nothing more to do.
is it true? Then go on to the actions.
And maybe some other stuff which needs to be done after the actions.

If you put your whole code inside the conditions and always return true there is a very slight win in performance. What you save is all the overhead created when the conditions return true.

You have to remember, even a function with nothing inside is taking performance. Have you ever heard of the GUI action "Do nothing"? That action does actually absolutely nothing and is merely a joke by blizzard. But! it takes performance if you use it! Thats right, even if it does nothing there is a little overhead to scan the function in, analyse what it is supposed to do and tell the system.
This is because of how the CPU of your computer is working and how sub-programms work.

If you do as J4L says you wont really notice any change. I dont think a single frame per second will be won this way because the difference is minimal. But it is there! Just, very very small.

Why i use GUI? because i dont need Jass.
When i use the editor i do stuff i can very well do with GUI.
I dont need incredible performance, my computer and the computers of people who play my maps are good enough for it. I dont need all the "comfort" of Jass script or vJass either. I just dont need it for my maps.
And if i was ever to need a system so complicated, big and game changing that i would depend on using vJass i would just forget about it, take C++ and script my own game from scratch instead of toying around with a joke like the wc3 editor.
In fact, i dont understand those people who use vJass. They put so much effort into it. They are really good at scripting, they even create stuff like EGUI. What the hell? Why?! Create your own games guys, it isnt so hard. Make something better then wc3 instead of wasting your time with this buggy old game.
 

Yoww89

New Member
That was harsh :p

So what you're saying is even if I don't add the triggger conditions function it will still try to check for the return of a nonexistent function??

Like:

<<
function Trig_test_Actions takes nothing returns nothing
endfunction

//===========================================================================
function InitTrig_test takes nothing returns nothing
set gg_trg_test = CreateTrigger( )
(Here's where it was supposed to be added the Condition function)
call TriggerAddAction( gg_trg_test, function Trig_test_Actions )
endfunction
>>

So it won't just trigger on event and go directly to the actions?
 

Accname

2D-Graphics enthusiast
If there are no conditions specified it will probably still need to check for them and this will take performance. If there are no actions specified it will still need to check for them (if the conditions return true) and that will take performance as well.
Again, i just assume this is the way it works because of what you have quoted J4L to have said in his turtorial. He knows alot about it and is very skilled, i do not assume that he is lying and in fact it makes alot of sense to me either.
 

tommerbob

Minecraft. :D
The efficiency you will gain by using only Conditions instead of Actions is miniscule. But, there is still a difference. I also think the code looks cleaner, but that's personal opinion.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Jesus4Lyf Jesus4Lyf:
    Hmm, how to summarize... Moved to the USA and got married. Became a professional software engineer and solution lead. Learning Godot for game dev. :)
  • jonas jonas:
    So you are pursuing game dev as a hobby? What industry is your dayjob in?
  • jonas jonas:
    FAANG?
  • Jesus4Lyf Jesus4Lyf:
    Not quite FAANG, less pay for a less hours/stress. Yeah, game dev as a hobby.
  • jonas jonas:
    makes sense. Do we have a hobby game dev subforum to showcase some work?
  • Blackveiled Blackveiled:
    Happy Thursday
    +1
  • The Helper The Helper:
    Happy Thursday!
  • The Helper The Helper:
    TGIF!
  • The Helper The Helper:
    hey tom_mai please do not archive anymore news
  • Ghan Ghan:
    AMD Ryzen 7000 next week :D
    +1
  • The Helper The Helper:
    noice!
  • tom_mai78101 tom_mai78101:
    "hey tom_mai please do not archive anymore news" ----> Got it. What should we do with the "News Archive" subforum?
  • The Helper The Helper:
    I think leave it for real old news that cannot be sorted the reason we had it in the first place was a server issue that we do not have anymore. I don't want to get rid of the archive just not put anything in it for now until we figure it out more
  • The Helper The Helper:
    The side chat has nothing on the discord. it is not possible but the biggest thing on my wish list right now is a sidechat channel on the disord that hooks up to this...
  • Ghan Ghan:
    I've been selected for the Diablo IV beta.
    +1
  • Ghan Ghan:
    Woo!
    +1
  • The Helper The Helper:
    that is so cool
  • V-SNES V-SNES:
    Eh just noticed the new discord section on the side. Looks great!
    +1
  • Blackveiled Blackveiled:
    :( feels bad I can't ever get selected for any beta I sign up for. It's annoying as heck.
    +1
  • The Helper The Helper:
    Hello mgarcia! Happy Monday everyone!
  • The Helper The Helper:
    Happy Tuesday! :)

    The Helper Discord

    Members online

    Affiliates

    Hive Workshop NUON Dome World Editor Tutorials

    Network Sponsors

    Apex Steel Pipe - Buys and sells Steel Pipe.
    Top