• 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!

[Module] game_shop

Could you pass me the margins of the addons.otui file?
X0iUNbFjTiqk8aE3T0bsrg.png
 
Last edited:
Just slap a margin-left: 5 on each of those elements. Also it seems like the images are squished, you can check their size and then do size: W H to make them appear in their fully quality.
thanks for your answer. I managed to solve the margins using photophop graphics editor. When I put margin-left: 5 the pictures disappear from the box.
rGz9oI9MRfiqaeuqfgA1dw.png


I have another problem, when I try to add the fourth image, all the previous images disappear. I am doing something wrong? or do I need some code that I'm not using?
P83Cg-atQ8KAv3SV9-bAaQ.png


When I add the fourth image, it sends me back to the box without images above.
Here I leave the code used "Otui & Lua"
Code Otui:
CSS:
AddonButton < UIButton
  width: 101
  height: 125
  margin-left: 5
  margin-bottom: 5

Panel
  AddonButton
    image-source: /modules/game_shop/images/buttonimg/addon_assassin
    anchors.top: parent.top
    anchors.left: parent.left
    @onClick: modules.game_shop.buyAssassin()

  AddonButton
    image-source: /modules/game_shop/images/buttonimg/addon_barbarian
    anchors.top: prev.top
    anchors.left: prev.right
    @onClick: modules.game_shop.buyBarbarian()

  AddonButton
    image-source: /modules/game_shop/images/buttonimg/addon_beggar
    anchors.top: prev.top
    anchors.left: prev.right
    @onClick: modules.game_shop.buyBeggar()

Code Lua:
Lua:
local shopWindow
local shopButton
local shopTabBar
local addonsPanel
local itemsPanel
local premiumPanel
local mountsPanel
local acceptWindow

function init()
  shopWindow = g_ui.displayUI('shop')
  shopWindow:hide()
 
  shopTabBar = shopWindow:getChildById('shopTabBar')
  shopTabBar:setContentWidget(shopWindow:getChildById('shopTabContent'))

  addonsPanel = g_ui.loadUI('addons')
  shopTabBar:addTab(tr('Addons'), addonsPanel, '/modules/game_shop/images/shoptabs/addons')

  itemsPanel = g_ui.loadUI('items')
  shopTabBar:addTab(tr('Items'), itemsPanel, '/modules/game_shop/images/shoptabs/items')

  mountsPanel = g_ui.loadUI('mounts')
  shopTabBar:addTab(tr('Mounts'), mountsPanel, '/modules/game_shop/images/shoptabs/mounts')

  premiumPanel = g_ui.loadUI('premium')
  shopTabBar:addTab(tr('Premium'), premiumPanel, '/modules/game_shop/images/shoptabs/premium')

  shopButton = modules.client_topmenu.addLeftGameButton('shopButton', tr('Shop'), '/modules/game_shop/images/shop', toggle)
end

function terminate()
  shopWindow:destroy()
  shopButton:destroy()
end

function toggle()
  if shopWindow:isVisible() then
    hide()
  else
    show()
  end
end

function show()
  shopWindow:show()
  shopWindow:raise()
  shopWindow:focus()
end

function hide()
  shopWindow:hide()
  if acceptWindow then
    acceptWindow:destroy()
    acceptWindow = nil
  end
end

function addTab(name, panel, icon)
  shopTabBar:addTab(name, panel, icon)
end

function addButton(name, func, icon)
  shopTabBar:addButton(name, func, icon)
end

-- Buy functions:

-- Addons Assassin
function buyAssassin()
  if acceptWindow then
    return true
  end

  local acceptFunc = function()
    g_game.talk('!outfits assassinfull')
    acceptWindow:destroy()
    acceptWindow = nil
  end
 
  local cancelFunc = function() acceptWindow:destroy() acceptWindow = nil end

  acceptWindow = displayGeneralBox(tr('Accept transaction'), tr("Do you really want to buy this item?"),
  { { text=tr('Yes'), callback=acceptFunc },
    { text=tr('No'), callback=cancelFunc },
    anchor=AnchorHorizontalCenter }, acceptFunc, cancelFunc)
  return true
