I have been trying to create a skilljournal, but there is a little problem.. while clicking a button, the foreach wont list the skills.. and I can't understand why. I have been trying to fix it testing different methods, but they always fail
It wont print nor send a message, therefore the showskill_function wont trigger.. what am I doing wrong?
Code: Select all
use uo;
use os;
include ":attributes:attributes";
include ":gumps:gumps";
include ":gumps:gumps_ex";
program GumpTest(who)
var gump := GFCreateGump();
GFDisposable(gump, 0);
GFResizePic(gump, 120, 150, 2520, 450, 400);
GFTextLine(gump, 300, 160, hue:=1050, text:="Skill Journal");
GFTextLine(gump, 195, 193, hue:=1153, text:="All skills");
GFAddButton(gump, 170, 196, 2117, 2118, GF_DUMMY_BTN, 1);
GFTextLine(gump, 195, 210, hue:=1153, text:="Miscellaneous");
GFAddButton(gump, 170, 213, 2117, 2118, GF_DUMMY_BTN, 2);
GFTextLine(gump, 195, 227, hue:=1153, text:="Combat Skills");
GFAddButton(gump, 170, 230, 2117, 2118, GF_DUMMY_BTN, 3);
GFTextLine(gump, 195, 244, hue:=1153, text:="Actions");
GFAddButton(gump, 170, 247, 2117, 2118, GF_DUMMY_BTN, 4);
GFTextLine(gump, 195, 261, hue:=1153, text:="Lore & Knowledge");
GFAddButton(gump, 170, 264, 2117, 2118, GF_DUMMY_BTN, 5);
show_skill(who, gump, "_allskills");
var input := GFSendGump(who, gump);
case (input[0])
1: show_skill(who, gump, "_allskills");
2: show_skill(who, gump, "_misc");
3: show_skill(who, gump, "_combat");
4: show_skill(who, gump, "_actions");
5: show_skill(who, gump, "_lore");
endcase
endprogram
function show_skill(who, gump, skill_type)
GFPage(gump, 1);
var y_pos := 300;
var x_pos := 400;
var counter := 0;
var getclass := GetObjProperty(who, "profession");
var config := ReadConfigFile(":professions:AllSkills");
var elem := FindConfigElem(config, (getclass["class"]+skill_type));
if(!elem)
Print("Cannot find element");
else
SendSysMessage(who, elem);
endif
var skill_list := GetConfigStringArray(elem, "Skill");
foreach key in ( skill_list )
GFTextLine(gump, 175, y_pos, 2100, key);
var skill_value := GetAttributeBaseValue(who, key);
GFTextLine(gump, x_pos, y_pos, 2100, ((skill_value)/10));
var skill_change := GetAttributeTemporaryMod(who, key);
if(skill_change > 0)
GFTextLine(gump, x_pos+35, y_pos, 2100, ("(+" + (skill_change)*0.1 + ")"));
endif
counter += 1;
y_pos += 20;
if ( counter >= 10 && _key_iter < skill_list.Size() )
GFAddButton(gump, 520, 490, 2706, 2707, 0, gump.cur_page+1);
GFPage(gump, gump.cur_page+1);
GFAddButton(gump, 520, 280, 2704, 2705, 0, gump.cur_page-1);
counter := 0;
y_pos := 300;
endif
SleepMS(2);
endforeach
endfunction