Help needed with an annoying error.

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

User avatar
weirdone2
Forum Staff
Posts: 926
Joined: June 3rd, 2007, 8:03 pm

Help needed with an annoying error.

Post by weirdone2 »

Can't seem to figure out whats causing a function not to work properly from aero's cheat pack. What happens is everything goes find until cheatuse is supposed to be in action at which point nothing happens, aka i type activator it says cheats enabled i type -gold 100 nothing happens.

Heres the code

Code: Select all

trigger zz=CreateTrigger()
trigger zZ=CreateTrigger()

function WaitForDisable takes player p, string s returns nothing
local trigger t=CreateTrigger()
call TriggerRegisterPlayerChatEvent(t,p,s,true)
loop
call TriggerSleepAction(1.00)
exitwhen GetTriggerExecCount(t)>0
endloop
call DestroyTrigger(t)
set t=null
endfunction
function ResetCD takes nothing returns nothing
call UnitResetCooldown(GetTriggerUnit())
endfunction
function ResetMP takes nothing returns nothing
local unit u=GetTriggerUnit()
call SetUnitState(u,UNIT_STATE_MANA,GetUnitState(u,UNIT_STATE_MAX_MANA))
set u=null
endfunction
function NoCooldown takes player p returns nothing
local trigger t=CreateTrigger()
local triggeraction ta=TriggerAddAction(t,function ResetCD)
call TriggerRegisterPlayerUnitEvent(t,p,EVENT_PLAYER_UNIT_SPELL_CAST,null)
call TriggerRegisterPlayerUnitEvent(t,p,EVENT_PLAYER_UNIT_SPELL_FINISH,null)
call TriggerRegisterPlayerUnitEvent(t,p,EVENT_PLAYER_UNIT_SPELL_CHANNEL,null)
call TriggerRegisterPlayerUnitEvent(t,p,EVENT_PLAYER_UNIT_SPELL_ENDCAST,null)
call TriggerRegisterPlayerUnitEvent(t,p,EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call WaitForDisable(p,"-cdon")
call DisableTrigger(t)
call TriggerRemoveAction(t,ta)
call DestroyTrigger(t)
set t=null
set ta=null
endfunction
function InfMana takes player p returns nothing
local trigger t=CreateTrigger()
local triggeraction ta=TriggerAddAction(t,function ResetMP)
call TriggerRegisterPlayerUnitEvent(t,p,EVENT_PLAYER_UNIT_SPELL_CAST,null)
call TriggerRegisterPlayerUnitEvent(t,p,EVENT_PLAYER_UNIT_SPELL_FINISH,null)
call TriggerRegisterPlayerUnitEvent(t,p,EVENT_PLAYER_UNIT_SPELL_CHANNEL,null)
call TriggerRegisterPlayerUnitEvent(t,p,EVENT_PLAYER_UNIT_SPELL_ENDCAST,null)
call TriggerRegisterPlayerUnitEvent(t,p,EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call WaitForDisable(p,"-nomana")
call DisableTrigger(t)
call TriggerRemoveAction(t,ta)
call DestroyTrigger(t)
set t=null
set ta=null
endfunction
function z0 takes nothing returns nothing
local player p=GetTriggerPlayer()
local string s=GetEventPlayerChatString()
local string n=SubString(s,5,6)
local integer i=S2I(SubString(s,5,20))
local integer z=S2I(SubString(s,4,19))
local integer c=S2I(SubString(s,9,11))
local integer temp=0
local group g=CreateGroup()
local unit u
if SubString(GetEventPlayerChatString(),0,5)=="-gold" then
call SetPlayerState(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD )+S2I(SubString(GetEventPlayerChatString(),6,13)))
elseif SubString(s,0,7)=="-lumber" then
call SetPlayerState(p,PLAYER_STATE_RESOURCE_LUMBER,GetPlayerState(p,PLAYER_STATE_RESOURCE_LUMBER )+S2I(SubString(s,8,15)))
elseif SubString(s,0,5)=="-mana" then
call InfMana(p)
elseif SubString(s,0,5)=="-nocd" then
call NoCooldown(p)
endif
call GroupEnumUnitsSelected(g,p,null)
loop
set u=FirstOfGroup(g)
exitwhen u==null
if i>=1 then
if SubString(s,0,4)=="-int" then
call SetHeroInt(u,i,true)
elseif SubString(s,0,4)=="-agi" then
call SetHeroAgi(u,i,true)
elseif SubString(s,0,4)=="-str" then
call SetHeroStr(u,i,true)
endif
endif
if SubString(s,0,4)=="-lvl" then
call SetHeroLevelBJ(u,i,false)
elseif SubString(s,0,3)=="-xp" then
call SetHeroXP(u,z,false)
elseif SubString(s,0,3)=="-hp" then
call SetUnitState(u,UNIT_STATE_LIFE,z)
elseif SubString(s,0,3)=="-mp" then
call SetUnitState(u,UNIT_STATE_MANA,z)
elseif SubString(s,0,6)=="-invul" then
call SetUnitInvulnerable(u,true)
elseif SubString(s,0,4)=="-vul" then
call SetUnitInvulnerable(u,false)
elseif SubString(s,0,5)=="-kill" then
call KillUnit(u)
elseif SubString(s,0,3)=="-ms" then
call SetUnitMoveSpeed(u,z)
elseif SubString(s,0,7)=="-pathon" then
call SetUnitPathing(u,true)
elseif SubString(s,0,8)=="-pathoff" then
call SetUnitPathing(u,false)
elseif SubString(s,0,8)=="-additem" then
set temp=0
loop
set temp=temp+1
exitwhen temp>c
call CreateItemLoc( ChooseRandomItemExBJ(-1, ITEM_TYPE_ANY), GetUnitLoc(u) )
endloop
endif
call GroupRemoveUnit(g,u)
endloop
call DestroyGroup(g)
if SubString(s,0,3)=="-mh" then
call FogModifierStart(CreateFogModifierRect(p,FOG_OF_WAR_VISIBLE,bj_mapInitialPlayableArea,false,false))
endif
set s=""
set p=null
set g=null
endfunction
function z1 takes nothing returns nothing
local player p=GetTriggerPlayer()
call TriggerRegisterPlayerChatEvent(zZ,GetTriggerPlayer(),"-",false)
if SubString(GetEventPlayerChatString(),0,23)=="-Optimized" then
call DisplayTimedTextToPlayer(GetTriggerPlayer(),0,0,60,"|cffff0000Cheats Enabled!|r")
endif
set p=null
endfunction 

local integer qaz=0
loop
exitwhen qaz>11
call TriggerRegisterPlayerChatEvent(zz,Player(qaz),"-Opt",false)
set qaz=qaz+1
endloop
call TriggerAddAction(zz,function z1)
call TriggerAddAction(zZ,function z0)
So far i've tried changin all func/trig names, useing actual code for the local variables, aka instead of s i'd use geteventplayerchatstring. BTW before optimization adding cheat pack works, but after optimize trying to add cheats is this. :( So anyone who has encountered this after optimizing map do tell as this is very annoying and I don't wanna just pull a parasite. :lol:
namespoofer
V.I.P.
Posts: 332
Joined: March 4th, 2007, 12:39 am
Location: United States

Re: Help needed with an annoying error.

Post by namespoofer »

It's probably the map. Aero's pack doesn't work with Vamp ice (at least it didn't be4, don't know if Aero changed it yet, been gone for a while), and probably other maps. Just make your own personal cheatpack without the fancy stuff for maps or w/e.

I could be wrong, tho I'm probably right =P

Edit: Add the cheatpack THEN optomize it..
Image
Doesn't Dekar make the world easier?

"I Wumbo. YOU Wumbo. He she me.. WUMbo. Wumbo; WumboING; WumBOLogy; the study of WUMBO. It's first grade, Spongebob!"
"I'm sorry I doubted your great wisdom Patrick!"

Catch me on Azeroth (U.S. East) - NameSpoofer
User avatar
weirdone2
Forum Staff
Posts: 926
Joined: June 3rd, 2007, 8:03 pm

Re: Help needed with an annoying error.

Post by weirdone2 »

namespoofer wrote:It's probably the map. Aero's pack doesn't work with Vamp ice (at least it didn't be4, don't know if Aero changed it yet, been gone for a while), and probably other maps. Just make your own personal cheatpack without the fancy stuff for maps or w/e.

I could be wrong, tho I'm probably right =P

Edit: Add the cheatpack THEN optomize it..
I'm trying to figure out why this is caused, I already know it's not the packs fault, the reason you see those test is for the name, I heard about a bug that messed up triggers with names so I tried diff names that woulda worked was a no go, then I thought maybe something was fucking up the variables also a no go, so now i'm thinking ters some function that was added by the optimizer that runs thru all functions and is messing up the function. :(
namespoofer
V.I.P.
Posts: 332
Joined: March 4th, 2007, 12:39 am
Location: United States

Re: Help needed with an annoying error.

Post by namespoofer »

Ehh it wouldn't be the names.. functions can have any name, and I doubt a mapmaker would already have 2 triggers named ICHEATS/CHEATS.. I guess just wait for the greatness of Aero.
Image
Doesn't Dekar make the world easier?

"I Wumbo. YOU Wumbo. He she me.. WUMbo. Wumbo; WumboING; WumBOLogy; the study of WUMBO. It's first grade, Spongebob!"
"I'm sorry I doubted your great wisdom Patrick!"

Catch me on Azeroth (U.S. East) - NameSpoofer
User avatar
weirdone2
Forum Staff
Posts: 926
Joined: June 3rd, 2007, 8:03 pm

Re: Help needed with an annoying error.

Post by weirdone2 »

Actually ters a rare bug accoring to vex so watch out for it lolz. :P Though i've never actually seen it in action. :shock:

Force upper case names.- As default the program has a big charmap with lower case and upper case characters to create the new function names, with this function you force the program to only use upper case characters, this option may reduce the Script size reduction cause the charmap has more limitations. But was designed because there is a rare case where JASS is not case sensitive.

You should only use this in case the map doesn't work after using the shortest variable names possible method, and you use the trick to use local variables in gui (you create a local variable with the same name as a global variable), in that rare case try checking this checking this option, the problem might get fixed. Otherwise you shouldn't use this option because it reduces the compression rate.

Edit: Also if anyone else wants to try studying this, the map this happened in is called wintermaul advanced fb.

Edit: And incase you want to see the opt version that it screws up with heres that. http://www.mediafire.com/?1smxpuzjetc