[Log in / Register]
| News | Chat | Pastebin | Donations | Tutorials | Rules | Forums |
| Maps | Skins | Icons | Models | Spells | Tools | Jass | Packs | Hosted Projects | Starcraft II Modding | Starcraft II Resources | Galaxy Wiki |
(Keeps Hive Alive)
Go Back   The Hive Workshop > Warcraft III Modding > JASS Resources


JASS Resources Find JASS code snippets and functions here or write your own and post it on the Submissions sub-forum.

Reply
 
Thread Tools
Old 08-11-2011, 03:59 PM   #31 (permalink)
Forum Moderator Magtheridon96
JESUS MAN
 
Magtheridon96's Avatar
Resource Moderator
 
Join Date: Dec 2008
Posts: 5,700
Magtheridon96 has a brilliant future (1812)
Merit Badge - Level 0: This user has proven to be extremely valuable to the Warcraft III Modding Community. 
Quote:
Updated. Originally the assumption was hashtables are 2x slower than arrays and
arrays were faster than math, which later research busted both myths.
So hashtables are now.. 1.6x slower than arrays?
__________________
Magtheridon96 is offline   Reply With Quote
Old 08-11-2011, 04:31 PM   #32 (permalink)
Forum Moderator Bribe
Keep it simple
 
Bribe's Avatar
Spells, Help Zones & JASS Moderator
 
Join Date: Sep 2009
Posts: 5,581
Bribe has much of which to be proud (1209)Bribe has much of which to be proud (1209)
PayPal Donor: This user has donated to The Hive. 
Quite the opposite. More like 4-8 times slower on average.
__________________
How to post your triggers on the Hive Workshop.
JPAG - Bettering the cause of readable source code.

Bribe is offline   Reply With Quote
Old 09-20-2011, 05:09 PM   #33 (permalink)
Registered User Nestharus
User
 
Nestharus's Avatar
 
