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
31
Ok, I think I figured out where things were going wrong.  You don't want to be changing code in Inv.sc.  The code you want is in Main.sc.

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

Code: [Select]
(instance Test_Object of Iitem
(properties
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
(properties
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?

32
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?

33
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]
  catapult
  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.

34
Here's the code I think you are referring to in Inv.sc

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.

35
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.

36
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?

37
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

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

39
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?

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

41
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).

42
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
(properties
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
)

43
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 DisposeCode.sc which has improved things somewhat.

44
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?

45
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.