Написание .msg
use uo;
var playercount := 0;
var pagecount := 1;
var layout := array(
"page 0",
"gumppic 0 50 2620",
"gumppic 20 50 2621",
"gumppic 290 50 2622",
"gumppic 0 68 2623",
"gumppic 22 68 2624",
"gumppic 288 68 2625",
"gumppic 0 272 2623",
"gumppic 22 272 2624",
"gumppic 288 272 2625",
"gumppic 0 476 2626",
"gumppic 20 476 2627",
"gumppic 290 476 2628",
"gumppic 20 80 2621",
"text 20 59 40 0",
"text 260 59 40 1"
);
var data := array(
"Player Name", //0
"Message"
);
program textcmd_goto( character, whom )
if(!whom)
FillInArrays();
var result := SendDialogGump( character, layout, data );
var name := data[result[0]+2];
foreach onlinechr in EnumerateOnlineCharacters()
if (onlinechr.name == name)
SendTheMessage(character, onlinechr);
break;
endif
endforeach
else
whom := upper(whom);
foreach onlinechr in EnumerateOnlineCharacters()
if (upper(onlinechr.name) == whom)
SendTheMessage(character, onlinechr);
break;
endif
endforeach
endif
endprogram
function FillInArrays()
var players := EnumerateOnlineCharacters();
var datalen;
var layoutlen;
var prev_y := CInt(80);
var datindx;
var buttonret := 1;
layout[GetLayoutLength()+1] := "page " + pagecount;
if( len(EnumerateOnlineCharacters()) > 19)
layout[GetLayoutLength()+1] := "button 285 465 2648 2647
0 " + (pagecount + 1);
endif
foreach player in players
if (!player.concealed)
playercount := playercount + 1;
datalen := GetDataLength();
layoutlen := GetLayoutLength();
datindx := datalen+1;
data[datindx] := player.name;
if( playercount == 20 || playercount == 39 ||
playercount == 58 || playercount == 77 || playercount ==
96)
pagecount := pagecount + 1;
layout[GetLayoutLength()+1] := "page " + pagecount;
prev_y := 80;
layout[GetLayoutLength()+1] := "button 285 85 2650 2651
0 " + (pagecount - 1);
if( len(EnumerateOnlineCharacters()) > playercount + 19)
layout[GetLayoutLength()+1] := "button 285 465 2648 2647
0 " + (pagecount + 1);
endif
endif
layout[GetLayoutLength()+1] := ("text 20 " + CStr(prev_y
+ 20) + " 40 " + datalen);
layout[GetLayoutLength()+1] := ("button 260 " +
CStr(prev_y + 20) + " 2640 2641 1 0 " + buttonret);
prev_y := prev_y + 20;
buttonret := buttonret + 1;
endif
endforeach
endfunction
function GetLayoutLength();
return (len(layout));
endfunction
function GetDataLength();
return (len(data));
endfunction
function SendTheMessage(who, whom)
var themessage := RequestInput(who, who.backpack, "What
message would you like to send to " + whom.name + "?");
if (!themessage)
return;
endif
SendSysMessage(whom, who.name + " : " + themessage);
foreach char in EnumerateOnlineCharacters()
if ( (char.cmdlevel == 5) && (GetObjProperty(char,
"HearMsgs") ) )
SendSysMessage( char, "Msg from " + who.name + " to " +
whom.name + ": " + themessage);
endif
endforeach
endfunction |