Join Date: Jul 2007
Posts: 4,912
Nestharus has disabled reputation
Updated with logical error fix
Jass:
library Ascii
///////////////////////////////////////////////////////////////////
//      function Char2Ascii takes string s returns integer
//          integer ascii = Char2Ascii("F")
//
//      function Ascii2Char takes integer a returns string
//          string char = Ascii2Char('F')
//
//      function A2S takes integer a returns string
//          string rawcode = A2S('CODE')
//
//      function S2A takes string s returns integer
//          integer rawcode = S2A("CODE")
//
///////////////////////////////////////////////////////////////////
    globals
        private integer array i //hash
        private string array c  //char
    endglobals
    function Char2Ascii takes string s returns integer
        local integer a
        if ("\\"==s) then
            return 92
        endif
        set a=i[StringHash(s)/0x1F0748+0x3EA]
        if (s!=c[a]) then
            debug if (0==a) then
                debug call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,"ASCII ERROR: INVALID CHARACTER")
                debug return 0
            debug endif
            return a+32
        endif
        return a
    endfunction
    function Ascii2Char takes integer a returns string
        return c[a]
    endfunction
    function A2S takes integer a returns string
        local string s=""
        loop
            set s=c[a-a/256*256]+s
            set a=a/256
            exitwhen 0==a
        endloop
        return s
    endfunction
    function S2A takes string s returns integer
        local integer a=0
        local integer l=StringLength(s)
        local integer j=0
        local string m
        local integer h
        loop
            exitwhen j==l
            set m=SubString(s,j,j+1)
            if ("\\"==m) then
                set a=a*256+92
            else
                set h=i[StringHash(m)/0x1F0748+0x3EA]
                if (m!=c[h]) then
                    debug if (0==h) then
                        debug call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,"ASCII ERROR: INVALID CHARACTER")
                        debug return 0
                    debug endif
                    set a=a*256+h+32
                else
                    set a=a*256+h
                endif
            endif
            set j=j+1
        endloop
        return a
    endfunction
    private module Init
        private static method onInit takes nothing returns nothing
            set i[931]=8
            set i[1075]=9
            set i[1586]=10
            set i[1340]=12
            set i[412]=13
            set i[198]=32
            set i[1979]=33
            set i[1313]=34
            set i[1003]=35
            set i[1264]=36
            set i[983]=37
            set i[1277]=38
            set i[306]=39
            set i[904]=40
            set i[934]=41
            set i[917]=42
            set i[1972]=43
            set i[1380]=44
            set i[1985]=45
            set i[869]=46
            set i[1906]=47
            set i[883]=48
            set i[1558]=49
            set i[684]=50
            set i[582]=51
            set i[668]=52
            set i[538]=53
            set i[672]=54
            set i[1173]=55
            set i[71]=56
            set i[277]=57
            set i[89]=58
            set i[1141]=59
            set i[39]=60
            set i[1171]=61
            set i[51]=62
            set i[305]=63
            set i[0]=64
            set i[222]=65
            set i[178]=66
            set i[236] =67
            set i[184]=68
            set i[1295]=69
            set i[1390]=70
            set i[1276]=71
            set i[203]=72
            set i[1314]=73
            set i[209]=74
            set i[1315]=75
            set i[170]=76
            set i[1357]=77
            set i[1343]=78
            set i[1397]=79
            set i[1420]=80
            set i[1419]=81
            set i[1396]=82
            set i[1374]=83
            set i[1407]=84
            set i[499]=85
            set i[1465]=86
            set i[736]=87
            set i[289]=88
            set i[986]=89
            set i[38]=90
            set i[1230]=91
            set i[1636]=93
            set i[1416]=94
            set i[1917]=95
            set i[217]=96
            set i[833]=123
            set i[1219]=124
            set i[553]=125
            set i[58]=126
            set c[8]="\b"
            set c[9]="\t"
            set c[10]="\n"
            set c[12]="\f"
            set c[13]="\r"
            set c[32]=" "
            set c[33]="!"
            set c[34]="\""
            set c[35]="#"
            set c[36]="$"
            set c[37]="%"
            set c[38]="&"
            set c[39]="'"
            set c[40]="("
            set c[41]=")"
            set c[42]="*"
            set c[43]="+"
            set c[44]=","
            set c[45]="-"
            set c[46]="."
            set c[47]="/"
            set c[48]="0"
            set c[49]="1"
            set c[50]="2"
            set c[51]="3"
            set c[52]="4"
            set c[53]="5"
            set c[54]="6"
            set c[55]="7"
            set c[56]="8"
            set c[57]="9"
            set c[58]=":"
            set c[59]=";"
            set c[60]="<"
            set c[61]="="
            set c[62]=">"
            set c[63]="?"
            set c[64]="@"
            set c[65]="A"
            set c[66]="B"
            set c[67]="C"
            set c[68]="D"
            set c[69]="E"
            set c[70]="F"
            set c[71]="G"
            set c[72]="H"
            set c[73]="I"
            set c[74]="J"
            set c[75]="K"
            set c[76]="L"
            set c[77]="M"
            set c[78]="N"
            set c[79]="O"
            set c[80]="P"
            set c[81]="Q"
            set c[82]="R"
            set c[83]="S"
            set c[84]="T"
            set c[85]="U"
            set c[86]="V"
            set c[87]="W"
            set c[88]="X"
            set c[89]="Y"
            set c[90]="Z"
            set c[92]="\\"
            set c[97]="a"
            set c[98]="b"
            set c[99]="c"
            set c[100]="d"
            set c[101]="e"
            set c[102]="f"
            set c[103]="g"
            set c[104]="h"
            set c[105]="i"
            set c[106]="j"
            set c[107]="k"
            set c[108]="l"
            set c[109]="m"
            set c[110]="n"
            set c[111]="o"
            set c[112]="p"
            set c[113]="q"
            set c[114]="r"
            set c[115]="s"
            set c[116]="t"
            set c[117]="u"
            set c[118]="v"
            set c[119]="w"
            set c[120]="x"
            set c[121]="y"
            set c[122]="z"
            set c[91]="["
            set c[93]="]"
            set c[94]="^"
            set c[95]="_"
            set c[96]="`"
            set c[123]="{"
            set c[124]="|"
            set c[125]="}"
            set c[126]="~"
        endmethod
    endmodule
    private struct Inits extends array
        implement Init
    endstruct
endlibrary
Nestharus is online now   Reply With Quote
Old 09-20-2011, 06:24 PM   #34 (permalink)
Forum Moderator Bribe
Keep it simple
 
