• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] Efficiency Question

Status
Not open for further replies.
Level 8
Joined
Jul 23, 2005
Messages
329
I would like to know whether the following system is efficient, and, if it isn't, how it could be improved:

We've got this triggered ball moving about, and need it to have certain actions that can be defined at the start of the level. When it hits something, it needs to execute a certain predetermined action. However, instead of hard-coding what actions happen when, we've decided to have it execute a trigger, and have that trigger be added and removed actions dynamically. This way, we can easily add and remove actions, and have the conditions coded as an if-else statement within the action.

Would this be efficient, or just a waste of time? If you need clarifications, let me know.
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
JASS:
function interface testFunctionInterface takes integer i, real r returns nothing

function myFunction takes integer joe, real bob returns nothing
endfunction

function mySecondFunction takes nothing returns nothing
endfunction

function test takes nothing returns nothing
    local testFunctionInterface fint = testFunctionInterface.myFunction //works
    local testFunctionInterface fint2 = testFunctionInterface.mySecondFunction //invalid

    call fint.execute(5,4.) //Threads, slower, can sleep, and does not return.
    call fint.evaluate(5,4.) //Does not thread, faster, cannot sleep, and returns.
endfunction
 
Status
Not open for further replies.
Top