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 ... 68
SCUMMCompanion?  That's awesome.  Looks like a .NET project?

Followed.  Nice idea for getting motivation to continue a project!

SCI Community How To's & Tutorials / Re: Fun (?) project for someone.
« on: March 22, 2021, 07:32:17 PM »
Thanks for this sample code Troflip.  I didn't go as far as you suggested, but I did wire it into where the debugging usually goes within

Code: [Select]
(define VAR_OFFSET 8)

(procedure (FindNextObject start &tmp i value)
(= i start)
(while (u< i $fffe)
(= value (Memory memPEEK i))
(if (== value $1234)
; Found an object
(+= i 2)
(return i)

(procedure (PrintObjectName location &tmp listVarCount endExclusive)
(= listVarCount (Memory memPEEK (+ location 2)))
(-= listVarCount UNLISTED_VAR_COUNT) ;First 4 vars aren't listed
(= endExclusive (+ (+ location VAR_OFFSET) (* listVarCount 2)))
(if (u> location endExclusive)
    (return FALSE)
(DebugPrint "%x - %x: %s" location endExclusive (Memory memPEEK (+ location NAME_OFFSET_OFFSET)))

At first, I was getting an infinite loop when I ran the code until I added a check to make sure that the start address had to be before the end address - not sure it was the right solution or not, but it seemed to work.

Then I just added this case in the handleEvent
Code: [Select]
(KEY_ALT_o   ; show all objects in memory
(= i 0)
(while (u< i $fffe)
(= i (FindNextObject i))
(if (not (PrintObjectName i))
(+= i 2)

With this, I was able to determine that dynamic scripts that were being loaded by my game were never being unloaded.  From there I was able to mitigate the issue.

AGI Development Tools / Re: agikit 0.4 + Visual Studio Code
« on: March 13, 2021, 10:16:25 AM »
Making games in VS Code? That's awesome 😎

Here's how I do it (there may be different/better ways).  Reference the entire inventory, then update based on the index of the item in the inventory using the constant defined for the inventory item in

To set the value:
Code: [Select]
    ((gInv at: INV_TEST_OBJECT) count: 3)

To get the value:
Code: [Select]
    (FormatPrint "count = %d" ((gInv at: INV_TEST_OBJECT) count?))

I would suggest introducing a 'count' property to the inventory item class (Iitem).  That way you can keep track of the count within the inventory item itself and you won't have the headache of having to keep track of the count with other global variables.

In the code I posted, just swap out the reference that prints out the view # for your new count property.

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?

Pages: [1] 2 3 ... 68

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

Page created in 0.11 seconds with 21 queries.