Bribe's Avatar
Spells, Help Zones & JASS Moderator
 
Join Date: Sep 2009
Posts: 5,581
Bribe has much of which to be proud (1209)Bribe has much of which to be proud (1209)
PayPal Donor: This user has donated to The Hive. 
Updating in a sec.

What is the logic error fix?

Edit: Can't update!! Same error as with updating spells section!!
__________________
How to post your triggers on the Hive Workshop.
JPAG - Bettering the cause of readable source code.

Bribe is offline   Reply With Quote
Old 09-20-2011, 07:03 PM   #35 (permalink)
Forum Moderator Magtheridon96
JESUS MAN
 
Magtheridon96's Avatar
Resource Moderator
 
Join Date: Dec 2008
Posts: 5,700
Magtheridon96 has a brilliant future (1812)
Merit Badge - Level 0: This user has proven to be extremely valuable to the Warcraft III Modding Community. 
Try creating a new thread.
__________________
Magtheridon96 is offline   Reply With Quote
Old 09-21-2011, 06:45 AM   #36 (permalink)
Forum Moderator Bribe
Keep it simple
 
Bribe's Avatar
Spells, Help Zones & JASS Moderator
 
Join Date: Sep 2009
Posts: 5,581
Bribe has much of which to be proud (1209)Bribe has much of which to be proud (1209)
PayPal Donor: This user has donated to The Hive. 
0==a changed to 0==h.
__________________
How to post your triggers on the Hive Workshop.
JPAG - Bettering the cause of readable source code.

Bribe is offline   Reply With Quote
Old 03-19-2012, 09:32 AM   #37 (permalink)
Registered User overcold_ice
Overfrozen by vJASS
 
overcold_ice's Avatar
 
Join Date: Apr 2011
Posts: 356
overcold_ice is on a distinguished road (71)overcold_ice is on a distinguished road (71)
there's a bug with percent
See This
100% tested . . .
overcold_ice is offline   Reply With Quote
Old 03-19-2012, 06:01 PM   #38 (permalink)
Registered User Nestharus
User
 
Nestharus's Avatar
 
Join Date: Jul 2007
Posts: 4,912
Nestharus has disabled reputation
No there isn't, I just tested it >.>.
Nestharus is online now   Reply With Quote
Old 03-20-2012, 06:41 AM   #39 (permalink)
Registered User overcold_ice
Overfrozen by vJASS
 
overcold_ice's Avatar
 
Join Date: Apr 2011
Posts: 356
overcold_ice is on a distinguished road (71)overcold_ice is on a distinguished road (71)
my bad . . .
sorry all :(
overcold_ice is offline   Reply With Quote
Old 03-31-2012, 05:05 AM   #40 (permalink)
Registered User Nestharus
User
 
Nestharus's Avatar
 
Join Date: Jul 2007
Posts: 4,912
Nestharus has disabled reputation
Where's the credit due to TheDamien from TH? He wrote this resource... >.>.
Nestharus is online now   Reply With Quote
Old 03-31-2012, 08:29 AM   #41 (permalink)
Registered User Troll-Brain
cool != useful
 
Troll-Brain's Avatar
 
Join Date: Apr 2008
Posts: 1,937
Troll-Brain is just really nice (371)Troll-Brain is just really nice (371)Troll-Brain is just really nice (371)Troll-Brain is just really nice (371)
Quote:
Originally Posted by Nestharus View Post
Where's the credit due to TheDamien from TH? He wrote this resource... >.>.
From you it's kinda funny, but you've still a good point.
__________________
- There are bugs with wc3, but most of time, the bug is between the keyboard and the chair.
- Never believe some warcraft "fact" without a proof, even from an "experienced" user, that's how myths & legends born.

You spam "...", "lol", and smilies such as "; p", "^)^",">.>"? You think you're the best and all other ones are stupids or at least less clever than you ? You think your errors are funny, while the other ones are incredibly lame ?
Maybe you've too much ego,or worse, you're a douchebag
Troll-Brain is online now   Reply With Quote
Old 03-31-2012, 08:33 AM   #42 (permalink)
Registered User Nestharus
User
 
Nestharus's Avatar
 
Join Date: Jul 2007
Posts: 4,912
Nestharus has disabled reputation
Well, I believe in credit for code/implementations that were taken out of other resources, not credit for ideas that spawned your own things ; ). Notice that I gave credit to Bribe in my Dummy resource for his thing on delayed recycling ^)^.


