Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.
epsilon
New User
Posts: 18 Joined: Wed Mar 31, 2010 12:30 am
Post
by epsilon » Fri Apr 02, 2010 10:40 am
Hey!
Got yet another thread. My .online that shows all players online bugs when there are over 260 players on. The same happens to .admin when there are over 200 players on. What happens is the gump that shows the info never opens.
Heres the code:
Code: Select all
use os;
use uo;
include "include/areas";
global layout := {
"page 0",
"nodispose",
"resizepic 50 0 2600 540 405", // background
"resizepic 210 360 5100 200 25", // buttons
"text 260 30 0 0", // title
"text 80 60 0 1", // name
"text 360 60 0 2" // location
};
global data := {
"",
"Name",
"Location",
"", // 4
};
program textcmd_online( who )
FillInArrays();
SendDialogGump( who, layout, data );
endprogram
function FillInArrays()
var city;
// Variables designed to Store The full array of players, the number of players, and the current player
local players := EnumerateOnlineCharacters();
local numplayer := len(players);
local player;
// Counter.
local i := 0, online := 0, locationscount := 5, rowcount :=80, pagecount :=2, playercount :=0;
layout.append("page 1");
// Cycle through all the players in the game and add them to the goto list.
for (i := 1; i <= numplayer; i := i + 1)
player := players[i];
If (player.cmdlevel==0)
online := online +1;
playercount := playercount +1;
if (playercount>13)
playercount :=1;
rowcount :=80;
// add forward button
layout.append("button 350 361 5540 5541 0 " + pagecount);
// add backward button
if (pagecount>2)
layout.append("button 260 361 5537 5538 0 " + (pagecount-2));
endif
layout.append("page " + pagecount);
pagecount := pagecount +1;
endif
layout.append("text 80 " + rowcount + " 0 " + locationscount);
fixname(player);
data.append(data[5]);
locationscount := locationscount + 1;
layout.append("text 360 " + rowcount + " 0 " + locationscount);
city := IsInACity(player);
if(!city OR city == "Blackthorn Castle")
city := "Zulu Territory";
elseif ( city == "British Castle")
city := "Britain";
endif
If( city == "Zulu Territory")
data.append(city);
else
data.append(city+" Territory");
endif
//data.append("Zulu Territory");
locationscount := locationscount + 1;
data.append(player.name);
locationscount := locationscount + 1;
rowcount := rowcount +20;
endif
Sleepms(5);
endfor
data[1] := online + " players online";
if (pagecount>2)
layout.append("button 260 361 5537 5538 0 " + (pagecount-2));
endif
endfunction
function fixname(player)
local oldname :=player.name;
local split := SplitWords( oldname ), i, newname :="";
for (i := 1; i <= 4; i := i + 1)
if (split[i])
newname := newname + split[i] + " ";
endif
endfor
if (GetObjProperty(player,"guardtype")=2)
data[5] := "Chaos : " + newname;
elseif (GetObjProperty(player,"guardtype")=1)
data[5] := "Order : " + newname;
else
data[5] := newname;
endif
endfunction
Turley
POL Developer
Posts: 670 Joined: Sun Feb 05, 2006 4:45 am
Post
by Turley » Fri Apr 02, 2010 11:57 am
ever placed a syslog around senddialoggump ? one possible error could be "Buffer length exceeded" if this exists in pol95 no idea....
epsilon
New User
Posts: 18 Joined: Wed Mar 31, 2010 12:30 am
Post
by epsilon » Fri Apr 02, 2010 1:28 pm
Turley wrote: ever placed a syslog around senddialoggump ? one possible error could be "Buffer length exceeded" if this exists in pol95 no idea....
I don't even know how to get a syslog there :p So that would be a no.
Turley
POL Developer
Posts: 670 Joined: Sun Feb 05, 2006 4:45 am
Post
by Turley » Sat Apr 03, 2010 11:56 am
erm...you are the shardadmin for 320 players? damn.... it seems i did something wrong...
SysLog(SendDialogGump( who, layout, data ));
epsilon
New User
Posts: 18 Joined: Wed Mar 31, 2010 12:30 am
Post
by epsilon » Sat Apr 03, 2010 1:37 pm
Turley wrote: erm...you are the shardadmin for 320 players? damn.... it seems i did something wrong...
SysLog(SendDialogGump( who, layout, data ));
Well, its 250-300 characters on 24/7 and peaks at 340-350 at high times, people are allowed more then one client on at the same time, there is only about 140 unique IPs. The shard have only been open 1.5 weeks so it is still growing. I never needed to use the SysLog though, ill try it later, thanks.
Turley
POL Developer
Posts: 670 Joined: Sun Feb 05, 2006 4:45 am
Post
by Turley » Sat Apr 03, 2010 1:52 pm
epsilon wrote: ... there is only about 140 unique IPs. The shard have only been open 1.5 weeks so it is still growing.
mmmh I live in the wrong country....
btw dont be a fucking lazy boy and do yourself a favor and update to latest core
epsilon
New User
Posts: 18 Joined: Wed Mar 31, 2010 12:30 am
Post
by epsilon » Sat Apr 03, 2010 2:51 pm
Turley wrote: epsilon wrote: ... there is only about 140 unique IPs. The shard have only been open 1.5 weeks so it is still growing.
mmmh I live in the wrong country....
btw dont be a fucking lazy boy and do yourself a favor and update to latest core
Most players are from the states actually. Almost none is from the same country the shard is hosted/run from.
xeon
Forum Regular
Posts: 338 Joined: Fri Oct 31, 2008 3:18 am
Post
by xeon » Sun Apr 04, 2010 2:13 am
There's a limit on the size of the SendDialogGump's arguments of about 400-500 lines.
If you're input are greater than this, that function doesn't work.
epsilon
New User
Posts: 18 Joined: Wed Mar 31, 2010 12:30 am
Post
by epsilon » Sun Apr 04, 2010 2:43 am
xeon wrote: There's a limit on the size of the SendDialogGump's arguments of about 400-500 lines.
If you're input are greater than this, that function doesn't work.
Would make sense since its inputting both locations and playernames...
Turley
POL Developer
Posts: 670 Joined: Sun Feb 05, 2006 4:45 am
Post
by Turley » Sun Apr 04, 2010 2:51 am
nope it has nothing to do with lines just packetsize. You cannot send more then 0xFFFF bytes
epsilon
New User
Posts: 18 Joined: Wed Mar 31, 2010 12:30 am
Post
by epsilon » Sun Apr 04, 2010 3:01 am
Turley wrote: nope it has nothing to do with lines just packetsize. You cannot send more then 0xFFFF bytes
Ahh, either way, it worked when I just inputted playernames, apparently it cannot handle both names and locations.
epsilon
New User
Posts: 18 Joined: Wed Mar 31, 2010 12:30 am
Post
by epsilon » Fri Apr 09, 2010 12:55 pm
Now none of my gump commands that lists players work. 439 characters on currently. Anyone want to help me review my .goto code and see if any changes would make it work? I tried all I can but I cannot make it work :p. I tried putting a SysLog around the SendDialogGump but nothing pops up in debug.log which I guess is the thing that should show it? Code is here:
Code: Select all
use uo;
use os;
program textcmd_goto( character, whom )
whom := upper( whom );
var chr := MakeAndProcessGump( character,whom);
if( chr )
MoveCharacterToLocation( character, chr.x, chr.y, chr.z, MOVECHAR_FORCELOCATION );
endif
endprogram
function MakeAndProcessGump( who,whom)
var layout := array( "page 0",
"resizepic 50 0 2600 300 525",
"resizepic 100 480 5100 200 25",
"text 155 30 5 0");
var data := array( "Goto Menu");
var playername;
var lastindex:=0;
var maxlen:=len(whom);
var players := EnumerateOnlineCharacters();
var start := 1;
var count := 0;
var done := 0;
var page := 1;
var perpage := 20;
var y := 70;
var i;
var j;
var uhunter;
layout.append( "page 1" );
for( i := start; i <= len(players); i := i + 1 )
uhunter:=CInt(GetObjProperty(players[i],"UHunter"));
playername:=upper(players[i].name);
if ((playername[1,maxlen]==whom) && ( (uhunter==0)|| ( who.cmdlevel>3 ) ))
if( done == perpage )
done := 0;
page := page + 1;
y := 70;
layout.append( "button 250 481 5540 5541 0 " + (page ) ); // Next button for prev page
layout.append( "page " + page );
layout.append( "button 125 481 5537 5538 0 " + (page - 1) ); // Prev button for current page
endif
if( players[i].cmdlevel <= who.cmdlevel)
if (players[i].cmdlevel > 0)
layout.append( "text 85 " + y + " 51 " + len(data) );
else
layout.append( "text 85 " + y + " 0 " + len(data) );
endif
layout.append( "button 300 " + (y+5) + " 2118 2117 1 0 " + i );
data.append( players[i].name );
y := y + 20;
done := done + 1;
count := count + 1;
lastindex:=i;
endif
endif
endfor
if (count>0)
var result;
if (count==1)
result:=lastindex;
else
result := SendDialogGump( who, layout, data );
if( !result[0] )
return;
endif
result := CInt( result[0] );
endif
return players[result];
else
SendSysMessage(who, "No player with name '"+ whom +"*' was found.");
return;
endif
endfunction
Turley
POL Developer
Posts: 670 Joined: Sun Feb 05, 2006 4:45 am
Post
by Turley » Fri Apr 09, 2010 10:02 pm
nope not debug.log its pol.log
epsilon
New User
Posts: 18 Joined: Wed Mar 31, 2010 12:30 am
Post
by epsilon » Sat Apr 10, 2010 1:43 am
Turley wrote: nope not debug.log its pol.log
Well, I get no error message at all in there when placing SysLog( ) around my SendDialogGump, I tried with all the commands that bug up. I did have some "Runaway script" warning on them but they appeared no matter if I had SysLog placed or not.
CWO
POL Expert
Posts: 1160 Joined: Sat Feb 04, 2006 5:49 pm
Post
by CWO » Sat Apr 10, 2010 9:55 pm
Thats why I rewrote my gumps to not use the built in pages for dynamic stuff like players. It builds one page and if they hit next for more, it builds the next page separately.
epsilon
New User
Posts: 18 Joined: Wed Mar 31, 2010 12:30 am
Post
by epsilon » Sun Apr 11, 2010 1:18 am
CWO wrote: Thats why I rewrote my gumps to not use the built in pages for dynamic stuff like players. It builds one page and if they hit next for more, it builds the next page separately.
Good idea
I will look into that.
epsilon
New User
Posts: 18 Joined: Wed Mar 31, 2010 12:30 am
Post
by epsilon » Sun Apr 11, 2010 6:00 am
Only one problem, how can I get it to clear an array? I use this to put the characters in a data array: data.append( character.accname);
How can I clear what have been put into data before?
CWO
POL Expert
Posts: 1160 Joined: Sat Feb 04, 2006 5:49 pm
Post
by CWO » Sun Apr 11, 2010 9:00 am
data := array{};