Issue information

Issue ID
#6799
Status
Working as Intended
Severity
None
Started
Hercules Elf Bot
Oct 18, 2012 13:26
Last Post
Hercules Elf Bot
Oct 19, 2012 11:40
Confirmation
Yes (0)
No (3)

Hercules Elf Bot - Oct 18, 2012 13:26

Originally posted by [b]Oxxy[/b]
Setd and getd converting INT variables to STRING variables.

Try this npc to understand what i mean:
[CODE]
prontera, 147, 174, 6 script Интедант 700,{
if(select("Удалить репутацию", "Добавить репутацию") == 2)
{
mes "Вы получили репутацию у города Izlude";
CallFunc ("get_rep", "125", "Izlude");
CallFunc ("show_rep", "Izlude");
close;
}

mes "Репутацию удалена";
CallFunc ("clear_rep", "Izlude");
CallFunc ("show_rep", "Izlude");
close;
}
function script get_rep {
if(getarg(1) != "Izlude") { debugmes "[Reputation System] There's no city with that name or it isn't added in array."; end; }

//setd getarg(1)+"_rep", (getd(getarg(1)+"_rep") + getarg(0));
//lool = getd(getarg(1)+"_rep");
//lool = lool + getarg(0);
//setd getarg(1)+"_rep", getd(getarg(1)+"_rep") + getarg(0);
//setd "rep_"+getarg(1), getd("rep_"+getarg(1)) + getarg(0);
setd "rep_"+getarg(1), getd("rep_"+getarg(1)) ++;

return;
}
function script show_rep {
if(getarg(0) != "Izlude") { debugmes "[Reputation System] There's no city with that name or it isn't added in array."; end; }
//dispbottom "У Вас "+getd(getarg(0)+"_rep")+" репутации у города "+getarg(0)+".";
dispbottom "У Вас "+getd("rep_"+getarg(0))+" репутации у города "+getarg(0)+".";
return;

}
function script clear_rep {
if(getarg(0) != "Izlude") { debugmes "[Reputation System] There's no city with that name or it isn't added in array."; end; }
if(getd(getarg(0)+"_rep") == 0) { debugmes "[Reputation System] Player "+strcharinfo(0)+" already have 0 reputation with "+getarg(0)+" town. "; close; }

//setd getarg(0)+"_rep", 0;
setd "rep_"+getarg(0), 0;
return;
}
[/CODE]

Sorry for russian text. Use option 2 in NPC for get reputation with Izlude town and you will understand what i mean. You can try other variants of the setd i have made with comments. They will not work correctly too.

NPC isn't giving us 125 rep every time. It will give like this: if rep = 0, then rep = 125. If rep = 125, then rep = 125125...

Hercules Elf Bot - Oct 18, 2012 15:47

Originally posted by [b]AnnieRuru[/b]
change
CallFunc ("get_rep", "125", "Izlude");
into
CallFunc ("get_rep", 125, "Izlude");


125 + 125 = 250
"125" + "125" = "125125"
lol

Hercules Elf Bot - Oct 19, 2012 11:40

Originally posted by [b]Oxxy[/b]
Omg, that's a facepalm. I'm really sorry!