As this is TheDamien's code and TheDamien's design, TheDamien deserves credit for it ;o.
Nestharus is online now   Reply With Quote
Old 03-31-2012, 08:37 AM   #43 (permalink)
Registered User Troll-Brain
cool != useful
 
Troll-Brain's Avatar
 
Join Date: Apr 2008
Posts: 1,937
Troll-Brain is just really nice (371)Troll-Brain is just really nice (371)Troll-Brain is just really nice (371)Troll-Brain is just really nice (371)
You've still "stolen" many concepts, and just "improve", "rewrite" them with 0 credits.
And you perfectly know it, i mean you're not the best guy who can talk about credits.
__________________
- There are bugs with wc3, but most of time, the bug is between the keyboard and the chair.
- Never believe some warcraft "fact" without a proof, even from an "experienced" user, that's how myths & legends born.

You spam "...", "lol", and smilies such as "; p", "^)^",">.>"? You think you're the best and all other ones are stupids or at least less clever than you ? You think your errors are funny, while the other ones are incredibly lame ?
Maybe you've too much ego,or worse, you're a douchebag
Troll-Brain is online now   Reply With Quote
Old 03-31-2012, 08:48 AM   #44 (permalink)
Registered User Nestharus
User
 
Nestharus's Avatar
 
Join Date: Jul 2007
Posts: 4,912
Nestharus has disabled reputation
I don't take the code though. If I wrote all of the code as my own, I see no reason to credit other people. After all, if I don't use any of someone eles's implementations, why should I credit them for anything?

Yes, what's his face from wc3c should be credited for undefend for unit indexing, but when I started on it, that was public knowledge already.

Did my unit event stuff take from wc3c's stuff in any way? Not in the slightest, I didn't even look at the code.

Did Table take from wc3c's Table? They may have looked identical, but as you realized in the argument, I didn't even read Table's lib, so it was impossible for me to take any of the implementations done in it, thus no credit was due no matter how similar the resources were, after all it was all my own code, my own ideas, my own designs, and my own implementations.

Why should I have to credit someone else for my own code? That makes 0 sense.

I gave Bribe credit because the timestamp implementation for recycling was something that I specifically took from him. That is pretty much the first time I've ever taken code from someone else, which is why that's pretty much the first time I've ever given credit for someone else's code.

Me and Phtes were having a whole debate on this as I was somewhat confused on what to credit Bribe for, but everything appears to be clear now and I am resolved to only give credit for code/designs I specifically take again, not ideas ^_^.

edit
-> "rewrite"

keyword rewrite from scratch. Why should I have to give other people credit for my own work when they didn't write any of it? Light bulb companies don't give credit to Thomas Edison. People don't give credit to the first person who did the queue. I shouldn't need to give credit to some douche just because they were the first ones to write the lib : \. My implementation is my implementation, not their's.
Nestharus is online now   Reply With Quote
Old 03-31-2012, 08:51 AM   #45 (permalink)
Registered User Troll-Brain
cool != useful
 
Troll-Brain's Avatar
 
Join Date: Apr 2008
Posts: 1,937
Troll-Brain is just really nice (371)Troll-Brain is just really nice (371)Troll-Brain is just really nice (371)Troll-Brain is just really nice (371)
You're a pretty good liar, you believe your own lies.

That thing is closed for me, you will never change my mind, as it is the truth, and i don't care to link examples.
__________________
- There are bugs with wc3, but most of time, the bug is between the keyboard and the chair.
- Never believe some warcraft "fact" without a proof, even from an "experienced" user, that's how myths & legends born.

You spam "...", "lol", and smilies such as "; p", "^)^",">.>"? You think you're the best and all other ones are stupids or at least less clever than you ? You think your errors are funny, while the other ones are incredibly lame ?
Maybe you've too much ego,or worse, you're a douchebag
Troll-Brain is online now   Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


All times are GMT. The time now is 03:59 PM.





Powered by vBulletin
Copyright 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.5.1 PL2
Copyright © Ralle