Author Topic: [Gui] Button lock  (Read 893 times)

0 Members and 1 Guest are viewing this topic.

Offline Yona-TYT

[Gui] Button lock
« on: May 17, 2017, 12:34:58 PM »
I need to block some buttons that can break the tutorial scenario.

These are the highest priority:

Remove and Remove Now: If the vehicle is sold, it will no longer be possible to recover it.

Go to depot: If you advance step / chapter and a vehicle is sent to the warehouse, you will not be able to start it again.


Trying to solve these problems would complicate things much more, that is why blocking the buttons is the best solution.


Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8821
  • Total likes: 322
  • Helpful: 229
  • Languages: De,EN,JP
Re: [Gui] Button lock
« Reply #1 on: May 17, 2017, 11:59:04 PM »
I do not like the idea to block buttons. Scripting the UI will open a new cans of worms. Moreover, the tutoial should present the real UI. And if the user click on these, you can easily find out the convoi is missing. I mean a tutorial has not to be too much restricting.

Offline Yona-TYT

Re: [Gui] Button lock
« Reply #2 on: May 18, 2017, 03:05:34 AM »
@Prissi
My biggest concern is that the tutorial can stagnate in one step / chapter.  :o

During the whole tutorial, player can do stuff unrelated to the tutorial and is likely to break the tutorial at any point (nobody knows how a beginner thinks :p ). Would it be possible to implement things so that a player can only do the expected action ? I mean, instead of forbiding any other actions we can think of, forbid anything that is not a precise action ? That would make coding the scenario much easier and the scenario itself will be much more resistant to bugs.

Offline IgorEliezer

  • Devotee
  • Administrator
  • *
  • Posts: 3952
  • Total likes: 145
  • Helpful: 71
  • Lost In Stupid Parenthesis
    • Igor Eliezer Architect and Urban Planner/Arquiteto e Urbanista
  • Languages: PT, EN, AutoLISP, Python
Re: [Gui] Button lock
« Reply #3 on: May 19, 2017, 01:09:55 PM »
My biggest concern is that the tutorial can stagnate in one step / chapter.  :o

Quote from: gauthier
During the whole tutorial, player can do stuff unrelated to the tutorial and is likely to break the tutorial at any point (nobody knows how a beginner thinks :p ).
Can the player simply resume the tutorial back to the point where he got "distracted"? (Feature request?)

I usually like to explore and test things while I'm learning something. For me it's part of the learning process. We should rather help players follow the learning track (guidance) than restrain curiosity.

Offline Yona-TYT

Re: [Gui] Button lock
« Reply #4 on: May 19, 2017, 07:46:17 PM »

So far the only thing that can damage the scenario are the vehicles (as far as I can see).

I was thinking, do the vehicles have a unique id on the map? ... if this is true then I can use this to determine which vehicle was deleted / sold.  8)

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4251
  • Total likes: 177
  • Helpful: 149
  • Languages: EN, DE, AT
Re: [Gui] Button lock
« Reply #5 on: May 20, 2017, 08:27:19 AM »
What do you want to achieve? You could continuously loop through all convoys of the player to check whether they succeeded.

The list of convoys can be accessed with world.get_convoy_list().

You could also save the convoy_x instances and check them later:
Code: [Select]
// cnv - convoy_x instance saved somewhat earlier
try {
     cnv.get_pos() // will fail if cnv is no longer existent
     // do your checks
}
catch(ev) {
     // we are here if cnv is not longer available
}
Parsley, sage, rosemary, and maggikraut.

Offline Yona-TYT

Re: [Gui] Button lock
« Reply #6 on: May 20, 2017, 11:39:12 AM »

Can the player simply resume the tutorial back to the point where he got "distracted"? (Feature request?)
You gave me an idea, I'll try something similar. ;)

Offline Yona-TYT

Re: [Gui] Button lock
« Reply #7 on: May 20, 2017, 01:30:19 PM »
What do you want to achieve? You could continuously loop through all convoys of the player to check whether they succeeded.

The list of convoys can be accessed with world.get_convoy_list().

You could also save the convoy_x instances and check them later:
Code: [Select]
// cnv - convoy_x instance saved somewhat earlier
try {
     cnv.get_pos() // will fail if cnv is no longer existent
     // do your checks
}
catch(ev) {
     // we are here if cnv is not longer available
}
At the moment it is very complicated to exclude the vehicles inside the depot, I need to count only the vehicles in circulation.  :-[

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4251
  • Total likes: 177
  • Helpful: 149
  • Languages: EN, DE, AT
Re: [Gui] Button lock
« Reply #8 on: May 20, 2017, 04:41:08 PM »
There is convoy_x::is_in_depot in r8235
Parsley, sage, rosemary, and maggikraut.