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

Where is located the bitset pause available outside battle?

Post by bis_senchi »

Hello, I'm using my own script to make the game pause but in some of my games, when I
press the key pause/Atten the word paused appeared and then my script is launched

It make the whole thing ackward. The problem is due to the fact that a long time ago I activated the bitset pause avaliable
outside battle (most certaintly in the edit general menu settings.)
The problem is, I can't find it anymore. the OHRRPGCE has been updated several times since then. I would like to unactive it so that only my script launches when I press "pause" on the keyboard.

Coud someone tell me where it is? Has the place changed?
Last edited by bis_senchi on Mon Aug 19, 2019 11:15 am, edited 1 time in total.
User avatar
Bird
Slime Knight
Posts: 227
Joined: Thu Jan 26, 2012 2:19 pm
Location: Germany

Post by Bird »

Hey, there! The debugging keys bitset is what you are looking for. Under "Edit General Game Settings" search for "Preference Bitsets" and then far down is "Enable Debugging Keys". It that isn't selected, the game can't be paused with the Pause key on your keyboard. However players might find out, that they can cheat with F4, F11 and F12...

There were also some rearranged bitsets for pauses in the battle system, that are now listed under "Edit Genral Game Settings", "Battle System" and then "Battle preference bitsets".
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Yes, outside of battle the Pause key counts as a debug key ad is disabled by disabling debug keys.
You are mistaken, it is a recently added feature and there never was a bitset for it.

The Pause function in battle always works even if debug keys are disabled. Those bitsets Bird mentioned are for pausing while in battle menus, etc.

Hmm, I should add a "pause game" script command. (But you can already get close to the same effect by using all the "suspend" script commands).
Last edited by TMC on Tue Aug 20, 2019 9:38 am, edited 1 time in total.
bis_senchi
Red Slime
Posts: 64
Joined: Sat Apr 20, 2019 8:59 am

As always... I have another question

Post by bis_senchi »

Thanks a lot! I found it. That was indeed what I needed the bitset disable debugging keys were not active.
And now... I have another question :hurr:

To embetter my game design I've made a slice collection. So I launch it

Code: Select all

variable (game menu)
game menu:= load slice collection (0)

The collection is composed of 4 small ennemies sprite used as menu items

Sprite 1 (equip menu) look up code 1
Sprite 2 (status menu) look up code 2
Sprite 3 (save menu) look up code 3
Sprite 4 (items menu) look up code 4

Reading the documentation I learned that you could up look up code for handling so I gave them one
I would like to change/update the menu items so that when the player movers the arrow the
sprite selected change slighly so that the player understand this is the menu item which he/she has selected.


My question is the following: what command should I use?

1- I need a command that goes into the slice collection and select the sprite
lookup slice (lookup code, start slice) seems to be the one.

2- I need another command that goes swap sprite/ replace it with another one from the collection (this one has slighty brigther colors, so the player thingsthis is what is selected) replace sprite?

I'm sorry if my question is complicated... I've never used look up slice before, so a example would really great

If you don't understand somthing, feel free to ask for further details. Thanks in advance for the help!
Last edited by bis_senchi on Wed Aug 21, 2019 4:23 am, edited 1 time in total.
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Yes, you're correct, you can use "lookup slice" to find a slice, and "replace attack sprite", "replace small enemy sprite", etc, to change a sprite slice into a different sprite. Or you can use "set sprite set number" instead, or maybe the easiest solution is just to change the palette, with "set sprite palette", because then you can use the same two 'selected' and 'not selected' palettes for all your sprites, simplifying the code.

You can also use Select slices. How that works is that each selectable item is a Select slice with two children: one sprite that appears when unselected, the other selected. Only one of them is visible at once. You can control which by using "set select slice index" on the select slice. That way you don't need to put any spriteset ID numbers into your script, you can define it all in the slice editor.

