Author Topic: NewMesageHud?  (Read 1515 times)

NMH::addLine doesn't work...?

rudyman

  • Guest
NMH_Type is the Message Hud, the text box you type in to send messages.

It would be way better just to use messageClient() or messageAll() to do this, but....

If you just want to know how to add a line to the new chat hud, use this:
Code: [Select]
function displayLatest()
{
%obj=MissionCleanup.getObject(2);
NewChatSO::displayLatest(%obj);
}
function newChatText::addLine(%this,%text)
{
%this.addText("\n"@%text,1);
schedule(4000,0,displayLatest);
}

This uses newChatText.addLine("TEXT HERE");

Code: [Select]
function NMH_Type::send(%this) {
%text = cleanStringemot(trim(%this.getValue()));
if(strstr(strlwr(%text),"/") == 0) {
  %text = getSubStr(%text,1,strlen(%text));
  %command = getword(%text,0);
  if(getwordcount(%text)>=2) {
    %vars = getwords(%text,1,getwordcount(%text));
    %vars = getsubstr(%vars,0,strlen(%vars)-1);
eval("commandtoserver(\'"@%command@"\',\"" @ %vars @ "\");");
//echo("commandtoserver(\'"@%command@"\',\"" @ %vars @ "\");");
  }
  else {
    eval("commandtoserver(\'"@%command@"\');");
    //echo("commandtoserver(\'"@%command@"\');");
  }
  canvas.popdialog(NewMessageHud);
  return;
}
else if(%text !$= "") {
  if(NewMessageHud.isTeamMsg)
commandToServer('teamMessageSent',%text);
  else if(NewMessageHud.isLocalMsg)
commandToServer('localMessageSent',%text);
  else
commandToServer('messageSent',%text);
}
canvas.popdialog(NewMessageHud);
//activateKeyboard();
}
And I'll try your script there, rudy. Since you don't have Retail, it may not work, since you can't check. I'm not saying you can't script btw.