• 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] The best and faster way...

Status
Not open for further replies.
Level 20
Joined
Jul 6, 2009
Messages
1,885
1. Merge action and condition ==OR== NOT
2. Create constant values ==OR== Create constant functions
3. StringHash ==OR== Just integer
4. OrderId2String ==OR== Just string
5. Structs ==OR==Hashtables

...and more...if anyone reads this, share your thoughts and ask here, maybe the experts will answer...well I know they will :)...
1. Merge; put everything in condition and return false in the end.
2. Constant values
3. The less function calls the better, so integer.
4. Depends...if you're comparing 2 orders, don't use strings at all.
5. It's like comparing indexing and hashtables since structs use arrays. Hashtables are easier to use but slower and vice versa for structs.
 
1. Good
2. I mean when you're trying to setup a configurables, like this...
constant value:
JASS:
local real = 10
OR
constant function:
JASS:
constant function test takes nothing returns real
    return 10.
endfunction


3. Good
4. Not comparing but I mean Ordering, like thunderclap, firebolt, etc...
5. Its hard to use structs, but what do you recommend?...
 
Level 7
Joined
Apr 27, 2011
Messages
272
1. Merge action and condition ==OR== NOT
2. Create constant values ==OR== Create constant functions
3. StringHash ==OR== Just integer
4. OrderId2String ==OR== Just string
5. Structs ==OR==Hashtables

...and more...if anyone reads this, share your thoughts and ask here, maybe the experts will answer...well I know they will :)...

1.Use CONDITIONS since you can use them like actions and they are prioritized 1st

2.abuse the "constant" for variables keyword since calling constant functions are expensive.

3.In my opinion ==> STRINGHASH can help you if you want to label the stuff you store inside a hashtable. But integers are better when it comes to performance stringhash is just for comfort. Anyway if you use StringHash be sure you decrement its result by 8191 (not sure it would help reduce some bytes but its a suicide to make keys less accurate, works for me though).

4.nope. Learn the order's ID and use it instead. Confusing but fast. (you can use comments anyway right :D )

5. I prefer hashtables because you asked about stringhash, but what are structs if you do not use them anyway?
 
Last edited:
Level 20
Joined
Jul 6, 2009
Messages
1,885
@mckill,
Orders are integers, not strings. If you want to know some spell's order ID, just make a debug message with OrderId(order name as string) as parameter.

For structs and hashtables. Structs aren't hard once you get used to them, however, i mostly prefer hashtables since you can attach data directly to handles which you can't do with structs.
 
Level 7
Joined
Apr 27, 2011
Messages
272
@mckill,
Orders are integers, not strings. If you want to know some spell's order ID, just make a debug message with OrderId(order name as string) as parameter.

For structs and hashtables. Structs aren't hard once you get used to them, however, i mostly prefer hashtables since you can attach data directly to handles which you can't do with structs.

Yup Thats true and this might help also:

Order Ids: 852002 to 852007- These are item targeted orders that move the target item to a certain inventory slot of the ordered hero. The id 852002 will move it to slot 1, the id 852003 will move it to slot 2 and so on.

Order Ids: 852008 to 852013 (useslot)- These are orders that will make the ordered hero use the item in a certain inventory slot. If it's an order with no target or object or point targeted depends on the type of item. The id 852008 will use the item in slot 1, the id 852009 will use the item in slot 2 and so on.

source I forgot... but credit goes to the one who discovered it.
 
Status
Not open for further replies.
Top