A tricky part might be defining which slice becomes selected when you press left/right/up/down.
By coincidence, kylekrack posted scripts for a slice-based menu in Discord just a couple days ago, but it hasn't been put on the wiki yet. He might still make changes to it. Maybe it's helpful to you. You place the mnenu item slices whereever you want and the script makes left/right/up/down switch selected slice based on their position.
https://cdn.discordapp.com/attachments/ ... Source.zip
ImageImage
Last edited by TMC on Wed Aug 21, 2019 1:03 pm, edited 1 time in total.
bis_senchi
Red Slime
Posts: 64
Joined: Sat Apr 20, 2019 8:59 am

Post by bis_senchi »

Thanks for the advice! I think that changing the sprite palette through plotscripting is what I need! I will use
set sprite number then.

I have another question about the look up code.
Does the look up code involve all slice collection or just one? I mean if I use look up slice code 2 in slice collection 1 can I
also give up number 2 as a look up slice code in my slice collection number 4?
May it is better to give another figure....

Thanks again for your answer!
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Yes, you can give the same lookup code to multiple slices. "lookup slice" will return the first slice it finds with that lookup code. But it takes an optional second argument to only search the descendents of one slice, for example to only search one loaded slice collection:

Code: Select all

variable (collection1, collection2, sl1, sl2)
collection1 := load slice collection (1)
collection2 := load slice collection (1)  # Load two different copies of the same slice collection
sl1 := lookup slice(sli: menu box, collection1)
sl2 := lookup slice(sli: menu box, collection2)
Last edited by TMC on Mon Aug 26, 2019 12:25 am, edited 1 time in total.
bis_senchi
Red Slime
Posts: 64
Joined: Sat Apr 20, 2019 8:59 am

Problems with string clearing

Post by bis_senchi »

Thanks for this information about look up slice. It is very interesting.
I have a problem with clearing strings.

In my menu script I have these string that appears

Code: Select all


string from text box (14, 17, 0) #get hero name
string from text box (15, 17, 1) #get current level
string from text box (16, 17, 2) #get current hp level
string from text box (17, 17, 3) #get current sp level
string from text box (34, 17, 4) #get current attack figure
string from text box (35, 17, 5) #get current attack figure
string from text box (36, 17, 6) #get current attack figure
string from text box (37, 17, 7) #get current attack figure
string from text box (38, 31, 0) #get current attack figure

show string at (14, 25, 38)
show string at (15, 25, 52)
show string at (16, 25, 62)
show string at (17, 25, 72)
show string at (34, 25, 82)
show string at (35, 25, 92)
show string at (36, 25, 102)
show string at (37, 25, 112)
show string at (38, 25, 122)


wait (23)
clear string (14) #make disappear all stats infos
clear string (15)
clear string (16)
clear string (17)
clear string (34)
clear string (35)
clear string (36)
clear string (37)
clear string (38)
When I use wait (23) and clear string in the same script, the strings disappear without problems. My problem is the following
I would like the clear string command line to be run in another script. So I put the line in antoher script.
The problem is string doesn't disappear anymore.

That problem seems to be linked with buffer clearing and screen infos update. Another possibility is that there are sevral lines and that
Hspeak.exe has a problemto compile but there's a show backdrop line after that and the line in interpreted correctly...

I tryed to change clear string to hide string instead, but the result is the same. I still works if the disappearing command lines are on the same script.May be storing the string figures into a global variable could help...

My question is simple what should I do? How do I make a string appear on a screen on a script and disappear later in another one?
User avatar
Bird
Slime Knight
Posts: 227
Joined: Thu Jan 26, 2012 2:19 pm
Location: Germany

Post by Bird »

Can't reproduce that! These two scripts here did the intended.

Code: Select all

include, plotscr.hsd

plotscript,showmaster,begin
$1 = "A"
$2 = "B"
$3 = "C"
$4 = "D"
show string at (1,20,20)
show string at (2,40,40)
show string at (3,60,60)
show string at (4,80,80)
waiter
end

