Project

General

Profile

 

Also available in: PDF

EQ2UIElements: NPC Conversation Tutorial

EQ2UIElements Tutorial

NPC Conversation Tutorial

This is a brief tutorial on how to access information about NPC conversation and using those in your scripts.

First, let's look at the first few lines of the xml file that contains the information about NPC conversation windows: eq2ui_proxyactor.xml:


<?xml version="1.0" encoding="utf-8"?>
    <Page AbsorbsInput="false" ismodule="true" Name="ProxyActor" ScrollExtent="1024,768" Size="1024,768" Visible="false">
        <TextStyle Algorithm="Simple" FontName="Zapf Calligraphic 801 Bold BT" Language="english" Name="Font_ChatBubble" PointSize="15" PrivateFontPath="UI/Fonts/zcal801b.TTF" UseCachedFont="true"/>
        <Page AbsorbsInput="false" Name="Conversation" ScrollExtent="754,240" Size="754,240" Visible="false">
            <Composite Name="Replies" ScrollExtent="301,173" Size="301,173" Spacing="10" SpacingType="Constant"/>
            <Button AutoResize="true" LocalText="[DEVL]Tell me more about the person who stole your sword." Margin="15,10,15,10" MaximumSize="300,16384" MinimumSize="75,28" Name="ReplyTemplate" ScrollExtent="75,28" Size="75,28" Style="/ButtonStyles.text_button_biground" TextMaxLines="255" Visible="false">[DEVL]Tell me more about the person who stole your sword.</Button>
            <Page AbsorbsInput="false" BackgroundColor="#FF0000" GetsInput="false" Name="ChatPage" ScrollExtent="222,78" Size="222,78">
                <Text AbsorbsInput="false" BackgroundColor="#FFFFFF" Cursor="/Cursor.Text" ExtendedTooltip="Displays chat messages." Font="/Fonts.FontZapf18" GetsInput="false" LocalText="[DEVL]This is a sample chat bubble with word wrapping." Margin="2,0,2,0" MaximumSize="225,16384" MaxLines="255" MinimumSize="50,35" Name="MessageText" ScrollExtent="225,46" Size="225,46" TextAlignment="Center" TextAlignmentVertical="Center" TextColor="#000000">[DEVL]This is a sample chat bubble with word wrapping.</Text>


Now, the information that really interests us is the "Composite" UI Type called 'Replies'. A composite is, for lack of a better description, a dynamic 'page' that can contain its own children without the need for a seperate xml file.

The other thing that interests us is the "Text" UI type called 'MessageText' (you'll also notice that it's embedded underneath a sub-page). A "Text" UI type is simply any type of text that's displayed on the UI. It can include things such as labels or the actual data. In this instance, "MessageText" is actually the text that the NPC is telling you (in other words, that big white chat bubble)

Now, we can begin to utilize functionality provided by ISXEQ2:

  • ${EQ2UIPage[ProxyActor,Conversation].Child[Text,ChatPage.MessageText].Label}
    • This would be the last thing the NPC said to you.
  • ${EQ2UIPage[ProxyActor,Conversation].Child[composite,replies].NumChildren}
    • This would be the number of children contained within the composite 'replies'. In this case, we know that all of the children are going to be buttons that we click on to give the NPC our response. So, if there are two possible responses to the NPC's last statement, then this will return "2".
  • ${EQ2UIPage[ProxyActor,Conversation].Child[composite,replies].Child[button,1].Label}
    • This would return the label text of the first button/response.
  • EQ2UIPage[ProxyActor,Conversation].Child[composite,replies].Child[button,1]:LeftClick
    • This would click on the first button/response!