| 10-11-2006, 03:18 AM | #1 |
Well, I've set my variable in my map script, next to WEU's save load code, the same as the string "Final" However, everytime I type /viewcode it appears as "Null" |
| 10-11-2006, 03:28 AM | #2 |
maybe you did something wrong? Can't do much if you don't post the code, how did you set the variable? Inside a function that is called by WEU? or just inside a function in the custom script section without actually calling it? |
| 10-11-2006, 03:48 AM | #3 |
Yes, inside the custom script of the save/load code for WEU This is the trigger (And a few lines around it, trigger being set udg_SaveLoadCode[GetPlayerId(P)] = Final JASS:set Final = ColorHeroCode(AddScores(AssembleCode(AssembleCode(Code)))) set udg_SaveLoadCode[GetPlayerId(P)] = Final call DisplayTimedTextToPlayer(P,0,0,300,Final) call DisplayTimedTextToPlayer(P,0,0,12,"Your load code has been stored, type /viewcode to see it" ) endfunction >> Whole part below JASS:function SaveHeroData takes unit U, player P returns nothing local integer Id = GetUniqueEinheitsnummer(U) local string Code = "" local integer XP local integer X local integer Y local integer Life local integer Mana local integer Agi local integer Str local integer Int local integer Gold local integer Lumber local integer Uid local string Final local string pname local integer Counter = 0 if IsUnitType(U,UNIT_TYPE_HERO) == false then return endif if udg_zz_SaveLoadSettings[6] then set pname = GetPlayerName(P) if GetLength(pname) < 5 then set Counter = 5 - GetLength(pname) set pname = SubStringBJ(pname,1,GetLength(pname)) loop set pname = pname + "Q" set Counter = Counter - 1 exitwhen Counter <= 0 endloop else set pname = SubStringBJ(pname,1,5) endif set Code = pname set Code = Code + DebugIdInteger2IdString(GetUnitTypeId(U)) else set Code = DebugIdInteger2IdString(GetUnitTypeId(U)) endif set XP=GetHeroLevel(U) if XP>99999 then set XP=99999 elseif XP<1 then set XP=1 endif set Code=Code+Int2CodeStr(XP,5) if udg_zz_SaveLoadSettings[0] then set X = R2I(GetUnitX(U)) set Y = R2I(GetUnitY(U)) if X < - 50000 then set X = - 50000 endif if X >= 50000 then set X = 49999 endif set X = X + 50000 if Y < - 50000 then set Y = - 50000 endif if Y >= 50000 then set Y = 49999 endif set Y = Y + 50000 set X = X / 100 set Y = Y / 100 set Code = Code + Int2CodeStr(X,3) set Code = Code + Int2CodeStr(Y,3) endif if udg_zz_SaveLoadSettings[1] then set Life = R2I(GetUnitLifePercent(U) - 1) set Mana = R2I(GetUnitManaPercent(U) - 1) if Life <= 0 then set Life = 0 endif if Mana < 0 then set Mana = 0 endif set Code = Code + Int2CodeStr(Life,2) set Code = Code + Int2CodeStr(Mana,2) endif if udg_zz_SaveLoadSettings[2] then set Str = GetHeroStatBJ(bj_HEROSTAT_STR,U,false) set Agi = GetHeroStatBJ(bj_HEROSTAT_AGI,U,false) set Int = GetHeroStatBJ(bj_HEROSTAT_INT,U,false) if Agi > 99 then set Agi = 99 endif if Str > 99 then set Str = 99 endif if Int > 99 then set Int = 99 endif set Code = Code + Int2CodeStr(Str,2) set Code = Code + Int2CodeStr(Agi,2) set Code = Code + Int2CodeStr(Int,2) endif if udg_zz_SaveLoadSettings[3] then set Gold = GetPlayerState(GetOwningPlayer(U),PLAYER_STATE_RESOURCE_GOLD) set Lumber = GetPlayerState(GetOwningPlayer(U),PLAYER_STATE_RESOURCE_LUMBER) if Gold > 99999 then set Gold = 99999 endif if Lumber > 99999 then set Lumber = 99999 endif set Gold = Gold / 10 set Lumber = Lumber / 10 set Code = Code + Int2CodeStr(Gold,4) set Code = Code + Int2CodeStr(Lumber,4) endif if udg_zz_SaveLoadSettings[4] then set Code = Code + TertiaryStringOp(UnitItemInSlotBJ(U,1) != null,DebugIdInteger2IdString(GetItemTypeId(UnitItemInSlotBJ(U,1))),"X") set Code = Code + TertiaryStringOp(UnitItemInSlotBJ(U,2) != null,DebugIdInteger2IdString(GetItemTypeId(UnitItemInSlotBJ(U,2))),"X") set Code = Code + TertiaryStringOp(UnitItemInSlotBJ(U,3) != null,DebugIdInteger2IdString(GetItemTypeId(UnitItemInSlotBJ(U,3))),"X") set Code = Code + TertiaryStringOp(UnitItemInSlotBJ(U,4) != null,DebugIdInteger2IdString(GetItemTypeId(UnitItemInSlotBJ(U,4))),"X") set Code = Code + TertiaryStringOp(UnitItemInSlotBJ(U,5) != null,DebugIdInteger2IdString(GetItemTypeId(UnitItemInSlotBJ(U,5))),"X") set Code = Code + TertiaryStringOp(UnitItemInSlotBJ(U,6) != null,DebugIdInteger2IdString(GetItemTypeId(UnitItemInSlotBJ(U,6))),"X") endif if udg_zz_SaveLoadSettings[5] then set Uid = GetUniqueEinheitsnummer(U) set Code = Code + Int2CodeStr(GetUnitAbilityLevelSwapped(udg_zz_HeroSkill1[Uid],U),1) set Code = Code + TertiaryStringOp(GetUnitAbilityLevelSwapped(udg_zz_HeroSkill1[Uid],U) > 0,DebugIdInteger2IdString(udg_zz_HeroSkill1[Uid]),"") set Code = Code + Int2CodeStr(GetUnitAbilityLevelSwapped(udg_zz_HeroSkill2[Uid],U),1) set Code = Code + TertiaryStringOp(GetUnitAbilityLevelSwapped(udg_zz_HeroSkill2[Uid],U) > 0,DebugIdInteger2IdString(udg_zz_HeroSkill2[Uid]),"") set Code = Code + Int2CodeStr(GetUnitAbilityLevelSwapped(udg_zz_HeroSkill3[Uid],U),1) set Code = Code + TertiaryStringOp(GetUnitAbilityLevelSwapped(udg_zz_HeroSkill3[Uid],U) > 0,DebugIdInteger2IdString(udg_zz_HeroSkill3[Uid]),"") set Code = Code + Int2CodeStr(GetUnitAbilityLevelSwapped(udg_zz_HeroSkill4[Uid],U),1) set Code = Code + TertiaryStringOp(GetUnitAbilityLevelSwapped(udg_zz_HeroSkill4[Uid],U) > 0,DebugIdInteger2IdString(udg_zz_HeroSkill4[Uid]),"") set Code = Code + Int2CodeStr(GetUnitAbilityLevelSwapped(udg_zz_HeroSkill5[Uid],U),1) set Code = Code + TertiaryStringOp(GetUnitAbilityLevelSwapped(udg_zz_HeroSkill5[Uid],U) > 0,DebugIdInteger2IdString(udg_zz_HeroSkill5[Uid]),"") endif set Final = ColorHeroCode(AddScores(AssembleCode(AssembleCode(Code)))) set udg_SaveLoadCode[GetPlayerId(P)] = Final call DisplayTimedTextToPlayer(P,0,0,300,Final) call DisplayTimedTextToPlayer(P,0,0,12,"Your load code has been stored, type /viewcode to see it" ) endfunction |
| 10-11-2006, 04:51 AM | #4 |
Add Final="AAA" after the place where you assign Final=ColorHeroCode... To verify if the problem is not actually with the 3 functions you call to assign Final. |
| 10-11-2006, 05:08 AM | #5 |
Ok, so basically setting Final = AAA after it, then displaying it, so that I can see if its with the code or with my triggers ok XD |
| 10-12-2006, 08:14 AM | #6 |
Ok, Sorry for double post, I did what you said vex, it didnt come up, it showed my save/load code is AAA, then I typed /viewcode, and it kept showing "Null", not sure what to do ![]() |
| 10-12-2006, 12:21 PM | #7 |
The problem might then be with your "/viewcode" function. Post it up and we'll take a look at it. |
