Addyt Hall manager script
The following is the Addyt Hall manager script. It fails in one respect because the get() function will not fetch another player's authorization.
I seek a work around.
Also, this seeks approval of using the Addyt_GM variable for Addyt Hall manager status.
As it is an entity within the Manaworld, it may have managers that are entirely separate from the Manaworld GM's, and with none of the usual GM abilities.
BUG: This will always fetch 0, even for the current user, even right after the variable was set. It has been verified that the set worked, at least for @target_id = BL_ID.
This affects being able to see the current state in the Manager's function.
Other scripts have variations of using get(), but maybe the variable they access is somewhat "special".
Tests have shown that it will work if the var is @Addyt_GM instead, but of course that is a temporary, and not suitable for holding a permanent status.
Code: Select all
set .@AGM, get( Addyt_GM, @target_id );
BUG:
This line will crash the server instantly and without decent error messages. You have to randomly change code to even find which line caused the crash. No script bug should ever be allowed to crash the server.
Code: Select all
if( ! isloggedin(BL_ID)) goto L_close;
The manager click spot.
Code: Select all
// Addyt Hall
008-2,16,42,0|script|Manager#AddytHall|400
{
// WARNING: if( ! isloggedin(BL_ID)) --> will CRASH THE SERVER
if( ! (isloggedin(BL_ID)) ) goto L_close;
if( Addyt_GM || (GM >= G_ADMIN) ) goto L_menu;
mes "That is the managers shelf, no snooping.";
goto L_close;
L_menu:
mes "[Addyt Hall Manager]";
menu
"Manage Quest Board", L_manage_quest_board,
"Manage Message Board", L_manage_message_board,
"Manage Addyt_GM", L_self;
L_GM_menu:
mes "[Addyt Hall Manager]";
// BUG: Cannot get current value because the following line does not work (due to var type).
// set .@AGM, get( Addyt_GM, @target_id );
mes @who$+" : "+@target_id+" : "+if_then_else(.@AGM, "AUTHORIZED", "Not-Authorized");
menu
"Enable Addyt_GM", L_set_manager,
"Disable Addyt_GM", L_clear_manager,
"Select user", L_another,
"Done", L_menu;
L_self:
set @who$, "SELF";
set @target_id, BL_ID;
goto L_GM_menu;
L_another:
mes "Who to authorize (name, SELF).";
input @who$;
if( @who$ == "SELF" ) goto L_self;
set @target_id, getcharid(3, @who$);
goto L_GM_menu;
L_set_manager:
set Addyt_GM, 1, @target_id;
goto L_GM_menu;
L_clear_manager:
set Addyt_GM, 0, @target_id;
goto L_GM_menu;
L_manage_quest_board:
callfunc( "quest_board_manage" );
goto L_menu;
L_manage_message_board:
callfunc( "message_board_manage" );
goto L_menu;
L_close:
close;
}