Super Sam accidentally the entire Wiki User Wiki.

OHR game/code

From Wuw Archive

The HamsterSpeak code is placed here.

Menu Status System

define constant (0, STATUS_ISOPEN) # Slice extra for keeping track of whether the status display is currently shown, to prevent repeated script calls

script, mainloop, begin
   variable (statusdisplay, gameisplaying)
   
   statusdisplay := create container(1, 1) # This slice will be the parent of the rectangles, portrait sprites, and etc for displaying character status on the menu
   set slice extra (statusdisplay, STATUS_ISOPEN, false)
   
   gameisplaying := 1
   
   while (gameisplaying) do (
      if (menu is open(0) == true) then ( # This is all you have to do.  Just check if the menu is open instead of determining keypresses.
         if (get slice extra(statusdisplay, STATUS_ISOPEN) == false) then (openstatusdisplay) # The slice extra check is optional, but it helps to have it so that you won't be opening the status screen every game tick
      )
      else (if (menu is open(0) == false) then (
         if (get slice extra(statusdisplay, STATUS_ISOPEN) == true) then (closestatusdisplay)
      ))
      
      wait (1)
   )
end

script, openstatusdisplay, begin   
   variable (char1rect, char2rect, char3rect, char4rect)
   variable (char1portrait, char2portrait, char3portrait, char4portrait)
   
   char1rect := create rectangle(...) # Fill in sizes and position
   if (hero in slot(0) == hero:Whatever) then ( # There is no 'get hero portrait' command yet, so do a manual check
      char1portrait := load portrait sprite(...) # Fill in portrait here too
   )
   
   set parent (char1rect, statusdisplay)
   set parent (char1portrait, statusdisplay)
   
   # Repeat for all the character slices
   
   set slice extra(statusdisplay, STATUS_ISOPEN, true)
end

script, close status display, begin   
   # I would put code here to clean up this, but someone probably has a proper way to do so than I would have
   
   set slice extra(statusdisplay, STATUS_ISOPEN, false)
end
Personal tools