scroll slices: how do they work?

Ask and answer questions about making games and related topics. Unrelated topics go in that other forum.

Moderators: marionline, SDHawk

Post Reply
User avatar
SwordPlay
Chemical Slime
Posts: 966
Joined: Sun Jan 22, 2017 9:32 am
Location: London, England
Contact:

scroll slices: how do they work?

Post by SwordPlay »

I have some suggestions and questions.

Could we have (or is there any point in)
- scroll to next child
- scroll to previous child
(Is this redundant?)

- Is it possible to scroll to a child by its index rather than by handle?

- Is it possible to change the scroll speed of a scroll slice? Please make this an option that can be set in the slice collection editor if possible.

- Is it possible to have child slices scroll to a certain position?
For example, instead of scrolling until they are visible, could we have a slice scrolling until it is centred, left/right aligned etc,. within the scroll slice?
One could scroll to a container or an invisible slice that also correctly positions a slice, but that might interfere with other children, and seems awkward.
EDIT: actually, I'm leaning towards using containers now. Nevermind.

- Is there a way to check which slice is being currently displayed in a select slice?



EDIT:
Unfortunately I think that my "question" has turned into "requests"
Last edited by SwordPlay on Thu May 11, 2017 6:57 am, edited 7 times in total.
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Re: scroll slices: how do they work?

Post by TMC »

I expected to you ask how scroll slices work, but apparently not!
Virtuous Sword wrote:- scroll to next child
- scroll to previous child
(Is this redundant?)
Next child from what? There is no concept of a 'current' child. You have to store it yourself in a variable. Then just do "scroll to child(scrollsl, nextsibling(child))"
- Is it possible to scroll to a child by its index rather than by handle?
Yes, "scroll to child(scrollsl, slice child(scrollsl, index))"
- Is it possible to change the scroll speed of a scroll slice? Please make this an option that can be set in the slice collection editor if possible.

- Is it possible to have child slices scroll to a certain position?
"Scrolling" is instantaneous. I agree, I want non-instantaneous scrolling. Hmm, by setting ticks or velocity? Both, I guess: two new commands to scrolltoslice. A different solution would be to add commands which return how much the slices need to scroll by, combined with new "scroll children by" and "set children velocity", but that's heaps of probably unuseful machinery, so I'm against it.
And I think you be able to specify a border amount to make it scroll a slice a little towards the center rather than just on the edge, rather than having to use containers. (Now we're up to three new arguments!) Maybe it should just use the padding as a border? But that would be a back-compat breaking change. It's almost minor enough to get away with, though. I wonder how many games actually use scroll slices? Very few, I imagine. Maybe I'll extend rpgbatch to scan slice collections.
Honestly, scrolling is something that clearly would have been implemented as a script rather than a builtin, except for the fact that the engine itself needs to do it. You can customise it by writing your own script.
- Is there a way to check which slice is being currently displayed in a select slice?
Yes, you can check whether a slice is partially visible with "slice collide", and whether it's wholly visible with "slice contains"
EDIT: Oh, you were asking about select slices? Use the "get select slice index" command.

Some of these questions and answers would be worth putting on the wiki. How about we add a Slice FAQ article? A place to put short misc questions and answers which are informative. FAQs can be a fast way to learn about something. Do you want to collect some?

Edit: I've started an article: Slices FAQ. So, what questions of yours have I answered?
Last edited by TMC on Thu May 11, 2017 12:38 pm, edited 1 time in total.
User avatar
SwordPlay
Chemical Slime
Posts: 966
Joined: Sun Jan 22, 2017 9:32 am
Location: London, England
Contact:

Post by SwordPlay »

Thanks for that! Appreciate it!

I tried making a script like this before I posted thist thread but it didn't work and I couldn't figure out why
:(

(Redacted)



EDIT: I should put it in a global variable, shouldn't I? I think it's because I set it as key-press, so it gets rid of the variable after key is pressed?

EDIT: Yep, I just realised that keypress doesn't store the variable and I should've put it in a global variable. My bad! It works now.
Last edited by SwordPlay on Thu May 11, 2017 6:33 pm, edited 2 times in total.
Post Reply