script,waiter,begin
wait (23)
clear string (1)
clear string (2)
clear string (3)
clear string (4)
end
Maybe the strings are appearing for a second time from another script, after the "hide string" commands were executed? Also, "clear string" might be problematic, because the empty strings would be still there. If another script gives them input again, they would appear again.
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Based on what you worte, I think the problem is simply that the second script doesn't run after the first. Try putting "show value(1)" before the "wait(23)", "show value(2)" after it, and "show value(3)" in the second script.. Or press F10 to enter the script debugger to see which scritps are running (you typically won't see a script if it contains no 'wait' commands).

By the way, you could replace all those string commands with a single text slice. But it will not solve your problem. "clear string", "hide string" or "free slice" would all have the same effect of hiding the text, though Bird is right that there's a possible difference between hiding and clearing strings.
bis_senchi
Red Slime
Posts: 64
Joined: Sat Apr 20, 2019 8:59 am

slice collection manipulation

Post by bis_senchi »

Thanks for the help! It's true that show value can be useful. As it works better this way, I'll keep the show string at and the clear string line on the same script and divide code in another way.

I've got another question. I would like to know if there is a equivalent for silice to the find menu ID
To prevent script1 intereptor errors I would like to check is a slice collection is already loaded
and make it diasppear after checking that it is on screen indeed

Code: Select all


variable (show item menu) #variable for collection manipulation
show item menu:= load slice collection (1) #load on screen
free slice (show item menu) #clear screen

Anybody knows?
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Just make "show item menu" a global variable, then you can use it later:

Code: Select all

global variable (1, show menu item)  # pick any unused global id

  # Inside one script...
  show item menu:= load slice collection (1) #load on screen 

  # Somewhere else...
  if (show item menu) then (
    free slice (show item menu)
    show item menu := 0
  )
