The sql_query in my first snippet inputs the owner variable into the global_reg_value table. I'm trying to read it from there.
I got it working after trying to fix it for a few hours. I have no idea how I did it, but here is the complete script (placeholder warp locations) :
prontera,162,188,3 script Butler 862,{
if (getgroupid() == 99) goto T_GM;
set .@accid, getcharid(3);
query_sql "SELECT `account_id` FROM `global_reg_value` WHERE `str`='##owner' AND `account_id`='"+.@accid+"' AND `value`='1'", .@accid2;
if (.@accid == .@accid2){
mes "[butler]";
mes "Would you like to visit your house?";
next;
menu "Yes",T_Warp2, "Visit all houses",T_Warp, "No",quit;
next;
close;
}
mes "[butler]";
mes "I see you do not yet own a house. Are you interested in buying one?";
next;
menu "Tell me more",T_More,"No",quit, "Warp me to the houses",T_Warp;
next;
T_More:
mes "[butler]";
mes "Houses allow you to have some private space on the server with your own NPCs.";
mes "They are available to all characters on your account and you're allowed to";
mes "bring a friend to your house aswell, however, they will not be able to use";
mes "any of the offered NPC services.";
next;
mes "[butler]";
mes "Houses are largely customizable so no house will be the same.";
mes "We also offer guild houses for a larger group of players, however,";
mes "this service will cost a lot more.";
next;
mes "[butler]";
mes "If you would like to buy a house, please check the forum post by Odin.";
close;
T_Warp:
warp "himinn",48,82;
close;
T_Warp2:
warp "prt_in",95,169;
close;
T_GM:
mes "Hi.";
next;
menu "Add house owner",T_Add, "Close",quit;
next;
T_Add:
input .@aid;
if (.@aid <= 0) goto T_Fail;
if (.@aid > 2099999) goto T_Fail;
if (.@aid < 2000000) goto T_Fail;
if (.@aid != 0){
query_sql "INSERT INTO `global_reg_value` (`char_id`, `str`, `value`, `type`, `account_id`) VALUES ('0','##owner','1','1','"+.@aid+"')";
}
end;
close;
T_Fail:
mes "[butler]";
mes "Invalid Account ID";
close;
quit:
close;
}