Snippet Ascii

Vestras

Retired
Reaction score
249
JASS:
globals
    constant integer A=65
    constant integer B=66
    constant integer C=67
    constant integer D=68
    constant integer E=69
    constant integer F=70
    constant integer G=71
    constant integer H=72
    constant integer I=73
    constant integer J=74
    constant integer K=75
    constant integer L=76
    constant integer M=77
    constant integer N=78
    constant integer O=79
    constant integer P=80
    constant integer Q=81
    constant integer R=82
    constant integer S=83
    constant integer T=84
    constant integer U=85
    constant integer V=86
    constant integer W=87
    constant integer X=88
    constant integer Y=89
    constant integer Z=90
    constant integer a=97
    constant integer b=98
    constant integer c=99
    constant integer d=100
    constant integer e=101
    constant integer f=102
    constant integer g=103
    constant integer h=104
    constant integer i=105
    constant integer j=106
    constant integer k=107
    constant integer l=108
    constant integer m=109
    constant integer n=110
    constant integer o=111
    constant integer p=112
    constant integer q=113
    constant integer r=114
    constant integer s=115
    constant integer t=116
    constant integer u=117
    constant integer v=118
    constant integer w=119
    constant integer y=120
    constant integer x=121
    constant integer z=122
endglobals
 

XeNiM666

I lurk for pizza
Reaction score
138
I'm going to say............................. actually I'm not going to say anything.

What does this supposed to do?
 

Ryuu

I am back with Chocolate (:
Reaction score
64
this converts integers that start from 65 to letters from 'A' to 'Z' to 'a' to 'z'?
Oh, and you're missing out 'x'.

JASS:
private constant integer x = 120
 

Artificial

Without Intelligence
Reaction score
326
> to write their own list
Why on earth would someone need a list of those? o_O
JASS:
call BJDebugMsg(I2S('A')) // Displays 65
call BJDebugMsg(I2S('f')) // Displays 102
You do know it's possible to do that, right?
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
In what way could this be useful in loops? I see no use at all for this I'm afraid.
 

Romek

Super Moderator
Reaction score
964
Hmm.. Well this doesn't really have a purpose, seeing as you could just use 'A', etc.
And also, the globals are private, and aren't in a scope or library.

So it's not very usable. (Unless you where expecting people to copy it into every code they where going to use it in?)
 

Ryuu

I am back with Chocolate (:
Reaction score
64
Lol, you posted it twice. :D
Well for loops perhaps something like this?

JASS:
local integer Index = 0
loop
    set Index = Index + 1
    call DebugMsg(I2S(Index))
 

Vestras

Retired
Reaction score
249
In what way could this be useful in loops? I see no use at all for this I'm afraid.

I use this in an integer to letter conversion function -
JASS:
globals
    private constant integer A=65
    private constant integer B=66
    private constant integer C=67
    private constant integer D=68
    private constant integer E=69
    private constant integer F=70
    private constant integer G=71
    private constant integer H=72
    private constant integer I=73
    private constant integer J=74
    private constant integer K=75
    private constant integer L=76
    private constant integer M=77
    private constant integer N=78
    private constant integer O=79
    private constant integer P=80
    private constant integer Q=81
    private constant integer R=82
    private constant integer S=83
    private constant integer T=84
    private constant integer U=85
    private constant integer V=86
    private constant integer W=87
    private constant integer X=88
    private constant integer Y=89
    private constant integer Z=90
    private string array Letter
endglobals
private function Initialization takes nothing returns nothing
    set Letter[A]="A"
    set Letter<b>=&quot;B&quot;
    set Letter[C]=&quot;C&quot;
    set Letter[D]=&quot;D&quot;
    set Letter[E]=&quot;E&quot;
    set Letter[F]=&quot;F&quot;
    set Letter[G]=&quot;G&quot;
    set Letter[H]=&quot;H&quot;
    set Letter<i>=&quot;I&quot;
    set Letter[J]=&quot;J&quot;
    set Letter[K]=&quot;K&quot;
    set Letter[L]=&quot;L&quot;
    set Letter[M]=&quot;M&quot;
    set Letter[N]=&quot;N&quot;
    set Letter[O]=&quot;O&quot;
    set Letter[P]=&quot;P&quot;
    set Letter[Q]=&quot;Q&quot;
    set Letter[R]=&quot;R&quot;
    set Letter<s>=&quot;S&quot;
    set Letter[T]=&quot;T&quot;
    set Letter<u>=&quot;U&quot;
    set Letter[V]=&quot;V&quot;
    set Letter[W]=&quot;W&quot;
    set Letter[X]=&quot;X&quot;
    set Letter[Y]=&quot;Y&quot;
    set Letter[Z]=&quot;Z&quot;
endfunction

function DH_H2I takes handle h returns integer
    return h
    return 0
endfunction
function DH_H2S takes handle h returns string
    return I2S(DH_H2I(h))
endfunction
function DH_GetHandleName takes handle h returns string
    local integer hj=DH_H2I(h)-0x100000
    local string basic=&quot;&quot;
    local string s=&quot;&quot;
    local integer n=A-1
    local integer j=-1
    if hj&gt;Z then
        loop
            set j=j+1
            exitwhen hj&lt;=Z
                set hj=hj-1
        endloop
    endif
    set basic=I2S(hj)
    loop
        set n=n+1
        exitwhen n&gt;Z
            if n==hj then
                set s=s+Letter[n]
                set n=Z+1
            endif
    endloop
    debug call BJDebugMsg(&quot;basic == &quot;+basic)
    debug call BJDebugMsg(&quot;s == &quot;+s)
    return s
endfunction
</u></s></i></b>
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
Lol, you posted it twice. :D
Well for loops perhaps something like this?

JASS:
local integer Index = 0
loop
    set Index = Index + 1
    call DebugMsg(I2S(Index))

And then using a snippet that's already in my WE even before implementation would benefit me how?
 

Ryuu

I am back with Chocolate (:
Reaction score
64
Not sure.
Probably what he said though.

> I use this in an integer to letter conversion function
- by Vestras
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top