Jump to content
  • 0

Html Embed Code


Question

Posted (edited)

hi, I ask for help to friends.

 

wanted to make a .test type command they had a way of putting type htm, but it was in own code and not in normal files as test.htm wanted within the own code.

public class Test implements IVoicedCommandHandler {

    private String[] _commandList = new String[] { "test" };

    @Override
    public boolean useVoicedCommand(String command, Player activeChar, String target)
    {
        
        if (command.equals("test"))
        {
           HERE DID NOT WANT FOR HTM, I WANTED BY FIXED CODE
        }
        return true;    
    }

    @Override
    public String[] getVoicedCommandList() {
    return _commandList;

        }
   }

Ex:

 

npcHtmlMessage.setHtml("<html><title>Exemple</title><body><center></center></body></html>"); ? ? ?

 

or

 

text = "<html><body>" + text + "</body></html>";

Edited by nery

5 answers to this question

Recommended Posts

  • 0
Posted (edited)


if (command.equals("test"))

showWindow(activeChar);

 

 

public void showWindow(L2PcInstance player)

{

NpcHtmlMessage html = new NpcHtmlMessage(1);

StringBuilder sb = new StringBuilder();

 

sb.append("<html><body>");

sb.append("whatever");

sb.append("</body></html>"); //you can skip it, it's not rly required to close

 

html.setHtml(sb.toString());

html.replace("%objectId%", getObjectId()); //can be skipped

player.sendPacket(html);

}

 

Edited by SweeTs
  • 0
Posted

hi, I ask for help to friends.

 

wanted to make a .test type command they had a way of putting type htm, but it was in own code and not in normal files as test.htm wanted within the own code.

public class Test implements IVoicedCommandHandler {

    private String[] _commandList = new String[] { "test" };

    @Override
    public boolean useVoicedCommand(String command, Player activeChar, String target)
    {
        
        if (command.equals("test"))
        {
           HERE DID NOT WANT FOR HTM, I WANTED BY FIXED CODE
        }
        return true;    
    }

    @Override
    public String[] getVoicedCommandList() {
    return _commandList;

        }
   }

Ex:

 

npcHtmlMessage.setHtml("<html><title>Exemple</title><body><center></center></body></html>"); ? ? ?

 

or

 

text = "<html><body>" + text + "</body></html>";

 

in my case there is no command L2PcInstance player, how do? I put al the complete code for u help me where change

 

package l2f.gameserver.handler.voicecommands.impl;

import org.apache.commons.lang3.math.NumberUtils;

import l2f.gameserver.Config;
import l2f.gameserver.handler.voicecommands.IVoicedCommandHandler;
import l2f.gameserver.model.Player;
import l2f.gameserver.network.serverpackets.NpcHtmlMessage;
import l2f.gameserver.scripts.Functions;

public class Test implements IVoicedCommandHandler {

    private String[] _commandList = new String[] { "test" };

    @Override
    public boolean useVoicedCommand(String command, Player activeChar, String target)
    {
        
        if (command.equals("test"))
        {
            NpcHtmlMessage html = new NpcHtmlMessage(activeChar.getObjectId());
            html.setFile("data/test.htm");
            activeChar.sendPacket(html);
        }
        return true;    
    }

    @Override
    public String[] getVoicedCommandList() {
        return _commandList;

        }
   }
  • 0
Posted (edited)

What a hell pack are you using and where have you put it? Show the preview after your changes. You can make it public static.

Edited by SweeTs

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...