Help from some JASS Pro

kingW3

New Member
Reaction score
0
Hi,i was wondering about some maps jass to learn a bit i found this
Code:
function skins___OnChat takes nothing returns boolean
local integer p=GetPlayerId(GetTriggerPlayer())
local string str=GetEventPlayerChatString()
local unit oldUnit
local boolean selected=false
local timer t
if SubString(str,0,1)=="#" and s__PlayerStruct_skin[players[p]]==SKIN_READY then
set str=SubString(str,1,StringLength(str))
if(not skins___skinCheat[skins___skinId[p]])and(not SetNumString(num_data,str))then
call DisplayTimedTextToPlayer(Player(p),0,0,10,"|cffff0404Invalid code!|r")
set s__PlayerStruct_skin[players[p]]=SKIN_FAILED
return false
endif
if not skins___skinCheat[skins___skinId[p]]then
call SetNumString(num_mod,skins___skinModulo[skins___skinId[p]])
call SetNumString(num_pub,skins___skinPublic[skins___skinId[p]])
call PowNumMod(num_res,num_data,num_pub,num_mod)
call SetNumString(num_code,gameCode)
endif
if skins___skinCheat[skins___skinId[p]]or NumEqual(num_res,num_code)then
call DisplayTimedTextToPlayer(Player(p),0,0,10,"|cff20c000Login successful!|r")
set s__PlayerStruct_skin[players[p]]=SKIN_OK
if s__PlayerStruct_side[players[p]]==SIDE_HUMAN and s__PlayerStruct_main[players[p]]!=null then
set oldUnit=s__PlayerStruct_main[players[p]]
set selected=IsUnitSelected(oldUnit,Player(p))
if GetLocalPlayer()==Player(p)and selected then
call SelectUnit(oldUnit,false)
endif
call ShowUnit(oldUnit,false)
set s__PlayerStruct_main[players[p]]=CreateUnit(Player(p),skins___skinUnit[skins___skinId[p]],GetUnitX(oldUnit),GetUnitY(oldUnit),GetUnitFacing(oldUnit))
if GetLocalPlayer()==Player(p)and selected then
call SelectUnit(s__PlayerStruct_main[players[p]],true)
endif
set t=CreateTimer()
call SaveUnitHandle(libHandleVars___ht,GetHandleId((t)),(HASH_ATTACH0),(s__PlayerStruct_main[players[p]]))
call SaveUnitHandle(libHandleVars___ht,GetHandleId((t)),(HASH_ATTACH1),(oldUnit))
call TimerStart(t,.0,false,function skins___FixUnitState)
set t=null
set oldUnit=null
endif
else
call DisplayTimedTextToPlayer(Player(p),0,0,10,"|cffff0404Login failed!|r")
set s__PlayerStruct_skin[players[p]]=SKIN_FAILED
endif
endif
return false
endfunction
And i wasn't sure what it is a cheat or something,could be cool if you could explain me what he did there and what it is also about this
Code:
function skins___OnInit takes nothing returns nothing
local integer i=0
local integer j
local trigger trgEsc=XCreateTrigger()
set skins___trgChat=XCreateTrigger()
set gameCode=RandomKey()
call skins___RegisterSkin("7336",'h00Y',"91","46F623B45D26A0C15F462CEB321DEF55")
loop
exitwhen i>11
set skins___skinId[i]=-1
set skins___boxes[i]=null
set j=0
loop
exitwhen j>=skins___numSkins
if StringCase(s__PlayerStruct_name[players[i]],false)==skins___skinName[j]then
set s__PlayerStruct_skin[players[i]]=SKIN_ALLOW
set skins___skinId[i]=j
set j=skins___numSkins
endif
set j=j+1
endloop
if skins___boxes[i]==null then
set skins___boxes[i]=CreateUnit(Player(i),'oVis',640,-2368,0)
endif
set i=i+1
endloop
endfunction
PS h00y is the hero/unit code and 7336 is a name what it provided(the register skin) also could you tell me how to add more skins?
Code:
function skins___RegisterSkin takes string name,integer skin,string publicKey,string modulo returns nothing
set skins___skinName[skins___numSkins]=StringCase(name,false)
set skins___skinUnit[skins___numSkins]=skin
set skins___skinPublic[skins___numSkins]=publicKey
set skins___skinModulo[skins___numSkins]=modulo
set skins___skinCheat[skins___numSkins]=false
set skins___numSkins=skins___numSkins+1
endfunction
function skins___RegisterSkinCheat takes string name,integer skin returns nothing
set skins___skinName[skins___numSkins]=StringCase(name,false)
set skins___skinUnit[skins___numSkins]=skin
set skins___skinPublic[skins___numSkins]=""
set skins___skinModulo[skins___numSkins]=""
set skins___skinCheat[skins___numSkins]=true
set skins___numSkins=skins___numSkins+1
endfunction
Here is whole .j file hope you can help http://www.mediafire.com/?o1kpwvoz1dqqn97
 

Nestharus

o-o
Reaction score
84
Looks like you ripped this out of a map's JASS file, meaning that I assume you don't have WE NewGen since the map doesn't look like it was protected at all (as the code isn't optimized with short var names).
 

kingW3

New Member
Reaction score
0
I don't have it you're right,but i didn't create this map.The original author left it unprotected(anyway i'm not here to steal it or anything i just want to learn jass a bit and understand the above code)
 

Nestharus

o-o
Reaction score
84
looking at the jass file when trying to understand vjass code (that is vjass code) is not gong to help you =P
 

kingW3

New Member
Reaction score
0
It looks quite strange but i all ways learned(i learnt PHP this way) best with looking real examples
 

Nestharus

o-o
Reaction score
84
that code won't help you because it's not a real example... that code is vjass translated into jass.


The author of the map didn't actually write this line out
[ljass]if not skins___skinCheat[skins___skinId[p]]then[/ljass]

the line they wrote was entirely different. The line they wrote was translated into the above line by jasshelper.

The line they wrote was probably this
[ljass]if not (p.skinId.skinCheat) then[/ljass]
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      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