end

-- Addons Barbarian
function buyBarbarian()
  if acceptWindow then
    return true
  end

  local acceptFunc = function()
    g_game.talk('!outfits barbarian')
    acceptWindow:destroy()
    acceptWindow = nil
  end
 
  local cancelFunc = function() acceptWindow:destroy() acceptWindow = nil end

  acceptWindow = displayGeneralBox(tr('Accept transaction'), tr("Do you really want to buy this item?"),
  { { text=tr('Yes'), callback=acceptFunc },
    { text=tr('No'), callback=cancelFunc },
    anchor=AnchorHorizontalCenter }, acceptFunc, cancelFunc)
  return true
end

-- Addons Beggar
function buyBeggar()
  if acceptWindow then
    return true
  end

  local acceptFunc = function()
    g_game.talk('!outfits beggar')
    acceptWindow:destroy()
    acceptWindow = nil
  end
 
  local cancelFunc = function() acceptWindow:destroy() acceptWindow = nil end

  acceptWindow = displayGeneralBox(tr('Accept transaction'), tr("Do you really want to buy this item?"),
  { { text=tr('Yes'), callback=acceptFunc },
    { text=tr('No'), callback=cancelFunc },
    anchor=AnchorHorizontalCenter }, acceptFunc, cancelFunc)
  return true
end

How do I add the fourth image next to the third image without disappearing from the box? and how would the code be used to add the following below the first image.

I tried to play with these codes but they do not work for me or they just I dont add them correctly.

CSS:
 margin-top: 5
 margin-left: 5
 margin-right: 5
 margin-bottom: 5


  anchors.left: parent.left
  anchors.bottom: parent.bottom
  anchors.right: parent.right
  anchors.top: parent.top

  anchors.left: prev.left
  anchors.bottom: prev.bottom
  anchors.right: prev.right
  anchors.top: prev.top
Could you support me?
 
Last edited:
thanks for your answer. I managed to solve the margins using photophop graphics editor. When I put margin-left: 5 the pictures disappear from the box.
rGz9oI9MRfiqaeuqfgA1dw.png


I have another problem, when I try to add the fourth image, all the previous images disappear. I am doing something wrong? or do I need some code that I'm not using?
6cXcVrMgSJaZGWzn8kN2Tw.png


When I add the fourth image, it sends me back to the box without images above.
Here I leave the code used "Otui & Lua"
Code Otui:
CSS:
AddonButton < UIButton
  width: 101
  height: 125

Panel
  AddonButton
    image-source: /modules/game_shop/images/buttonimg/addon_assassin
    anchors.top: parent.top
    anchors.left: parent.left
    @onClick: modules.game_shop.buyAssassin()

  AddonButton
    image-source: /modules/game_shop/images/buttonimg/addon_barbarian
    anchors.top: prev.top
    anchors.left: prev.right
    @onClick: modules.game_shop.buyBarbarian()

  AddonButton
    image-source: /modules/game_shop/images/buttonimg/addon_beggar
    anchors.top: prev.top
    anchors.left: prev.right
    @onClick: modules.game_shop.buyBeggar()

Code Lua:
Lua:
local shopWindow
local shopButton
local shopTabBar
local addonsPanel
local itemsPanel
local premiumPanel
local mountsPanel
local acceptWindow

function init()
  shopWindow = g_ui.displayUI('shop')
  shopWindow:hide()
 
  shopTabBar = shopWindow:getChildById('shopTabBar')
  shopTabBar:setContentWidget(shopWindow:getChildById('shopTabContent'))

  addonsPanel = g_ui.loadUI('addons')
  shopTabBar:addTab(tr('Addons'), addonsPanel, '/modules/game_shop/images/shoptabs/addons')

  itemsPanel = g_ui.loadUI('items')
  shopTabBar:addTab(tr('Items'), itemsPanel, '/modules/game_shop/images/shoptabs/items')

  mountsPanel = g_ui.loadUI('mounts')
  shopTabBar:addTab(tr('Mounts'), mountsPanel, '/modules/game_shop/images/shoptabs/mounts')

  premiumPanel = g_ui.loadUI('premium')
  shopTabBar:addTab(tr('Premium'), premiumPanel, '/modules/game_shop/images/shoptabs/premium')

  shopButton = modules.client_topmenu.addLeftGameButton('shopButton', tr('Shop'), '/modules/game_shop/images/shop', toggle)