Alternatively, you can use "slice lookup" for that, then you can use "lookup slice" to find out whether the slice collection exists (it will return false/0 if it doesn't) and delete it if so. Press F5 in the slice collection editor to show the root slice of the collection, which is normally hidden. It's the root slice which you want to give a lookup code.
Last edited by TMC on Mon Sep 02, 2019 1:47 am, edited 1 time in total.
bis_senchi
Red Slime
Posts: 64
Joined: Sat Apr 20, 2019 8:59 am

Post by bis_senchi »

I see... I'll try with slice look up.

I have another problem. I have made a slice collection for player selection . The game has one hero on screen, so I want the personn who plays
to be able to switch the main player

<------ H1Portrait H2Portrait H3Portrait--->



The personn who plays the game would be able to select the player.
This is quite complex stuff to implement but I want to try nonetheless. My first trouble is to check and record selection

Highlighting and update slection can be done with replace portrait sprite, but I first need to record selection.
But default H1portrait (which is main hero/ hero 0) is highligh.
On the edit slice collection menu H1Portrait has look up code 1, H2Portrait has look up code 2 etc..

Is there a way to store a slice lookup code into a variable?
The new problem is arrow key implementation.

The first time I press the left arrow, I go from H1Portrait to H2Portrait and the second time from H2Portrait to H3Portrait
but I also want to the player to be able that if he pressed the right arrow to H2Portrait to H1Portrait

As always thanks very much for the help! Any suggestion is welcome...
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Slice lookup codes can be named in the slice editor, and that name is then available in your scripts as a constant.
For example if lookup 1 is named "H1Portrait" then the constant "sli:H1Portrait" has the value 1.

But maybe what you were asking for is this:

Code: Select all

variable&#40;H1&#41;
H1 &#58;= lookup slice&#40;sli&#58;H1Portrait&#41;
Add a variable, call it "selection", which is 0, 1, or 2 for the first, second or third hero.
Then you can find the selected portrait slice with:

Code: Select all

sl &#58;= lookup slice&#40;sli&#58;H1Portrait + selection&#41;  #or lookup slice&#40;1 + selection&#41;  
Now you need a loop to listen for keypresses and update "selection":

Code: Select all

variable &#40;selection, sl&#41;
while &#40;true&#41; do &#40;
  if &#40;key is pressed&#40;key&#58;space&#41; || key is pressed&#40;key&#58;enter&#41; || key is pressed&#40;key&#58;ctrl&#41;&#41; then &#40;break&#41;  # When a use key is pressed, exit
  #if &#40;key press&#40;use key&#41;&#41; then &#40;break&#41;   # Better way to write this, new in Fufluns

  if &#40;keyval&#40;key&#58;left&#41; > 1&#41; then &#40;selection -= 1&#41;
  if &#40;keyval&#40;key&#58;right&#41; > 1&#41; then &#40;selection += 1&#41; 
  if &#40;selection == -1&#41; then &#40;selection &#58;= 2&#41;  # wrap around from left to right
  if &#40;selection == 3&#41; then &#40;selection &#58;= 0&#41; # wrap around from right to left

  # Update the slices to show which portrait is selected here
  sl &#58;= lookup slice&#40;1 + selection&#41;
  #...

  wait
&#41;
I assume you are using Etheldreme. If you are using nightly builds/Fufluns, I would have written that script in a simpler way:
if (keypress(left key) > 1) then (selection -= 1)
if (keypress(right key) > 1) then (selection += 1)

Or you can use kylekrack's script
Last edited by TMC on Tue Sep 03, 2019 12:11 pm, edited 3 times in total.
bis_senchi
Red Slime
Posts: 64
Joined: Sat Apr 20, 2019 8:59 am

As always... another question poped up

Post by bis_senchi »

Thanks for all these infos.
I would like to know if the slice look up funtion works for slice collections.
Here is my problem: I've created slices and put them into collection to make
a permanent menu which includes a life bar an a weapon selection (that's slice collection 0)

When the player presses esc I would like that menu/ slice colection 0 to disappear to launch
slice collection 1 show item menu

For better handling I gave them a separate global variable.
My problem is the following: when the command free slice (screen menu) run it has no effect...

However, the command items menu:= load slice collection (1) works well
I think the buffer memory limitation may be behind this

Code: Select all


  Global variable &#40;10, screen menu&#41; #use for screen menu text box
  Global variable &#40;12, items menu&#41; #use for main game menu text box 

#------------------------------------------------------
plotscript, my main game menu, begin
 

free slice &#40;screen menu&#41; #make disappear screen menu
wait &#40;2&#41;

fade screen out &#40;60, 60, 60&#41; #white fade out
show backdrop &#40;8&#41;
wait &#40;8&#41;
set tag &#40;tag&#58; arrow key is used, on&#41;

set variable &#40;YourM,current map&#41;  #permet d'enregistrer notre position dans le jeu
set variable &#40;YourX,herox&#40;me&#41;&#41;
set variable &#40;YourY,heroy&#40;me&#41;&#41;

set variable &#40;MyPicSet, get hero picture&#40;me&#41;&#41;  #permet d'enregistrer notre apparence
set variable &#40;MyPal, get hero palette&#40;me&#41;&#41;
set variable &#40;MyDirection, hero direction&#40;me&#41;&#41;
items menu&#58;= load slice collection &#40;1&#41; #load collection for the hand-made main game menu

set hero picture &#40;me, 0&#41; # main hero became invisible mode and is place near menu items on the map
set hero palette &#40;me, 1&#41;
set hero position &#40;me, 2, 3&#41;
teleport to map &#40;10, 4, 5&#41; #teleport to map 10, main menu map
wait &#40;2&#41;

fade screen in # screen came back to normal. player can handle the menu
show map
wait &#40;3&#41;
gamemenuisactive&#58;=true
wait&#40;1&#41;

end# end of the script

When you manipulate menu created with edit menu of the OHR, you have to find menu id first, and then, you can make the menu do what you want. To solve my problem I would need the equivalent but for slice collection. Is there any?
Look up slice seems great but does it works for a whole slice collection?

As always thanks in advance for your help!
Last edited by bis_senchi on Thu Feb 13, 2020 6:51 am, edited 1 time in total.
Post Reply