project-navigation
Personal tools

Author Topic: lua design thoughts  (Read 71845 times)

Offline xray

  • Rookie
  • ***
  • Posts: 72
    • View Profile
Re: lua design thoughts
« Reply #90 on: November 29, 2014, 08:24:14 pm »
Added a fix for the order in wich the close/drag buttons were created.

Offline Internecivus

  • Rookie
  • ***
  • Posts: 64
  • Sometimes I Code
    • View Profile
Re: lua design thoughts
« Reply #91 on: December 07, 2014, 07:07:21 am »
Optionlist (or some of its ancestor) lacks cvar attribute.
Quote
UI_AbstractOptionGetCurrentValue: node 'checkcvars.select_language' doesn't have a valid cvar assigned
« Last Edit: December 07, 2014, 08:14:22 am by Internecivus »

Offline xray

  • Rookie
  • ***
  • Posts: 72
    • View Profile
Re: lua design thoughts
« Reply #92 on: December 07, 2014, 05:54:51 pm »
I've added the possibility to set a cvar value to an option list.

Offline Internecivus

  • Rookie
  • ***
  • Posts: 64
  • Sometimes I Code
    • View Profile
Re: lua design thoughts
« Reply #93 on: December 08, 2014, 08:10:12 pm »
Few more problems I've experienced.
  • requested set_cvar segfaults
  • cvar-associated checkbox can't be checked back if unchecked
  • nor intro window nor model_test windows work (in case of intro you have to find intro.ogm, because it was removed a while ago)
  • and some others
I created a pull request and commented on each issue I stated above.

Offline xray

  • Rookie
  • ***
  • Posts: 72
    • View Profile
Re: lua design thoughts
« Reply #94 on: December 08, 2014, 10:03:44 pm »
Few more problems I've experienced.
  • requested set_cvar segfaults
  • cvar-associated checkbox can't be checked back if unchecked
  • nor intro window nor model_test windows work (in case of intro you have to find intro.ogm, because it was removed a while ago)
  • and some others
I created a pull request and commented on each issue I stated above.

Thx. for the pull request, it clarified a lot. Problem was I did not have a lua ufo file that actually triggered this code. Found the segfault. It should work now. Also added the option to set cvar with a string value. Can you check if it's working now?

As for the other issues, I'm going to look into this by the end of this week. The checkbox issue might be related to the mixing of int/float values in the cvar.

Offline Internecivus

  • Rookie
  • ***
  • Posts: 64
  • Sometimes I Code
    • View Profile
Re: lua design thoughts
« Reply #95 on: December 09, 2014, 08:56:12 am »
Methods 'viewpos', 'fullsize', 'viewsize' and setters for them are missing from optionlist node.

Quote
lua error(0) [node=select_language]: [string "main.ufo"]:292: attempt to call method 'fullsize' (a nil value)
lua error(0) [node=select_language_scroll]: [string "main.ufo"]:303: attempt to call method 'set_viewpos' (a nil value)

Offline xray

  • Rookie
  • ***
  • Posts: 72
    • View Profile
Re: lua design thoughts
« Reply #96 on: December 09, 2014, 08:38:44 pm »
  • nor intro window
Merged your pull request. The segfaults are gone. At least as far as I can see. Anyway, the intro seems to be running on my system without troubles. At least.. I guess with "intro" you mean the sequence played when you start a new campaign.

Offline Internecivus

  • Rookie
  • ***
  • Posts: 64
  • Sometimes I Code
    • View Profile
Re: lua design thoughts
« Reply #97 on: December 10, 2014, 03:46:11 pm »
A little feature request - passing parameters to on_windowopened so 'ui_push windowname param' will work.

Offline xray

  • Rookie
  • ***
  • Posts: 72
    • View Profile
Re: lua design thoughts
« Reply #98 on: December 10, 2014, 05:28:14 pm »
Fixed the intro problem. Now seeing a nice blue earth in the window...

Offline xray

  • Rookie
  • ***
  • Posts: 72
    • View Profile
update on project (was: Re: lua design thoughts)
« Reply #99 on: May 31, 2015, 07:18:37 pm »
Hi everybody,

I guess you were wondering wether this project was actually abandoned. Well, it's not. However, it's been a long time, I know.

Since  my last post in january I got all tied up in both work and my master thesis (should you wonder: yes it is finished and yes I got my master title  ;D ;D ;D). I was planning on bringing this project into the main branch until I realised that I couldn't spent any time on issues should they arise. So I postponed the pull request.
 
