Post new topic    
Page «  1, 2, 3, 4
Slime
Send private message
I managed to make the cursor re-appear but... 
 PostFri Sep 04, 2020 4:09 pm
Send private message Reply with quote
Thanks for the advise TMC.

I managed to make the cursor reappear but when I use the arrow key the cursor move only a little above or a little bit under the starting sprite bloc デ ィ テ ィ ー ル / Details

I don't understand very well why is that....
Metal King Slime
Send private message
 
 PostSat Sep 05, 2020 1:50 am
Send private message Reply with quote
Oh, I see the problem, by looking at the screenshot of your slice collection.
I had assumed you would make each menu item a container slice positioned at the visual location of the menu item, but instead you've placed them all at 0,0 and moved the individual sprite slices to where you want the text to appear.
That "put slice screen" line uses the container slice location to set the cursor position.

Either:

1. You could change your slice collection to be like I said above. The easiest way to do so is to first unparent all the sprites from the container by pressing Shift-Left on them, then repositioning the container, then reparenting the sprites with Shift-Right. This way, you can move the container position without causing any of the sprite visual locations to change.

2. Or you could just replace that line with something like
Code:
if (selection == 0) then (put slice screen (cursor, 20, 16))
else if (selection == 1) then (put slice screen (cursor, 20, 50))
else (put slice screen (cursor, 150, 16))
Slime
Send private message
and there's problems with highlighting 
 PostSun Sep 06, 2020 6:25 am
Send private message Reply with quote
Thanks as always TMC. After some test, I think I'll use the harder method and use the line of code you posted.

I reorganised the slice tree and gave my cursor slice and independant container, it'll help with plotscripting manipulations and position calculation.



As almost always with script modification: a new problem appears: when I move the arrow, the wrong menu line/ container group slice is altered as you can see



The problem comes from the script especially the lines refering which arrow are used and
the actions that comes from it
Code:

plotscript, japanese menu, begin
suspend player
suspend npcs

show text box (133) # Let's test the menu in japanese.
wait for text box

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

# 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) do, begin     #Details...
     show text box (139)
     wait for text box
     end #end for case 0
    
     case(1) do, begin  #Discard...
     show text box (140)
     wait for text box
     end #end for case 1
    
      case(2) do, begin #End turn...
     show text box (142)
     wait for text box
     end #end for case 2
    
    
    ) #end for switch
    break  # exit
  )#end for the if

  # 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
  change child palettes (sl, 0)  # 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
  change child palettes (sl, 30)  # Change this to highlighted text colour!

  # Move the cursor
  if (selection == 0) then (put slice screen (cursor, 18, 16))
  else if (selection == 1) then (put slice screen (cursor, 18, 50))
  else (put slice screen (cursor, 150, 16))
 
  wait
)
free slice (collection)

resume player
resume npcs
end #end of the script


How should I change the script so that it correctly keeps alter the slice group which corresponds to the menu line the player select and put back to normal the other group ?

As always thanks a lot for your advice
Metal King Slime
Send private message
 
 PostSun Sep 06, 2020 11:57 am
Send private message Reply with quote
The problem is that you made the cursor slice the first child of the "menu items" container. The first child of that container should be the first menu item, the second should be the second menu item, etc. The following line of the script relies on that:
Code:
sl := slice child (menu items, selection)

If you want to make it a child of the "menu items" slice you can, but make sure it's the last child, not the first one.
Slime
Send private message
I put cursor slice down on the slice tee but... 
 PostMon Sep 07, 2020 10:45 am
Send private message Reply with quote
Hello,

I did what your said and put the cursor slice last but it didn't change the highlighting problem .
No complain for Hspeak.exe whatsoever ^_^.

I think (but I may be wrong) that the problem come from the part


Code:

 # 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
  change child palettes (sl, 0)  # 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
  change child palettes (sl, 30)  # Change this to highlighted text colour!


In the english version of the menu slice text were used as a marker but here the number of element in the slice collection changed. You don't have text line but a container linked to several slices. What about lookup slice code?

Strangely the cursor and selection are correct, only highlighting goes wrong. When the cursor is near end, the script to end the turn launch, but it's the slice in the container above (card/ カード ) which is higlighted...

Why is that? I wonder... Confused Any ideas?
Metal King Slime
Send private message
 
 PostTue Sep 08, 2020 1:21 am
Send private message Reply with quote
Oh, it looks like you have the menu items in the wrong order in the slice collection. The first one is at the top-left, the second is at bottom-left, and the third is top-right. To reorder the slices, just select one of the Container slices and press Shift-Up or Shift-Down to reorder it relative to the other containers.
Display posts from previous:
Page «  1, 2, 3, 4