Post new topic    
Page «  1, 2, 3, 4  »
Metal King Slime
Send private message
 
 PostThu Feb 13, 2020 4:38 pm
Send private message Reply with quote
My guess is that "free slice (screen menu)" appears to do nothing because you have loaded the slice collection multiple times, which can happen if you load it e.g. in map autorun scripts instead of the new game script. Each time you load it, a new set of slices is created, and it will exactly overlap the previously loaded menu slices if they already existed, so you can't see the difference. Use the slice debugger/in-game slice editor (Ctrl-F4) to check if this is happening.

If this is the problem, then you need to be careful not to load it multiple times. You could write:
Code:
if (screen menu == 0) then (screen menu := load slice collection (##))

and write "screen menu := 0" whenever you delete the screen menu slice. (By the way, in "General Game Settings -> Saved Games", turn on "Save script/sprite layer slices")
Or, you could use "lookup slice" to check whether the slice already exists.

The only other possible cause is that "screen menu" doesn't contain the correct slice handle. You should have written "screen menu:= load slice collection (##)" when loading it.

You can use "lookup slice" on a loaded slice collection. (Note that once a slice collection is loaded, it's no different from any other set of slices. The engine doesn't record that they were part of a slice collection.)
In the slice collection editor, press F5. This will show the root slice of the collection. "load slice collection" returns a handle to a copy of the root slice. Give this slice a lookup code, then you can use "lookup slice" to get a handle to the collection after loading it, even if you didn't save the handle returned by "load slice collection".
Slime
Send private message
Question about slice scrolls 
 PostFri Mar 06, 2020 6:23 pm
Send private message Reply with quote
Thanks for you advice. I managed to deal with buffer problems and slice collection overloading
by using another way: a global variable and the switch command.

This way you have either state 0 slice collection loaded ou state 1 free slice.

I had now another question. I've made a slice collection menu and I would like to use the scroll function.
My problem is the following: when I launched the collection the sroll bar doesn't not appear.

It is said in the plotscprit dictionary that children should fill the whole slice scroll to trigger to correct behaviour.
I have put only 5 slice text.
Could someone give me advice about what to check? Screenshots may be useful...

Have a nice day!
Metal King Slime
Send private message
 
 PostSat Mar 07, 2020 1:25 am
Send private message Reply with quote
A switch with two cases like that can probably also be written as an "if".

So you want the scrollbar to appear even if you can't scroll? OK, just add an invisible (container) child slice which is the same size as the scroll slice. You might have to make it 1 pixel taller.
Slime
Send private message
Re: queston about slice scrolls 
 PostSat Mar 07, 2020 2:05 pm
Send private message Reply with quote
TMC said:
Quote:
So you want the scrollbar to appear even if you can't scroll?


Well in fact I'm would like to to make exactly like a menu.
You have an long item list which require scrolling to see all items andyou can select

Imagine a amor & weapon shop

you have the items

leather armor
cap
short sword
small shield
bronze shield
iron armor
iron shield


I would like to select the menu item using an icon (on the left side of the text)
and the ability to scroll. I try what you said an add a container but the scroll bar didn't appear.
Could you please give me more detailed information?

As always thanks for your help!
Metal King Slime
Send private message
 
 PostMon Mar 09, 2020 3:03 pm
Send private message Reply with quote
(Sorry, I've been busy)

I'm not entirely sure what you're asking, but I hope this helps.

Here's an example of a menu with a scrollbar (from Axe Cop):

Notice that the scroll slice is the parent of the menu items, and it's set to "Clip Children".


Now I've deleted slices from the bottom until the scroll bar no longer appeared. Then I added a container slice that's 1 pixel higher than the scroll slice (0x114 vs 200x113), causing the scroll bar to show again.
Slime
Send private message
I've practised a bit and... 
 PostTue Mar 10, 2020 6:40 am
Send private message Reply with quote
Thanks a lot for the screenshots. Theywere really helpfull.
I've made some test but I sill have some trouble to make appear the blue bar.... but that's definitevily an improvement.

Could you please post screenshots of the item collection details menu for the scroll bar and the container?

As always thank you very much for your help!
Metal King Slime
Send private message
 
 PostTue Mar 10, 2020 8:33 am
Send private message Reply with quote
Well, OK, here's the scroll slice.

Oh, make sure "Check depth" is set to "no limit".


Do you have the scroll slice inside another slice which is set to clip children? Maybe it's clipping off the scroll bar.

Maybe you could post a screenshot of your slice collection instead?


I won't bother to post the container slice because it's a new container slice with only the height modified, everything else including position (0,0) is default.
Slime
Send private message
Posting screenshot is a good idea! 
 PostWed Mar 11, 2020 6:48 am
Send private message Reply with quote
Thanks for the suggestion. Here are my screenshots. Sorry the size is a bit big. Click on the image or download it so that you can zoom on it.
In this one, I've added a simple rectangle slice a background.
I've spoken about a simple armory shop in my previous post, but I would like to use this in my YuGiOh game as well!







As always feel free to ask any further question above...
Metal King Slime
Send private message
 
 PostWed Mar 11, 2020 2:33 pm
Send private message Reply with quote
Look again at the first screenshot I posted. The menu items need to be children of the scroll slice, which should be the size of that rectangle slice - you probably want to make it a child of the rect slice and set the scroll scroll to Fill Parent. And the scroll slice should be the one to Clip Children, not the rect (you already have that correct).
I don't know how you've arranged your slices, because you didn't show the slice tree, but I can see that they aren't children of the scroll slice. (BTW for next time: you can export a slice collection by pressing F2.)
Slime
Send private message
Help with slice tree 
 PostWed Mar 11, 2020 4:22 pm
Send private message Reply with quote
[quote= TMC"]I don't know how you've arranged your slices, because you didn't show the slice tree, but I can see that they aren't children of the scroll slice.[/quote]

That's my problem. I don't know how to make and to use slice tree Zombie !
My scroll & rectangle slice are clipped to children but s you can see below, they are on the same level
on my slice tree.



All my slice are aligned on the same lign on the left side of the screen while the one in your screenshots aren't.
My question is therefor the following: how do I access/ make changes in my slice tree so that scroll bar appears just like
your in your screenshots ?

I've tried to press F2 but It creates a ".slice" file. What's its relation with pictures? Confused
Thanks for answering so quickly
Metal King Slime
Send private message
 
 PostThu Mar 12, 2020 2:35 am
Send private message Reply with quote
Select a slice and press Shift+Right to make it a child of the slice above it; Shift-Left does the opposite. Shift-Up/Down change the order of a slice. You can also press Ctrl-Up/Down to change the selected slice while skipping over children. Press F1 and read the controls for the editor.
Remember to make sure the scroll slice is a child of the rect slice, not the other way around.

The .slice file is useful if you want to post your slice collection when you ask for help, or want to transfer slice trees between games.

BTW, you can attach screenshots to posts here on Slime Salad (unfortunately sometimes they don't preview the image). But you could make the window smaller rather than attach huge screenshots.
Slime
Send private message
About text in slice collection and selection 
 PostSun Aug 16, 2020 6:03 am
Send private message Reply with quote
Thanks for the information about image posting. I'm still in the middle implementation and
it's rather tricky!

As it is a game menu, I need to work on selection. As you can see
I've insersed card name as line but I still need a cursor and a highlight function to make the
understand that which menu item he has selected. Is there a way to that using text
slice as a basis or are you supposed to use a menu ?

Bye bye. Thanks in advance for your help!
Metal King Slime
Send private message
 
 PostTue Aug 18, 2020 11:17 am
Send private message Reply with quote
Yes, you are supposed to use a menu. You can script it yourself if you want, but of course that's much more work than using a builtin menu. (Don't forget, you can use a menu together with a script to display a cursor or make something appear depending on whcih menu item is selected.) Do you have a reason for doing it?

If you do want to script it using slices:
Use "slice child" to get the slice for the n'th menu item, e.g. "selected sl := slice child (scroll sl, selection)" (where "selection" is the selected item number).
You could use "put slice" to move the cursor, e.g. "put slice (cursor, 0, slice y (selected sl))"
Use "set text color" to highlight/unhighlight the text of a menu item.
Use "scroll to slice" to scroll the menu up/down (e.g. "scroll to slice(scroll sl, selected sl)").
Slime
Send private message
So how should I start 
 PostTue Aug 18, 2020 11:40 am
Send private message Reply with quote
Thanks for you answer.
Your advice are welcomed on this menus.


I would like details discard and turn end to act like menu items. When my button is near the text
which corresponds to a menu title, it highlights it (just like custom.exe do with
menu items) and when I press space (menu validation key) I run a script which contains opening menu commands.

I used slice collection element text because I could display them on screen like this. With a single
menu or three menu at the time it would became tricky when closing.

What should I do in case like this? Create three menu? If each menu has only one item, It may work.
Metal King Slime
Send private message
 
 PostFri Aug 21, 2020 4:33 pm
Send private message Reply with quote
If you want your menu to look like that, you should just script it instead of using a menu.

I totally forgot, and I guess you did too, but earlier in this thread already are most of the scripts you need to script a menu like this, so I'll just copy them here and extend it a bit to show you how to change the text colour and move the cursor.
(Unfortunately, kylekrack's menu script, which I linked to, show both a normal menu and a set of slices, so isn't suitable for this.)

Code:
variable (collection, menu items, cursor selection, sl)
collection := load slice collection (1)

# Now we need to get the slice that's the parent of all the menu items.
# I assume it has the "menu items" lookup code
menu items := lookup slice (sli: menu items, collection)

# And the menu cursor slice too, lookup code "menu cursor"
cursor := lookup slice (sli: menu cursor, collection)

while (true) do (
  if (key press (use key)) then (
    # Activate selected item (fill this in
    switch (selection) do (
      case(0)  #Details...
      case(1)  #Discard...
      case(2)  #End turn...
    )
    break  # exit
  )

  # First change the currently selected slice to deselected appearence
  # (for simplicity, do this even if the selection doesn't change)
  sl := slice child (menu items, selection)  # This is the slice for the (previous) selected item, which I assume is a text slice
  set text color (sl, 15)  # Change this to normal text colour!

  # Change the selection
  if (key press(left key) || key press(up key)) then (selection -= 1)
  if (key press(right key) || key press(down key)) then (selection += 1)
  if (selection == -1) then (selection := 2)  # wrap around from first to last
  if (selection == 3) then (selection := 0) # wrap around from last to first

  # Then update the selected menu item to correct appearance
  sl := slice child (menu items, selection)  # Slice for new selection
  set text color (sl, 12)  # Change this to highlighted text colour!

  # Move the cursor
  put slice (cursor, slice x(sl) -- 30,  slice y(sl))

  wait
)
free slice (collection)



Read the script carefully to understand how to use it.
Display posts from previous:
Page «  1, 2, 3, 4  »