Jass Actions x Conditions

Yoww89

New Member
Reaction score
0
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
Reaction score
0
Okay, who uses waits anyway? :p
I don't want to seem rude but how does that answer my question?
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
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
Reaction score
0
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
Reaction score
1,462
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
Reaction score
0
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
Reaction score
1,462
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
Reaction score
110
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.
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/
  • The Helper The Helper:
    Here is another comfort food favorite - Million Dollar Casserole - https://www.thehelper.net/threads/recipe-million-dollar-casserole.193614/

      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