Now I'm picking up were I left. Last week I merged with the main branch and fixed some issues. This week I'm going to setup a linux build environment. After that, it will be time to merge with the main branch.

Regards,
xray

Offline Internecivus

  • Rookie
  • ***
  • Posts: 64
  • Sometimes I Code
    • View Profile
Re: lua design thoughts
« Reply #100 on: May 31, 2015, 07:26:25 pm »
My laptop was fried few months ago and I can't afford a replacement yet. Hope I'll get something until the end of the summer.

Offline ShipIt

  • Project Artist
  • Captain
  • ***
  • Posts: 906
    • View Profile
Re: lua design thoughts
« Reply #101 on: June 01, 2015, 07:24:24 am »
Good to hear this is still alive.

Also congratulations on your master title!

Offline geever

  • Project Coder
  • PHALANX Commander
  • ***
  • Posts: 2561
    • View Profile
Re: lua design thoughts
« Reply #102 on: August 23, 2015, 06:52:33 pm »
I just found out that this is in master already... Hmm, I like it and don't, at the same time. It has great potential for moving out a lot of UI related code from C, but it also moves away from regular people: more programming and what is the worst: lots of of extra (useless) typing.

I'm still looking for the change, hoping that the current state is just the beginning of something really good.

@xray: Would you be interested in my thoughts and improving the LUA UI engine?


-geever

Offline xray

  • Rookie
  • ***
  • Posts: 72
    • View Profile
Re: lua design thoughts
« Reply #103 on: August 23, 2015, 09:03:58 pm »
I just found out that this is in master already... Hmm, I like it and don't, at the same time. It has great potential for moving out a lot of UI related code from C, but it also moves away from regular people: more programming and what is the worst: lots of of extra (useless) typing.[/quoute]

I had it moved in the main branch so it gets more feedback. Located in an isolated branch the development was more or less stalling. As for the design: it's lua, yes you need to program. But that's precisely why it was implemented firsthand since ufo script is not a good programming language with major drawback in writing the functions. As for the extra typing: one solution is to write boilerplate lua code that accepts some hierarchic structure defining the look of the gui and then translates it into appropriate api calls.

As it is, current implementation works side-by-side with the ufo script implementation, so at the moment anyone can pick the language he/she is most comfortable with.

I'm still looking for the change, hoping that the current state is just the beginning of something really good.
[/qoute]

I'm sure in the end it will become just that :-)

@xray: Would you be interested in my thoughts and improving the LUA UI engine?
-geever

@geever: Of course I'm open for thoughts on improving the LUA UI engine. You can PM me or post in this thread. Looking forward to your ideas!

xray

Offline geever

  • Project Coder
  • PHALANX Commander
  • ***
  • Posts: 2561
    • View Profile
Re: lua design thoughts
« Reply #104 on: August 24, 2015, 12:42:09 am »
Cool! I started to create a "Base capacities" widget that is used in transfer and market screens, to play with the LUA scripts. It is in very early stage, doesn't worth showing the current state but found some "could be improved" parts with it already. (Disclaimer: I'm no LUA expert.)

1. Simplify initialization
    As I mentioned creating nodes is boring. Let's see, if I need 3 labels as a table header:

Code: [Select]
    local building_head = ufo.create_string(box, "building_head", nil)
    building_head:set_box(0, 20, 150, 20)
    building_head:set_font("f_very_small_bold")
    building_head:set_contentalign(ufo.ALIGN_CC)
    building_head:set_longlines(ufo.LONGLINES_PRETTYCHOP)
    building_head:set_text("_Building")

This is just one. I need 3 copies. To save my fingers I'll copy&paste&modify it. I'll have to replace building_head 7 times.

What if instead we could write:
Code: [Select]
    local building_head = ufo.create_string(box, "building_head", {
        ["super"]        = nil,
        ["box"]          = { 0, 20, 150, 20 },
        ["font"]         = "f_very_small_bold",
        ["contentalign"] = ufo.ALIGN_CC,
        ["longlines"]    = ufo.LONGLINES_PRETTYCHOP,
        ["text"]         = "_Building"
    })

Less risk in mistyping or forget to replace building_head.


Also if I have a panel and would like to create nodes inside it, it would be so natural using the panel's method to create subnodes:

Code: [Select]
    local row = ufo.create_component("panel", "cmp_basecap_line", nil)

    local building = row:create_string("building", nil)
    local freespace = row:create_string("freespace", nil)
    local allspace = row:create_string("allspace", nil)

But currently we need the long form.

-geever