end

function terminate()
  shopWindow:destroy()
  shopButton:destroy()
end

function toggle()
  if shopWindow:isVisible() then
    hide()
  else
    show()
  end
end

function show()
  shopWindow:show()
  shopWindow:raise()
  shopWindow:focus()
end

function hide()
  shopWindow:hide()
  if acceptWindow then
    acceptWindow:destroy()
    acceptWindow = nil
  end
end

function addTab(name, panel, icon)
  shopTabBar:addTab(name, panel, icon)
end

function addButton(name, func, icon)
  shopTabBar:addButton(name, func, icon)
end

-- Buy functions:

-- Addons Assassin
function buyAssassin()
  if acceptWindow then
    return true
  end

  local acceptFunc = function()
    g_game.talk('!outfits assassinfull')
    acceptWindow:destroy()
    acceptWindow = nil
  end
 
  local cancelFunc = function() acceptWindow:destroy() acceptWindow = nil end

  acceptWindow = displayGeneralBox(tr('Accept transaction'), tr("Do you really want to buy this item?"),
  { { text=tr('Yes'), callback=acceptFunc },
    { text=tr('No'), callback=cancelFunc },
    anchor=AnchorHorizontalCenter }, acceptFunc, cancelFunc)
  return true
end

-- Addons Barbarian
function buyBarbarian()
  if acceptWindow then
    return true
  end

  local acceptFunc = function()
    g_game.talk('!outfits barbarian')
    acceptWindow:destroy()
    acceptWindow = nil
  end
 
  local cancelFunc = function() acceptWindow:destroy() acceptWindow = nil end

  acceptWindow = displayGeneralBox(tr('Accept transaction'), tr("Do you really want to buy this item?"),
  { { text=tr('Yes'), callback=acceptFunc },
    { text=tr('No'), callback=cancelFunc },
    anchor=AnchorHorizontalCenter }, acceptFunc, cancelFunc)
  return true
end

-- Addons Beggar
function buyBeggar()
  if acceptWindow then
    return true
  end

  local acceptFunc = function()
    g_game.talk('!outfits beggar')
    acceptWindow:destroy()
    acceptWindow = nil
  end
 
  local cancelFunc = function() acceptWindow:destroy() acceptWindow = nil end

  acceptWindow = displayGeneralBox(tr('Accept transaction'), tr("Do you really want to buy this item?"),
  { { text=tr('Yes'), callback=acceptFunc },
    { text=tr('No'), callback=cancelFunc },
    anchor=AnchorHorizontalCenter }, acceptFunc, cancelFunc)
  return true
end

How do I add the fourth image next to the third image without disappearing from the box? and how would the code be used to add the following below the first image.

I tried to play with these codes but they do not work for me or they just I dont add them correctly.

CSS:
  anchors.left: parent.left
  anchors.bottom: parent.bottom
  anchors.right: parent.right
  anchors.top: parent.top

 margin-top: 5
 margin-left: 5
 margin-right: 5
 margin-bottom: 5

  anchors.left: prev.left
  anchors.bottom: prev.bottom
  anchors.right: prev.right
  anchors.top: prev.top
Could you support me?

I can give you some general tips -
First, if something goes wrong, check terminal (ctrl+T) to see if you maybe had an indentation error or a spelling mistake.
Then, make sure the element you're editing is anchored properly to what you want it to be anchored, and that it is indented properly as a child element of a parent chosen for it, in your case, the Panel element.
Indentation is done via spaces (2 spaces = 1 hierarchy level), not tabs, never tabs in .otui

