News:

Simutrans.com Portal
Our Simutrans site. You can find everything about Simutrans from here.

[Gui] Button lock

Started by Yona-TYT, May 17, 2017, 12:34:58 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Yona-TYT

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.


prissi

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.

Yona-TYT

@Prissi
My biggest concern is that the tutorial can stagnate in one step / chapter.  :o

Quote from: gauthier on May 13, 2017, 08:23:33 AM
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.

IgorEliezer

Quote from: Yona-TYT on May 18, 2017, 03:05:34 AM
My biggest concern is that the tutorial can stagnate in one step / chapter.  :o

Quote from: gauthierDuring 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.

Yona-TYT


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)

Dwachs

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:

// 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.

Yona-TYT

Quote from: IgorEliezer on May 19, 2017, 01:09:55 PM

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. ;)

Yona-TYT

Quote from: Dwachs 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:

// 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.  :-[

Dwachs

There is convoy_x::is_in_depot in r8235
Parsley, sage, rosemary, and maggikraut.