Where is located the bitset pause available outside battle?

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

Moderators: marionline, SDHawk

bis_senchi
Red Slime
Posts: 64
Joined: Sat Apr 20, 2019 8:59 am

Test results

Post by bis_senchi »

As always thanks a lot for your answers.
So I've tried to implement the script and here are the results

First a picture of my slice tree. Could you please tell me if I attributed the look up code correctly? Is it necessary to make slice a parent and others children? (text & selection area
may be...)

Image

The hss compile and can be imported. When I test the script doesn't launch properly.
I've got those messages from the debugger:

Image

Image

Image

Could you please help me with getting rid of these errors?
Last edited by bis_senchi on Sun Aug 23, 2020 5:29 am, edited 1 time in total.
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Oh sorry, I didn't explain how to set up the slice tree. It should look like this:

Code: Select all

Rectangle    menu items
  Sprite   menu cursor
  Text
  Text
  Text
The position of the cursor doesn't matter, as long as it's a child of the "menu items" slice.
If you want, you could use a separate Container slice instead of reusing the Rectangle slice for that. Or not have a "menu items" slice at all, and just leave all the Text (menu item) slices at the top-level of the slice tree (you would have to write "menu items := collection" in the script).

You had Select slices in your tree, but I guess that you don't know how to use them, because they're useless if they have no children. You could definitely use them for a menu, but the script I posted doesn't. Seelct slices woudl be useful if you created two versions of each menu item, one highlighted and with cursor next to it, and one not. That's simpler, but more work than just having one copy and changing its appearance with a script.
Last edited by TMC on Mon Aug 24, 2020 2:09 pm, edited 2 times in total.
bis_senchi
Red Slime
Posts: 64
Joined: Sat Apr 20, 2019 8:59 am

Post by bis_senchi »

Thanks your answer TMC!

I reorganised the slice tree and make the cursor sprite children.
By the way there are no place to specify that such slice collection part is a
parent, so I assume they are parent by default.

Another thing that I don't fully understand are the errors the debugger pointed out. What do they mean?
It seems to be linked with slice position and text color...

What should I check to get rid of them? The slice tree? The script?
User avatar
Bob the Hamster
Lord of the Slimes
Posts: 7658
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

All those error messages mean you used spice commands on an empty variable.

The value of the variable was 0 instead of being a slice handle
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Do you mean you still get those errors? It looks like the "sl" variable is 0. So make sure that the "menu items" slice has at least 3 children, and "selection" is a value between 0 and 2.
I don't know what you mean by "By the way there are no place to specify that such slice collection part is a
parent"

