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....
Where is located the bitset pause available outside battle?
Moderators: marionline, SDHawk
-
- Red Slime
- Posts: 64
- Joined: Sat Apr 20, 2019 8:59 am
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
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: Select all
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))
Last edited by TMC on Sat Sep 05, 2020 1:51 am, edited 2 times in total.
-
- Red Slime
- Posts: 64
- Joined: Sat Apr 20, 2019 8:59 am
and there's problems with highlighting
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
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
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: Select all
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
As always thanks a lot for your advice
Last edited by bis_senchi on Sun Sep 06, 2020 6:26 am, edited 1 time in total.
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:
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.
Code: Select all
sl := slice child (menu items, selection)
-
- Red Slime
- Posts: 64
- Joined: Sat Apr 20, 2019 8:59 am
I put cursor slice down on the slice tee but...
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
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... Any ideas?
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: Select all
# 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!
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... Any ideas?
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.