Snippet ASCII Object Id converter

Laiev

Hey Listen!!
Reaction score
188
This forum's search should be really improved

No, should not :p

TheHelper is an updated forum (from vBulletin 3.8.5 or so to 4.1.5), the only thing that could be 'wrong' is if old vBulletin way to index topics was different then actual, but this should be fixed when updated, so probably some mistake on configuration or something wrong when you try to search something (I never have problem with vB search engine).

This is not the point of the topic, sorry about this >.<
 

tooltiperror

Super Moderator
Reaction score
231
The search function is fine, it's probably the user who has the problem.

Narrow down your search to the T&R section. Then search for "ascii" and it comes up with the two Ascii snippets on the very first page.

As it seems this is less efficient and practically reinvents the wheel with absolutely no added bonus, I'm going to send this to the graveyard unless you can provide a reason otherwise.

But nonetheless, a good job :)
 

NoobImbaPro

You can change this now in User CP.
Reaction score
60
I didn't knew anything about ascii, I just saw some things when trying to see what makes sense with these numbers on WE debug messages.
I just figured out what is it, searched post, didn't find anything. typing ascii snippet came up with save-load systems, and didn't find anything.

The other guys, have more experience from me in programming and I would say you should graveyard this, if the others are really better.
Because only my ObjId2S function has same speed as theirs....I only know mathematics so S2ObjId is not in my power do this through function and not with loop search as I did now.

Is "integer = 5/3" same with "integer i = R2I(5/3)" ??
I haven't got answer yet.
 

Jedi

New Member
Reaction score
63
Yes same, you can test it you know :D

Also why would he search something like "Ascii", I would probably search things like "object id convert", "object integer" things like that.

Edit:I searched Object id convert and found damien's ascii.
 

tooltiperror

Super Moderator
Reaction score
231
To the graveyard I banish this resource, never to return again (unless it becomes worthy of redemption)!
 

Sgqvur

FullOfUltimateTruthsAndEt ernalPrinciples, i.e shi
Reaction score
62
tooltiperror:
1. (unless it becomes worthy of redemption)!
2. I'm going to send this to the graveyard unless you can provide a reason otherwise. ... But nonetheless, a good job.

1. What does that suppose to mean? (Are you writing a knights novel? All your posts (in this thread) have absolute zero information of how NoobImbaPro could try to improve his snippet [what's up with that])

2. Yeah good job to him, and I think poor job of you.
 

Jedi

New Member
Reaction score
63
He was just talking with nice-funny words wtf.What could he say to improve this snippet?It converts object id to string that is it.
 

tooltiperror

Super Moderator
Reaction score
231
Because, regardless of how he improved it, it was just a clone of another resource, and therefore useless.
 

Sgqvur

FullOfUltimateTruthsAndEt ernalPrinciples, i.e shi
Reaction score
62
tooltiperror:
1. Because, regardless of how he improved it, it was just a clone of another resource, and therefore useless.

1. Then why bullsh*ting him ("Perhaps you could make a demomap showing many uses of Ascii functions, and then submit it with a brief introduction to how it works?") to spend even more time on this snippet?

Jedi:
1. He was just talking with nice-funny words wtf.

1. Unfortunately language is full of "nice-funny" words that don't have any communication value, he could instead try to come right to the point on his first post with "Because, regardless of how he improved it, it was just a clone of another resource, and therefore useless." (that's better).
 

NoobImbaPro

You can change this now in User CP.
Reaction score
60
Stop helping me, It's my fault, but thanks anyway. This snippet it is as you see it, and as I see it will become a clone of another snippet by making it better. You can't make anything faster than currect ASCII snipepts, or more useful, or something else...

**All your posts (in this thread) have absolute zero information of how NoobImbaPro could try to improve his snippet

And in AUMS too
 

Sgqvur

FullOfUltimateTruthsAndEt ernalPrinciples, i.e shi
Reaction score
62
NoobImbaPro:
1. You can't make anything faster than currect ASCII snipepts,

1. Are you sure? [this was 'copied' from Toadcop's BX-TRSII map =)]

JASS:
globals
    string  I2A_result = &quot;&quot;
    integer I2A_int = 0
    string array ASCII
endglobals

function init_ascii takes nothing returns nothing
    set ASCII[32] = &quot; &quot;
    ...
    set ASCII[65] = &quot;A&quot;
    ...
    set ASCII[90] = &quot;Z&quot;
    set ASCII[97] = &quot;a&quot;
    ...
    set ASCII[122] = &quot;z&quot;
    ...
endfunction

constant function ModuloInt takes integer h, integer d returns integer
     return  h - (h / d) * d
endfunction

function sub_I2A takes nothing returns nothing
    local integer i = I2A_int
    set I2A_result = ASCII[i / 0x1000000] + ASCII[ModuloInt(i / 0x10000, 0x100)] + ASCII[ModuloInt(i / 0x100, 0x100)] + ASCII[ModuloInt(i, 0x100)]
endfunction

// &#039;/usr&#039; -&gt; &quot;/usr&quot;
function I2A takes integer a returns string
    set I2A_int = a
    call ExecuteFunc(sub_I2A)
    return I2A_result
endfunction


JASS:
globals
    hashtable ascii      = InitHashtable()
    integer   A2I_result =  0
    string    A2I_string = &quot;&quot;
endglobals

function init_ascii takes nothing returns nothing
    call SaveInteger(ascii, 0x100, StringHash(&quot; &quot;), 32)
    ...
    call SaveInteger(ascii, 0x100, StringHash(&quot;A&quot;), 65)
    ...
    call SaveInteger(ascii, 0x100, StringHash(&quot;Z&quot;), 90)
    call SaveInteger(ascii, 0x100, StringHash(&quot;a&quot;), 97)
    ...
    call SaveInteger(ascii, 0x100, StringHash(&quot;z&quot;), 122)
    ...
endfunction

function sub_A2I takes nothing returns nothing
    local strign s = A2I_string
    set A2I_result = LoadInteger(ascii, 256, StringHash(SubString(s, 0, 1))) * 0x1000000 + \
                     LoadInteger(ascii, 256, StringHash(SubString(s, 1, 2))) * 0x10000   + \
                     LoadInteger(ascii, 256, StringHash(SubString(s, 2, 3))) * 0x100     + \
                     LoadInteger(ascii, 256, StringHash(SubString(s, 3, 4)))
endfunction

// &quot;/bin&quot; -&gt; &#039;/bin&#039;
function A2I takes string a returns integer
    set A2I_string = a
    call ExecuteFunc(&quot;sub_A2I&quot;)
    return A2I_result
endfunction
 

Nestharus

o-o
Reaction score
84
That's not as good. It could potentially be faster for 4 char ascii codes specifically (only integer to ascii), but the drawback is that you'd only be able to pass in 4 char ascii codes (instead of any number of characters). Keep in mind that valid wc3 ascii codes are 1 char or 4 chars.

The ascii to integer is just plainly not as good as the methods on this site.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top