If after adding margin, something entirely disappears, this is potentially an issue with being able to fit there given the defined anchors.
You can try to give your Panel a background color, or increase window width size to see if it will fit with the increased size (though this is not a solution to the problem).

The code seems fine at a first glance, i see nothing wrong with it, so please take a look at the spoiler for a detailed explanation and help with what might be the issue:

I'll explain below briefly how anchoring/marginalization works, then you can try to figure out what the problem is:

Here is an illustration of what's probably the issue:
e4dlxLc.png

If this happens, Box2 will give no terminal errors, but simply won't show up because it's going over the edges of the panel.

Now here's some short explanations of how to work with anchors and margins.
Let's say you have a main window panel into which you will insert these boxes:

Haecckf.png


The boxes you're adding to this panel will be its children if they are indented 2 spaces deeper than the Panel is.
Now, every element (like you can see on the image) has some reference points: top, right, left, bottom, horizontalCenter, verticalCenter, centerIn.

If, when defining anchors for a child, you say "anchors.top: parent.top" and "anchors.left: parent.left", this means that you want to lock this child's position to the top-left point of the parent element:

mGgVWp6.png


By saying "margin-left: 5" for example, you want to move this element 5 pixels away from its left anchor. Since its left anchor is parent.left, this means that you're gonna move this box 5 pixels away from the parent's left side.

But in your code you will notice "anchors.left: prev.right". This means that we wanna anchor this element to the right side of whatever the previous element was. Since you're adding box2 right after box1, it makes sense to anchor it to box1, and for example give it another margin of 5px, and repeat this process for however many boxes you can fit into a single row, to get that nice spacing between them.

If you wanna move on to the next row, try to do the following, by giving box2 anchors.left: parent.left, anchors.top: box1.bottom.
That will make box2's "top" at the next available pixel on the bottom of box1, and its left will be the next available pixel on the left side of the parent of course.

ZNRd6lX.png


Anyway, another quick thing you can do for some debugging is to give your Panel a background: #FFFFFF, that way you will clearly see the size of your panel and whether some image would be crossing it.
 
Thanks for replying friend, I managed to get more images added to the box, but now I'm trying to add the new images in the bottom row, I have problems there. I will keep trying and if I can not solve it I will notify you to help me.

wJUTZY-gSVq0JoPuxVYO0Q.png
 
Thanks for replying friend, I managed to get more images added to the box, but now I'm trying to add the new images in the bottom row, I have problems there. I will keep trying and if I can not solve it I will notify you to help me.

That's awesome mate.
If you wanna make a next row, the best thing would be like I suggested, to anchor a new box to this one, let's call it box1:

mQAvQMS.png


Now you would make a Box6 and give it anchor.top: box1.bottom and anchor.left: parent.left
Problem solved :D
 
That's awesome mate.
If you wanna make a next row, the best thing would be like I suggested, to anchor a new box to this one, let's call it box1:
Now you would make a Box6 and give it anchor.top: box1.bottom and anchor.left: parent.left
Problem solved :D

I have a problem creating the box6, the box6 is created above the box1, and when moving with the mause the main window, the row above does not stay in the margins.
Cq6AIUuDR2yM73yyOBfR2w.png

code otui:
CSS:
AddonButton < UIButton
  width: 101
  height: 125
  margin-left: 5
 
Panel
  AddonButton
    image-source: /modules/game_shop/images/buttonimg/addon_assassin
    anchors.top: parent.bottom
    anchors.left: parent.left
    @onClick: modules.game_shop.buyAssassin()
  AddonButton
    image-source: /modules/game_shop/images/buttonimg/addon_barbarian
    anchors.top: prev.top
    anchors.left: prev.right
    @onClick: modules.game_shop.buyBarbarian()
  AddonButton
    image-source: /modules/game_shop/images/buttonimg/addon_beggar
    anchors.top: prev.top
    anchors.left: prev.right
    @onClick: modules.game_shop.buyBeggar()
  AddonButton
    image-source: /modules/game_shop/images/buttonimg/addon_norseman
    anchors.top: prev.top
    anchors.left: prev.right
    @onClick: modules.game_shop.buyNorseman()
  AddonButton
    image-source: /modules/game_shop/images/buttonimg/addon_pirate
    anchors.top: prev.top
    anchors.left: prev.right
    @onClick: modules.game_shop.buyPirate()
  AddonButton
    image-source: /modules/game_shop/images/buttonimg/addon_pirate
    anchors.top: parent.bottom
    anchors.left: parent.left
    @onClick: modules.game_shop.buyPirate()
