• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Anybody give me a basic rundown, or a link, on how to code with this thing?

Dangnoob

Member
Joined
Jun 8, 2008
Messages
105
Solutions
2
Reaction score
12
So i just need at least like some basic knowledge. I tried figuring it out myself, but it doesnt make any sense? Anytime i change something, it just stops working. Here is an example that im trying to do. Im trying to edit the NPC Trade window, to remove the "buy with backpacks" option, to remove the sell button, just simple stuff like that. Heres the problem.


nptrade.otui

Code:
NPCOfferLabel < Label
  anchors.left: prev.right
  anchors.top: prev.top
  margin-left: 5
  text-auto-resize: true

NPCItemBox < UICheckBox
  border-width: 1
  border-color: #000000
  color: #aaaaaa
  text-align: center
  text-offset: 0 30
  @onCheckChange: modules.game_npctrade.onItemBoxChecked(self)

  Item
    id: item
    phantom: true
    anchors.top: parent.top
    anchors.horizontalCenter: parent.horizontalCenter
    image-color: #ffffffff
    margin-top: 5

  $checked on:
    border-color: #ffffff

  $!checked:
    border-color: #000000

  $!on:
    image-color: #ffffff88
    color: #aaaaaa88

MainWindow
  id: npcWindow
  !text: tr('NPC Trade')
  size: 550 515
  @onEscape: modules.game_npctrade.closeNpcTrade()

  TabButton
    id: buyTab
    !tooltip: tr("List of items that you're able to buy")
    !text: tr('Buy')
    checked: true
    on: true
    anchors.left: parent.left
    anchors.right: parent.horizontalCenter
    anchors.top: parent.top
    margin-right: 5
    margin-top: 5

  TabButton
    id: sellTab
    !tooltip: tr("List of items that you're able to sell")
    !text: tr('Sell')
    anchors.left: parent.horizontalCenter
    anchors.right: parent.right
    anchors.top: parent.top
    margin-left: 5
    margin-top: 5

  FlatPanel
    height: 250
    anchors.left: parent.left
    anchors.right: parent.right
    anchors.top: prev.bottom
    margin-top: 10

    VerticalScrollBar
      id: itemsPanelListScrollBar
      anchors.top: parent.top
      anchors.bottom: parent.bottom
      anchors.right: parent.right
      step: 24
      pixels-scroll: true

    ScrollablePanel
      id: itemsPanel
      height: 250
      anchors.left: parent.left
      anchors.right: prev.left
      anchors.top: parent.top
      anchors.bottom: parent.bottom
      vertical-scrollbar: itemsPanelListScrollBar
      margin-left: 5
      margin-right: 5
      layout:
        type: grid
        cell-size: 160 90
        flow: true
        auto-spacing: true

  FlatPanel
    id: setupPanel
    height: 140
    enabled: false
    anchors.left: parent.left
    anchors.right: parent.horizontalCenter
    anchors.top: prev.bottom
    margin-top: 10
    margin-right: 5
    image-color: #ffffff88

    Label
      !text: tr('Name') .. ':'
      anchors.left: parent.left
      anchors.top: parent.top
      margin-top: 5
      margin-left: 5
      width: 85

    NPCOfferLabel
      id: name

    Label
      !text: tr('Price') .. ':'
      anchors.left: parent.left
      anchors.top: prev.bottom
      margin-top: 5
      margin-left: 5
      width: 85

    NPCOfferLabel
      id: price

    Label
      !text: tr('Your Money') .. ':'
      anchors.left: parent.left
      anchors.top: prev.bottom
      margin-top: 5
      margin-left: 5
      width: 85

    NPCOfferLabel
      id: money

    Label
      id: weightDesc
      !text: tr('Weight') .. ':'
      anchors.left: parent.left
      anchors.top: prev.bottom
      margin-top: 5
      margin-left: 5
      width: 85

    NPCOfferLabel
      id: weight

    Label
      id: capacityDesc
      !text: tr('Your Capacity') .. ':'
      anchors.left: parent.left
      anchors.top: prev.bottom
      margin-top: 5
      margin-left: 5
      width: 85

    NPCOfferLabel
      id: capacity

    HorizontalScrollBar
      id: quantityScroll
      anchors.left: parent.left
      anchors.right: parent.right
      anchors.top: prev.bottom
      margin-top: 5
      margin-left: 5
      margin-right: 5
      show-value: true
      minimum: 1
      maximum: 100
      step: 1
      @onValueChange: modules.game_npctrade.onQuantityValueChange(self:getValue())

  FlatPanel
    id: buyOptions
    height: 140
    anchors.top: prev.top
    anchors.left: parent.horizontalCenter
    anchors.right: parent.right
    margin-left: 5
    image-color: #ffffff88

    Label
      id: searchLabel
      !text: tr('Search') .. ':'
      anchors.left: parent.left
      anchors.top: parent.top
      text-auto-resize: true
      margin-top: 7
      margin-left: 5

    TextEdit
      id: searchText
      anchors.left: prev.right
      anchors.top: prev.top
      anchors.right: parent.right
      margin-top: -2
      margin-left: 5
      margin-right: 5
      @onTextChange: modules.game_npctrade.onSearchTextChange()

    CheckBox
      id: buyWithBackpack
      !text: tr('Buy with backpack')
      anchors.top: searchText.bottom
      anchors.left: parent.left
      anchors.right: parent.right
      margin-left: 5
      margin-top: 5
      @onCheckChange: modules.game_npctrade.onBuyWithBackpackChange()

    CheckBox
      id: ignoreCapacity
      !text: tr('Ignore capacity')
      anchors.top: prev.bottom
      anchors.left: parent.left
      anchors.right: parent.right
      margin-left: 5
      margin-top: 5
      @onCheckChange: modules.game_npctrade.onIgnoreCapacityChange()

    CheckBox
      id: ignoreEquipped
      !text: tr('Ignore equipped')
      anchors.top: searchText.bottom
      anchors.left: parent.left
      anchors.right: parent.right
      margin-left: 5
      margin-top: 5
      visible: false
      checked: true
      @onCheckChange: modules.game_npctrade.onIgnoreEquippedChange()

    CheckBox
      id: showAllItems
      !text: tr('Show all items')
      anchors.top: prev.bottom
      anchors.left: parent.left
      anchors.right: parent.right
      margin-left: 5
      margin-top: 5
      visible: false
      checked: true
      @onCheckChange: modules.game_npctrade.onShowAllItemsChange()

  Button
    id: sellAllButton
    !text: tr('Sell All')
    width: 64
    anchors.right: next.left
    anchors.bottom: parent.bottom
    margin-right: 10
    visible: false
    @onClick: modules.game_npctrade.sellAll()

  Button
    id: tradeButton
    !text: tr('Buy')
    width: 64
    anchors.right: next.left
    anchors.bottom: parent.bottom
    margin-right: 10
    @onClick: modules.game_npctrade.onTradeClick()

  Button
    !text: tr('Close')
    width: 64
    anchors.right: parent.right
    anchors.bottom: parent.bottom
    @onClick: modules.game_npctrade.closeNpcTrade()


Anytime i try to remove anything in this list, it breaks, i was trying to just remove where it says "TabButton id: sellTab" deleting that line and everything below it that is grouped with it. Assuming it would just remove the sell button? But its just breaks the whole trade window. Where would i go to edit this? If anybody has a tutorial link, or could just tell me, thatd be cool. Thanks in advance.
 
If you want to delete element that have an id, you must also delete references to it in lua file.
The easiest way, add
Code:
visible: false
 
Thank you, i have since kind of figured out the basics. I was trying to do advanced stuff now, but thats just too complicated for me lol.
 
Back
Top