Sorry again, I just realised I made a mistake. (I haven't tested the script myself.) Actually, because of the line "sl := slice child (menu items, selection)", it means the three text slices need to be the first 3 children of the 'menu items' slice, e.g. like

Code: Select all

Rectangle    menu items
  Text
  Text
  Text
  Sprite   menu cursor 
or

Code: Select all

Rectangle    menu items
  Text
  Text
  Text 
Sprite   menu cursor
bis_senchi
Red Slime
Posts: 64
Joined: Sat Apr 20, 2019 8:59 am

Sorry to ask that basic slice question but...

Post by bis_senchi »

I'm sorry to ask such a basic questions :???: about about slices but ....

How to make a parent slice
If I'm not mistaken you have to use to indicate that you want to slip chidren slice


How to make a child slid?
-> is there a line a option (for example "slice type: child/ slice type: parent )

What is the child auto sort option for?

What is parent fill yes option for?

I'm new to slice collections so...
Anyway as always thanks in advance for the answers and special thanks to James & TMC for their answers.
User avatar
Bob the Hamster
Lord of the Slimes
Posts: 7658
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

In the slice editor, there is no menu item for parent.
You need to select the slice, and then hold shift and press the right arrow key.

The selected slice will be indented to the right. It will become the child, and the parent will be the slice above it
bis_senchi
Red Slime
Posts: 64
Joined: Sat Apr 20, 2019 8:59 am

How do I use slice look up code for several things

Post by bis_senchi »

Thanks Bob the Hamster! I managed to put them children using Shift and the -> key and it worked.

I would like to try to translate my game in japanese.

So the test slice "details" would became a group of 6 box border sprites
デ ィ テ ィ ー ル

The text slice "card" would became a group of 3 box border sprites
カード

And the text slice "end" would became a group of 3 box border sprites
エンド

I would like to create a group a 6 slice sprite elements and 1 group of 3 and another group
of three box edge sprite element and make them affected the same way the text slice did in the script. One whole group would be affected by sprite palette change (to create selection
effect on screen) at the same time.

Is it possible to do this? How do I create "groups" in a slice collection?

As always thanks in advance for the anwers
Last edited by bis_senchi on Sun Aug 30, 2020 3:39 am, edited 2 times in total.
User avatar
Bob the Hamster
Lord of the Slimes
Posts: 7658
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

I recorded a video demonstrating how to use slice parenting to group together sprites in a container

[yt]zcfhBmu8_0Y[/yt]
bis_senchi
Red Slime
Posts: 64
Joined: Sat Apr 20, 2019 8:59 am

Thanks for the video

Post by bis_senchi »

Thanks for the video Bob The Hamster! I was really useful. May be we should create video tutorial and update them in the wiki.... A container with sprites in it is exactly what I need.

Now all the left are the command line to alter the sprites at the same time.
Just like the rectangle and the text lines, I think I need to use a look up code for the container.

The question is should I put all the sprite in the same container and alter them, but It would make me use a look up code for each characters...

For a start, I think I should make a 3 containers. One with white sprite letter, one with light yellow sprite and the third with lemon yellow sprite. (It is works, I may double it for more natural highlight effet)

2 containers would be invisible most of the those and I would use the look up slice to alter
with container & sprite is visible.
So could you tell me what command should be used to turn a container (and its elements) invisible?

As always thanks a lot for the help!
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

You can make a slice visible/invisble with "set slice visible (sl, true)" and "set slice visible (sl, false)"

But you said you want two containers to be invisible and the third visible. This can be done using a Select slice. Just one child of a Select slice is visible, the others automatically become invisible. You use "set select slice index" (or "set selected child") for that:

Code: Select all

Select   # This is a single menu item
  Container
    Sprite    # One of the characters
    Sprite
    # etc
  Container
    Sprite    # One of the characters
    Sprite
    # etc
  Container
    Sprite    # One of the characters
    Sprite
    # etc
Write "set select slice index (sl, 0)" to make the first visible and other two invisible, "set select slice index (sl, 1)" to make the second visible, etc.

However! It's a lot of work to create all those slices; there's a much easier way. Don't create three copies of the text, just have one copy, and use the following script which changes the palettes of all the sprite children of a slice:

Code: Select all

script, change child palettes, parent, palette, begin
  variable (child)
  child := first sprite child (parent)
  while (child) do (
    set sprite palette (child, palette)
    child := next sprite sibling (child)
  )
end
So if your slice collection looks like this:

Code: Select all

Rectangle    menu items
  Container     # This is the first menu item
    Sprite    # One of the characters
    # etc
  Container
    Sprite    # One of the characters
    # etc
  Container
    Sprite    # One of the characters
    # etc 
Then you can write:

Code: Select all

 sl := slice child (menu items, selection)  # Slice for new selection 
 change child palettes (sl, 2)
(The first line of code is from the script I posted earlier)
Last edited by TMC on Mon Aug 31, 2020 3:41 pm, edited 1 time in total.
bis_senchi
Red Slime
Posts: 64
Joined: Sat Apr 20, 2019 8:59 am

New slice collection

Post by bis_senchi »

So, I used a free collection slice and re-created the menu. I've assignated menu items to the containers.
What left are the command which with a lookup code, can act on the childrens... I wonder if
it possible... :???:

Image

How should I modify the previous script to make it exactly do the same?

Code: Select all

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)

  variable (child)
  child := first sprite child (parent)
  while (child) do (
    set sprite palette (child, palette)
    child := next sprite sibling (child)
    )
    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)  does not work anylonger
  # What commands should go here? 
  # sl := slice child (menu items, selection)  # Slice for new selection
  #change child palettes (sl, 2)

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

  wait
)
free slice (collection)


Anyway, as always thanks for the help and feel free to comment
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

You should have only one slice with the "menu items" lookup code, which should be the parent of the three menu items:

Code: Select all

Sprite   # The cursor
Rectangle    menu items
  Container     # This is the first menu item
    Sprite    # One of the characters
    # etc
  Container
    Sprite    # One of the characters
    # etc
  Container
    Sprite    # One of the characters
    # etc 
Last edited by TMC on Wed Sep 02, 2020 10:43 am, edited 1 time in total.
bis_senchi
Red Slime
Posts: 64
Joined: Sat Apr 20, 2019 8:59 am

It works! But what happened to the cursor?

Post by bis_senchi »

I tested my script and it works very well.

Here is the new version of my slice tree

Image

But there's something strange: When I test the game my cursor does not appear

Image

Does anyone has idea about it could that come from?

Thanks for help! I would have taken much more time and efforts if I had tried to do all on my own!
Last edited by bis_senchi on Fri Sep 04, 2020 5:51 am, edited 1 time in total.
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

You parented the menu cursor to one of the menu items! That's a problem, because it means "change child palettes" will change it too. Move it completely outside of "menu items".

Try changing the line

Code: Select all

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

Code: Select all

  put slice screen (cursor, slice screen x(sl) -- 30, slice screen y(sl)) 
Last edited by TMC on Fri Sep 04, 2020 3:39 pm, edited 1 time in total.
Post Reply