• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[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