quest automex begin
state start begin
when letter with pc . is_gm ( ) begin
send_letter ( "Pannello GM" )
end
when button or info begin
a = select ( "Attiva AutoMessaggio" , "Disattiva AutoMessaggio" , "Setta AutoMessaggio" , "Setta Tempo Tra Le Notizie" , "Chiudi" )
if a == 1 then
if game . get_event_flag ( "auto" ) >= 1 then
say ( "E' gia attivo" )
else
say ( "AutoMessaggio Attivato" )
game . set_event_flag ( "auto" , 1 )
server_timer ( "mex" , t )
end
elseif a == 2 then
say ( "AutoMessaggio Disattivato" )
game . set_event_flag ( "auto" , 0 )
clear_server_timer ( "mex" )
clear_server_timer ( "mex1" )
elseif a == 3 then
say ( "Inserisci il messaggio" )
s = input ( )
elseif a == 4 then
say ( "inserisci il tempo:" )
m = tonumber(input())
if m == nil then
say ( "Devi inserire un numero" )
elseif m < 1 then
say ( "Devi inserire un numero positivo" )
else
h = select ( "Secondi" , "Minuti" , "Ore" )
if h == 1 then
t = m
elseif h == 2 then
t = tonumber(m * 60)
elseif h == 3 then
t = tonumber(m * 60 * 60)
end
end
end
end
when mex.server_timer begin
if game . get_event_flag ( "auto" ) == 1 then
notice_all ( ""..s )
server_timer ( "mex1" , t )
else
end
end
when mex1.server_timer begin
if game . get_event_flag ( "auto" ) == 1 then
notice_all ( ""..s )
server_timer ( "mex" , t )
else
end
end
end
end