Do you happen to have the list of variables to use in the "otui" file so I can play with the codes and try to learn more about its functionality?

Edit:
solve the problem, now I have another problem xD
I move the window with the mause and the boxes do not stay fixed to the main window, they move leaving their margins!
How to make the boxes remain fixed without moving when moving the main window?
 
Last edited:
I have a problem creating the box6, the box6 is created above the box1, and when moving with the mause the main window, the row above does not stay in the margins.
Cq6AIUuDR2yM73yyOBfR2w.png

code otui:
CSS:
AddonButton < UIButton
  width: 101
  height: 125
  margin-left: 5
 
Panel
  AddonButton
    image-source: /modules/game_shop/images/buttonimg/addon_assassin
    anchors.top: parent.bottom
    anchors.left: parent.left
    @onClick: modules.game_shop.buyAssassin()
  AddonButton
    image-source: /modules/game_shop/images/buttonimg/addon_barbarian
    anchors.top: prev.top
    anchors.left: prev.right
    @onClick: modules.game_shop.buyBarbarian()
  AddonButton
    image-source: /modules/game_shop/images/buttonimg/addon_beggar
    anchors.top: prev.top
    anchors.left: prev.right
    @onClick: modules.game_shop.buyBeggar()
  AddonButton
    image-source: /modules/game_shop/images/buttonimg/addon_norseman
    anchors.top: prev.top
    anchors.left: prev.right
    @onClick: modules.game_shop.buyNorseman()
  AddonButton
    image-source: /modules/game_shop/images/buttonimg/addon_pirate
    anchors.top: prev.top
    anchors.left: prev.right
    @onClick: modules.game_shop.buyPirate()
  AddonButton
    image-source: /modules/game_shop/images/buttonimg/addon_pirate
    anchors.top: parent.bottom
    anchors.left: parent.left
    @onClick: modules.game_shop.buyPirate()
Do you happen to have the list of variables to use in the "otui" file so I can play with the codes and try to learn more about its functionality?

Edit:
solve the problem, now I have another problem xD
I move the window with the mause and the boxes do not stay fixed to the main window, they move leaving their margins!

That's because you broke the anchoring, try this code:

CSS:
AddonButton < UIButton
  width: 101
  height: 125
  margin-left: 5
Panel
  AddonButton
    id: box1
    image-source: /modules/game_shop/images/buttonimg/addon_assassin
    anchors.top: parent.bottom
    anchors.left: parent.left
    @onClick: modules.game_shop.buyAssassin()
  AddonButton
    id: box2
    image-source: /modules/game_shop/images/buttonimg/addon_barbarian
    anchors.top: prev.top
    anchors.left: prev.right
    @onClick: modules.game_shop.buyBarbarian()
  AddonButton
    id: box3
    image-source: /modules/game_shop/images/buttonimg/addon_beggar
    anchors.top: prev.top
    anchors.left: prev.right
    @onClick: modules.game_shop.buyBeggar()
  AddonButton
    id: box4
    image-source: /modules/game_shop/images/buttonimg/addon_norseman
    anchors.top: prev.top
    anchors.left: prev.right
    @onClick: modules.game_shop.buyNorseman()
  AddonButton
    id: box5
    image-source: /modules/game_shop/images/buttonimg/addon_pirate
    anchors.top: prev.top
    anchors.left: prev.right
    @onClick: modules.game_shop.buyPirate()
  AddonButton
    id: box6
    image-source: /modules/game_shop/images/buttonimg/addon_pirate
    anchors.top: box1.bottom
    anchors.left: parent.left
    @onClick: modules.game_shop.buyPirate()

