• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

QLoad

Level 6
Joined
Dec 10, 2010
Messages
119
QLoad is easy scrambler to convert all numbers in your string to symbols

Why 'Q' Load? Because i use 'q' integer in all methods :)
Why Load? Before, I used it for my old SaveLoad.

:fp:

JASS:
library QLoad // Just add in you lib - uses QLoad and in function write local qload 'name' = qload.create()

 private constant string Alph        =    "%$#@!*)(^=" // You can adjust the process
 private constant string Numb        =    "0123456789" // It can not change

struct qload 
 
private static method Encode takes string s returns string // numbers to symbols
int q=0
string full=""
whilenot(q>9)
{if s==SubString(Numb,q,q+1)
{full=SubString(Alph,q,q+1)
return full}
q++} 
return s
endmethod

private static method Decode takes string s returns string // symbols to numbers
int q=0
string full=""
whilenot(q>9)
{if s==SubString(Alph,q,q+1)
{full=SubString(Numb,q,v+1)
return full}
q++} 
return s
endmethod

static method encryption takes string s,boolean encode returns string // if encode flag = true you will encode else decode
int q=0
int lng=StringLength(s)
string GenCode=""
string array GenX2
whilenot(q>lng)
{if encode==true
{GenX2[q]=Encode(SubString(s,q,q+1))
}else{
GenX2[q]=Decode(SubString(s,q,q+1))}
GenCode=GenCode+GenX2[q]
q++}
return GenCode
endmethod

endstruct

endlibrary

And for bonus my nobug struct. This easy struct realy help me in the search for bugs. I think it is useful to you.

:fp:

JASS:
struct nobug
string Debug=""
static method bug takes string s,string info returns nothing
call DisplayTimedTextToPlayer(Player(0),0,0,60,"|cFFFFCD00[No-bug]|r "+"{"+"|cFFFF0000"+info+"|r}   |"+s)
endmethod
static method lbl takes string info returns nothing
call DisplayTimedTextToPlayer(Player(0),0,0,60,"|cFFFFCD00[label]|r    "+"|cFFFF0000"+info+"|r")
endmethod
method dbg takes nothing returns nothing
call DisplayTimedTextToPlayer(Player(0),0,0,60,"|cFFFFCD00[Debug]|r  |"+Debug)
endmethod
endstruct

:cexc:Required: cj_types.j and cj_types_priv.j library
 
Top