Post new topic    
Page 1, 2, 3, 4  »
Red Slime
Send private message
Where is located the bitset pause available outside battle? 
 PostMon Aug 19, 2019 11:14 am
Send private message Reply with quote
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?
Slime Knight
Send private message
 PostTue Aug 20, 2019 6:03 am
Send private message Reply with quote
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".
Metal King Slime
Send private message
 PostTue Aug 20, 2019 9:35 am
Send private message Reply with quote
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).
Red Slime
Send private message
As always... I have another question 
 PostWed Aug 21, 2019 4:22 am
Send private message Reply with quote
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


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!
Metal King Slime
Send private message
 PostWed Aug 21, 2019 1:02 pm
Send private message Reply with quote
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.
Red Slime
Send private message
 PostSun Aug 25, 2019 4:51 pm
Send private message Reply with quote
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!
Metal King Slime
Send private message
 PostMon Aug 26, 2019 12:24 am
Send private message Reply with quote
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:

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)
Red Slime
Send private message
Problems with string clearing 
 PostTue Aug 27, 2019 4:17 am
Send private message Reply with quote
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


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?
Slime Knight
Send private message
 PostTue Aug 27, 2019 8:11 am
Send private message Reply with quote
Can't reproduce that! These two scripts here did the intended.

include, plotscr.hsd

$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)

wait (23)
clear string (1)
clear string (2)
clear string (3)
clear string (4)

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.
Metal King Slime
Send private message
 PostTue Aug 27, 2019 8:53 am
Send private message Reply with quote
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.
Red Slime
Send private message
slice collection manipulation 
 PostSun Sep 01, 2019 10:43 am
Send private message Reply with quote
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


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?
Metal King Slime
Send private message
 PostMon Sep 02, 2019 1:46 am
Send private message Reply with quote
Just make "show item menu" a global variable, then you can use it later:

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.
Red Slime
Send private message
 PostTue Sep 03, 2019 10:11 am
Send private message Reply with quote
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...
Metal King Slime
Send private message
 PostTue Sep 03, 2019 12:06 pm
Send private message Reply with quote
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:
H1 := lookup slice(sli:H1Portrait)

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:
sl := lookup slice(sli:H1Portrait + selection)  #or lookup slice(1 + selection) 

Now you need a loop to listen for keypresses and update "selection":


variable (selection, sl)
while (true) do (
  if (key is pressed(key:space) || key is pressed(key:enter) || key is pressed(key:ctrl)) then (break)  # When a use key is pressed, exit
  #if (key press(use key)) then (break)   # Better way to write this, new in Fufluns

  if (keyval(key:left) > 1) then (selection -= 1)
  if (keyval(key:right) > 1) then (selection += 1)
  if (selection == -1) then (selection := 2)  # wrap around from left to right
  if (selection == 3) then (selection := 0) # wrap around from right to left

  # Update the slices to show which portrait is selected here
  sl := lookup slice(1 + selection)


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
Red Slime
Send private message
As always... another question poped up 
 PostThu Feb 13, 2020 6:38 am
Send private message Reply with quote
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


  Global variable (10, screen menu) #use for screen menu text box
  Global variable (12, items menu) #use for main game menu text box

plotscript, my main game menu, begin

free slice (screen menu) #make disappear screen menu
wait (2)

fade screen out (60, 60, 60) #white fade out
show backdrop (8)
wait (8)
set tag (tag: arrow key is used, on)

set variable (YourM,current map)  #permet d'enregistrer notre position dans le jeu
set variable (YourX,herox(me))
set variable (YourY,heroy(me))

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

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

fade screen in # screen came back to normal. player can handle the menu
show map
wait (3)

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!
Display posts from previous:
Page 1, 2, 3, 4  »