You can find the stuff you need in luafunctions.cpp and uiwidgetbasestyle.cpp btw
 
That's because you broke the anchoring, try
You can find the stuff you need in luafunctions.cpp and uiwidgetbasestyle.cpp btw
using your code appears as follows.
DsjmDxBQRtaACGYRlfNeww.png


using my code appears like this, but the margins are lost when you move the main window.
g1yCsnsdSFqii-al_LkJnA.png


My Code:
CSS:
AddonButton < UIButton
  width: 101
  height: 125
  margin-left: 5
 
Panel
  AddonButton
    image-source: /modules/game_shop/images/buttonimg/addon_assassin
    anchors.top: box1.bottom
    anchors.left: parent.left
    @onClick: modules.game_shop.buyAssassin()
  AddonButton
    image-source: /modules/game_shop/images/buttonimg/addon_barbarian
    anchors.top: prev.top
    anchors.left: prev.right
    @onClick: modules.game_shop.buyBarbarian()
  AddonButton
    image-source: /modules/game_shop/images/buttonimg/addon_beggar
    anchors.top: prev.top
    anchors.left: prev.right
    @onClick: modules.game_shop.buyBeggar()   
  AddonButton
    image-source: /modules/game_shop/images/buttonimg/addon_norseman
    anchors.top: prev.top
    anchors.left: prev.right
    @onClick: modules.game_shop.buyNorseman()
  AddonButton
    image-source: /modules/game_shop/images/buttonimg/addon_pirate
    anchors.top: prev.top
    anchors.left: prev.right
    @onClick: modules.game_shop.buyPirate()
  AddonButton
    image-source: /modules/game_shop/images/buttonimg/addon_shaman
    anchors.top: prev.bottom
    anchors.left: parent.left
    @onClick: modules.game_shop.buyShaman()
 
Last edited:
Yeah sorry, I didn't carefully review your code, there was a mistake, your box1 was anchored to the bottom of parent instead of top, fix that and it should work.


CSS:
AddonButton < UIButton
  width: 101
  height: 125
  margin-left: 5
Panel
  AddonButton
    id: box1
    image-source: /modules/game_shop/images/buttonimg/addon_assassin
    anchors.top: parent.top
    anchors.left: parent.left
    @onClick: modules.game_shop.buyAssassin()
  AddonButton
    id: box2
    image-source: /modules/game_shop/images/buttonimg/addon_barbarian
    anchors.top: prev.top
    anchors.left: prev.right
    @onClick: modules.game_shop.buyBarbarian()
  AddonButton
    id: box3
    image-source: /modules/game_shop/images/buttonimg/addon_beggar
    anchors.top: prev.top
    anchors.left: prev.right
    @onClick: modules.game_shop.buyBeggar()
  AddonButton
    id: box4
    image-source: /modules/game_shop/images/buttonimg/addon_norseman
    anchors.top: prev.top
    anchors.left: prev.right
    @onClick: modules.game_shop.buyNorseman()
  AddonButton
    id: box5
    image-source: /modules/game_shop/images/buttonimg/addon_pirate
    anchors.top: prev.top
    anchors.left: prev.right
    @onClick: modules.game_shop.buyPirate()
  AddonButton
    id: box6
    image-source: /modules/game_shop/images/buttonimg/addon_pirate
    anchors.top: box1.bottom
    anchors.left: parent.left
    @onClick: modules.game_shop.buyPirate()
 
Yeah sorry, I didn't carefully review your code, there was a mistake, your box1 was anchored to the bottom of parent instead of top, fix that and it should work.
you're a big friend now if it works correctly :D
I will continue adding content.
Any problem that I have will not hesitate to ask you.
thank you friend, you have helped me a lot :)
 
Hi, I think I want another style in my shop window.
my store currently:
y3Q-Ng3KSW_Vsgusg7opYQ.png


my store as it should be.. edited in photoshop:
snoFgv9eRi2ha9kcyYyRKw.png

I hope to give a good idea of what I really want to do. if they can help me, it would be a great job.
 
