Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - gumby

Pages: 1 2 [3] 4 5 ... 69
Ok, I think I figured out where things were going wrong.  You don't want to be changing code in  The code you want is in

Start by changing the description on the Test_Object to what's below.

Code: [Select]
(instance Test_Object of Iitem
said 'object'
description {This is a test object in your inventory. View = %d}
owner 0
view 800
loop 0
cel 0
script 0
name "Test Object"

Next, change the Iitem class:

Code: [Select]
(class Iitem of InvI
said 0
description 0
owner 0
view 0
loop 0
cel 0
script 0

(method (showSelf &tmp [text1 100] [text2 130] [nounName 30])
           (Print (Format @text2 description view) #title objectName #icon view loop cel)    

Now when you look at the item in your inventory, it'll also print the view number as part of the description.  Is that the sort of thing you are looking for?

I think I see what you are driving at Doan.  When you bring up an inventory item, you want the description of the inventory item to be displayed with some sort of parameterization in it. 

For example, assuming you had 10 different boxes in your inventory.  When you pulled up any one of the boxes, have the description include the count of the number of things inside it:  "Test Box - contains 5 items" or something like that?

Here's an example that I hacked together.

First, create a text resource (text.000) that holds a single parameterized string in the zeroth position that looks like this:
Code: [Select]
  A parameterized string with a %s.

Then create a text resource (text.001) that holds a few (3) nouns.
Code: [Select]
  rubber chicken
  bowling ball

Then in a room script, add this code:
Code: [Select]
(method (handleEvent pEvent &tmp [text1 100] [text2 130] [nounName 30])
   (super handleEvent: pEvent)
   (if (Said 'look')
      (GetFarText 1 (Random 0 2) @nounName)  ; get a noun out of text resource 1
      (GetFarText 0 0 @text1)                ; get the parameterized string out of text resource 0
      (IconPrint (Format @text2 @text1 @nounName) 0 0 0)

When the player types look, they'll get 'A parameterized string with a bowling ball'... or one of the 2 other possibilities.

Here's the code I think you are referring to in

Code: [Select]
   (IconPrint description view loop cel)

Essentially you need to pre-process the description string and do your variable replacement using the Format kernel call to make whatever substitution you want.

SCI Syntax Help / Re: SCI 1.1 - Refresh Inventory Screen
« on: February 13, 2021, 05:55:34 PM »
Thank you Kawa, I had not considered hooking into the InventoryItem and get it done with a doVerb method - works perfectly.  You are the man.

SCI Syntax Help / SCI 1.1 - Refresh Inventory Screen
« on: February 13, 2021, 02:15:37 PM »
I have a scenario where interacting with an inventory item on the inventory screen needs to change the currently displayed view for the item.  For example, the action being taken within the inventory screen is turning on a flashlight.  I want to swap out the view of the flashlight being off to a view of the flashlight being on.

A kludgey solution is to hide and show the inventory screen, but this also introduces a flicker-effect because the window is being torn down and redisplayed:

Code: [Select]
   (gInv hide:)
   (gInv show:)

What's the correct way to do this?  Is there a built-in way to ask the inventory screen to refresh itself?  Or should I instead reference the view within the inventory screen, change the view and call forceUpd - or something along these lines?

SCI Syntax Help / Re: SCI0 - Is the Template broken for togglesound?
« on: February 06, 2021, 06:30:16 PM »
This may be what you are looking for: Fixing F2 (ToggleSound) issue with Companion

This thread got accidentally (I think?) locked.  It's unlocked now.

Not sure in which context this is happening, but I've got a guess: the y-position of the hotspot in the door view has been changed or incorrect?

For completeness, in SCI1.1 you can get the desired result by setting the window to modeless.

Everything-Else / Re: Dialogue Interface
« on: January 19, 2021, 09:47:09 AM »
This was all before I found out about Heap memory restrictions so it's not like I can create a dialogue option for every imaginable topic relevant to the game

That's what made me abandon my attempt to port Zork to SCI0.  In my case it was allowing for inventory object interactions within the game that weren't scoped to a single room.  It's really tough to keep the heap down when the desire is to allow for the player to be able do anything at any point in the game.

However, what you are trying to do may be possible.  I did have a degree of success with dynamically loading scripts which handled Said()s and disposing of them as soon as they were unneeded (IIRC lots of Unload or DisposeLoad calls).

SCI Syntax Help / Re: SCI0 - Death Icon at Top of Window
« on: January 12, 2021, 09:45:12 AM »
If it helps, the window coordinates are properties in the Window class (top/left/bottom/right).

Code: [Select]
(class Window of SysWindow
top 0
left 0
bottom 0
right 0
color clBLACK
back clWHITE
priority -1
window 0
type 0
title 0
brTop 0
brLeft 0
brBottom 190
brRight 320
underBits 0

SCI Syntax Help / Re: Out Of Heap - DosBox vs ScummVM
« on: January 02, 2021, 04:44:29 PM »
So far the out of heap errors are only happening while playing/testing with DosBox, ScummVM doesn't exhibit the same issues. 

I'm sure I've got some more due-diligence to do with heap management - I have added additional scripts into the which has improved things somewhat.

SCI Syntax Help / Re: Out Of Heap - DosBox vs ScummVM
« on: January 02, 2021, 02:04:08 PM »
If I recall correctly, in ScummVM each script has its own 64KB segment on the heap, and any new objects you create are put on a separate 64KB segment too. So I don't think you can tell too much from asking how much free heap there is in ScummVM.

So it sounds like for my circumstance, I'm better off using ScummVM because it's doing memory management differently?  Which would potentially result in less 'Out of Heap' errors?

SCI Syntax Help / Out Of Heap - DosBox vs ScummVM
« on: January 02, 2021, 01:26:44 PM »
I'm working on an SCI1.1 game and I'm running out of heap.  In my testing I tried using DosBox and ScummVM and I found that upon starting up the game and immediately going into the debugger and viewing the available heap (alt-d, alt-r) there are differences.

In DosBox, I have 10040 bytes free.  In ScummVM, I have 32746 bytes free.  Does someone here have an explanation as to why this would be? 

Pages: 1 2 [3] 4 5 ... 69

SMF 2.0.14 | SMF © 2017, Simple Machines
Simple Audio Video Embedder

Page created in 0.188 seconds with 20 queries.