Online character list?
Online character list?
Sorry for me asking all the dumb questions lately, but i was wondering if someone could make/help me make a .online scipt shows all online characters.
Try this one Poi:
Not sure where I got it but it should do the trick.
Code: Select all
use uo;
global layout := {
"nodispose",
"page 0",
"resizepic 0 20 2620 310 470",
"gumppic 15 50 2621",
"text 20 29 40 0",
};
global data := {
"Online Characters",
"Score"
};
program textcmd_online (character)
if (CINT (GetObjProperty (character, "#checkonline")) > ReadGameClock())
SendSysmessage (character, "That gump is already open!");
return;
endif
SetObjProperty (character, "#checkonline", CINT(ReadGameClock() + 120));
FillInArrays (character);
local gump_return := SendDialogGump (character, layout, data);
if (!gump_return and gump_return[0] != 0)
SendSysMessage (character, "You must close other gumps before you can do this.");
endif
EraseObjProperty (character, "#checkonline");
endprogram
function FillInArrays (character)
var all_players := EnumerateOnlineCharacters ();
var players := {};
foreach player in all_players
if (player.cmdlevel)
if (IsAGM (character))
players.append (player);
endif
else
players.append (player);
endif
endforeach
var pagecount := 1;
var ypos := 70;
var string_counter := 2;
var totalplayers := len (players);
layout.append ("page " + pagecount);
for playercount := 1 to totalplayers
var player := players [playercount];
layout.append ("text 20 " + ypos + " 40 " + string_counter);
string_counter := string_counter + 1;
ypos:= ypos + 20;
if (!GetObjProperty (player, "private"))
data.append (playercount +". " + player.name);
else
data.append (playercount +". " + player.name + " [AFK]");
endif
if (playercount = totalplayers)
return;
endif
case (playercount)
20:
40:
60:
80:
100:
layout.append ("button 285 30 2648 2647 0 " + (pagecount + 1));
pagecount := pagecount + 1;
layout.append ("page " + pagecount);
ypos := 70;
layout.append ("button 255 30 2650 2651 0 " + (pagecount - 1));
endcase
endfor
endfunction
function IsAGM (character)
if (character.cmdlevel)
return 1;
endif
return 0;
endfunction
You will have to open a DOS command pronpot window from Programs --> Accessories and then run ecompile from there or download and use the Scite editor and use it. I have a copy of Scite at the following link: http://www.hopelives.us/Files/SciTe95.zip
It displays the compiler output at the bottom of its window.
It displays the compiler output at the bottom of its window.
Also i added a line to the top of scripts, so -1 to eachof the #'s
->e:\pol\scripts\ecompile.exe
EScript Compiler v1.03
Copyright (C) 1994-2003 Eric N. Swanson
Compiling: E:/pol/scripts/online.src
Warning: Found deprecated token 'global' on line 4 of E:\pol\scripts\online.src
Expected expression following comma before right-brace in array initializer list
Error getting elements for array
Error compiling statement at E:\pol\scripts\online.src, Line 4
Compilation Error:
Near: global layout := {
File: E:\pol\scripts\online.src, Line 9
Execution aborted due to: Error compiling file
->
->e:\pol\scripts\ecompile.exe
EScript Compiler v1.03
Copyright (C) 1994-2003 Eric N. Swanson
Compiling: E:/pol/scripts/online.src
Warning: Found deprecated token 'global' on line 4 of E:\pol\scripts\online.src
Expected expression following comma before right-brace in array initializer list
Error getting elements for array
Error compiling statement at E:\pol\scripts\online.src, Line 4
Compilation Error:
Near: global layout := {
File: E:\pol\scripts\online.src, Line 9
Execution aborted due to: Error compiling file
->
Last edited by Poi on Tue Apr 18, 2006 1:37 pm, edited 1 time in total.
OK here is the updated for POL 95 version. Sorry about the errors in the original. This one does compile in POL 95.
Code: Select all
use uo;
var layout := {
"nodispose",
"page 0",
"resizepic 0 20 2620 310 470",
"gumppic 15 50 2621",
"text 20 29 40 0"
};
var data := {
"Online Characters",
"Score"
};
program textcmd_online (character)
if (CINT (GetObjProperty (character, "#checkonline")) > ReadGameClock())
SendSysmessage (character, "That gump is already open!");
return;
endif
SetObjProperty (character, "#checkonline", CINT(ReadGameClock() + 120));
FillInArrays (character);
var gump_return := SendDialogGump (character, layout, data);
if (!gump_return and gump_return[0] != 0)
SendSysMessage (character, "You must close other gumps before you can do this.");
endif
EraseObjProperty (character, "#checkonline");
endprogram
function FillInArrays (character)
var all_players := EnumerateOnlineCharacters ();
var players := {};
foreach player in all_players
if (player.cmdlevel)
if (IsAGM (character))
players.append (player);
endif
else
players.append (player);
endif
endforeach
var pagecount := 1;
var ypos := 70;
var string_counter := 2;
var totalplayers := len (players);
layout.append ("page " + pagecount);
for playercount := 1 to totalplayers
var player := players [playercount];
layout.append ("text 20 " + ypos + " 40 " + string_counter);
string_counter := string_counter + 1;
ypos:= ypos + 20;
if (!GetObjProperty (player, "private"))
data.append (playercount +". " + player.name);
else
data.append (playercount +". " + player.name + " [AFK]");
endif
if (playercount == totalplayers)
return;
endif
case (playercount)
20:
40:
60:
80:
100:
layout.append ("button 285 30 2648 2647 0 " + (pagecount + 1));
pagecount := pagecount + 1;
layout.append ("page " + pagecount);
ypos := 70;
layout.append ("button 255 30 2650 2651 0 " + (pagecount - 1));
endcase
endfor
endfunction
function IsAGM (character)
if (character.cmdlevel)
return 1;
endif
return 0;
endfunction