Hi, I think I want another style in my shop window.
my store currently:
y3Q-Ng3KSW_Vsgusg7opYQ.png


my store as it should be.. edited in photoshop:
snoFgv9eRi2ha9kcyYyRKw.png

I hope to give a good idea of what I really want to do. if they can help me, it would be a great job.

Yeah you can do that easily. Change main parent container type from "Panel" to "ScrollablePanel", and attach a vertical scrollbar to it. Example of the 2:


Code:
    ScrollablePanel
      id: mainPanel
      vertical-scrollbar: mainPanelScrollbar
      //define more attributes here
     
      VerticalScrollBar
        id: mainPanelScrollbar
        anchors.top: parent.top
        anchors.bottom: parent.bottom
        anchors.right: parent.right
        step: 24
        pixels-scroll: true

You can apply the same to the list on the left side, then attach an UIWidget element with image-source: /path/to/pic for your "Store" image. Anchor its top to the bottom of this left scrollable panel.
 
Yeah you can do that easily. Change main parent container type from "Panel" to "ScrollablePanel", and attach a vertical scrollbar to it. Example of the 2:


Code:
    ScrollablePanel
      id: mainPanel
      vertical-scrollbar: mainPanelScrollbar
      //define more attributes here
    
      VerticalScrollBar
        id: mainPanelScrollbar
        anchors.top: parent.top
        anchors.bottom: parent.bottom
        anchors.right: parent.right
        step: 24
        pixels-scroll: true

You can apply the same to the list on the left side, then attach an UIWidget element with image-source: /path/to/pic for your "Store" image. Anchor its top to the bottom of this left scrollable panel.
I do not really understand what you try to explain to me.

I explain myself a little better, I want to make the new window in this way as shown in the image.
MgGF43WbQ_i75HGeYbJA3w.png

what commands should I use to form the code and if I really have to do the writing of the OTUI file again?
 
I do not really understand what you try to explain to me.

I explain myself a little better, I want to make the new window in this way as shown in the image.
MgGF43WbQ_i75HGeYbJA3w.png

what commands should I use to form the code and if I really have to do the writing of the OTUI file again?

If you open your .otui file, which contains the configuration for the UI of this window, you will see an element with type "Panel" (ctrl+f it).
This panel is a parent (like a container) that contains children (content, in this case, your outfit purchase buttons).

You need to change this parent's type from Panel to ScrollablePanel to make it possible to scroll it.
Now when you did that, you need to also attach a Vertical Scrollbar as a child of this ScrollablePanel. This vertical scrollbar is what will be used to scroll the panel up and down if it contains more elements than fits in its original width/height.

I gave you an example code of it above, play with it a bit until you get your desired results.
 
I am using the shop system provided above. I am trying to create a talk action to communicate with my database:

Here is what i wrote, maybe someone here can tell me why it is throwing an error
Code:
function onSay(cid, words, param, channel)
local player = Player(cid)
local guid = player:getAccountId()
local points = db.asyncStoreQuery("SELECT `premium_points` FROM `accounts` WHERE `id` = " .. guid)
    if (player.points > 10) then
        player:addItem(10135, 1)
    else
         player:sendTextMessage(MESSAGE_INFO_DESCR, "You only have " .. points .. " in your account")

         end
end

Screenshot
 
I am using the shop system provided above. I am trying to create a talk action to communicate with my database:

Here is what i wrote, maybe someone here can tell me why it is throwing an error
Code:
function onSay(cid, words, param, channel)
local player = Player(cid)
local guid = player:getAccountId()
local points = db.asyncStoreQuery("SELECT `premium_points` FROM `accounts` WHERE `id` = " .. guid)
    if (player.points > 10) then
        player:addItem(10135, 1)
    else
         player:sendTextMessage(MESSAGE_INFO_DESCR, "You only have " .. points .. " in your account")

         end
end

Screenshot

Your player.points variable is returning nil, the problem is not necessarily in this script but wherever you're setting this value to player object, it's not being set correctly.
 

Similar threads

Back
Top