Menu

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.

Show posts Menu

Messages - brewton

#21
Thanks, CW!
I didn't know that about the run-time object creation, so that's the missing piece in my logic.
Your solution is a lot more elegant. I guess for some reason I was thinking of using dictionaries as structs.
#22
Hi, I'm not sure how to ask this. It might be a two-part problem. If anything I'm just articulating the problem so I can understand it better myself.

First, here's a link to my project on GitHub so you can see what I'm trying to do.

I'm working on something that requires a dynamic array of dummy characters that I can reuse with different names and sprites and properties.
I haven't worked much with these concepts so please let me know if I am mistaken in how they function. I've read the manual and searched the forum but I think I'm kind of lost.

So far with my three test characters it works, but these are not dummy characters and are hard-assigned to inventory items.
The dummy characters are for visible inventory items in a scene, so all use the same view and are locked to a frame according to a custom property CharID assigned to inventory items.
Similarly, characters are assigned a custom property

This is the code I would like to replace.

Code: ags

  void drop_held_item()
  {
        InventoryItem* Item = player.ActiveInventory;                          // initialize the held item
        int CharID = Item.GetProperty("CharID");                               // what's the character?
        character[CharID].ChangeRoom(player.Room, mouse.x, mouse.y   offset);  // move the character to where the mouse was clicked - 'dropping' it.
        RemoveWalkableArea(2);
        character[CharID].PlaceOnWalkableArea();                               // stops the object being stuck on a wall or something        
        
        int InvFrame = Item.GetProperty("InvFrame");                           // what's the inventory frame ID of the item?      
        character[CharID].LockViewFrame(1, 0, InvFrame);                       // locks it to the item's sprite            
        
        RestoreWalkableArea(2);
        player.LoseInventory(Item);
        player.ActiveInventory = null;
  }

  void pick_up_item(InventoryItem* item, Character* itemChar)
  {
      itemChar.UnlockView();                          // no longer locked to the item sprite
      player.AddInventory(item, invSlots);            // places it in the cursor
      player.ActiveInventory = item;                  // makes it active
      itemChar.ChangeRoom(0);                         // sends it to the inventory room      
  }


I haven't worked with dynamic arrays or dictionary lists before but I think they could provide a solution.

What I want to do is write a function that handles:

Part 1: When an item is dropped on the screen:
- create a new dummy character
- create a dictionary key with the character's array value (ex cDummyItem[22])
- add values:
  . Inventory item number
  . Inventory item name
  . inventory item sprite number
  . inUse bool = true **
- use LockViewFrame to lock cDummyItem[22] to the sprite number assigned in its dictionary key
- assign the inventory item name to the character name

Part 2: When an item (character) is clicked
- retrieve the inventory item number and return the value
- reset the character instance
- reset the character dictionary key

So my initial code would become something like (not tested)
Code: ags

  void instance_dummy(InventoryItem* Item)
  {
      // Part 1 pseudocode from above
  }

  function destroy_dummy(Character* dummy)
  {
      // Part 2 pseudocode from above
      // returns inventory item      
  }

  void drop_held_item()
  {
        InventoryItem* Item = player.ActiveInventory;                          // initialize the held item
        instance_dummy(Item);
        player.LoseInventory(Item);
        player.ActiveInventory = null;
  }

  void pick_up_item(Character* itemChar)
  {
      *InventoryItem Item = destroy_dummy(itemChar);
      player.AddInventory(Item, invSlots);         // places it in the cursor
      player.ActiveInventory = Item;                  // makes it active
  }


I guess my questions are: would this work and is this a smart way to do this?
Also, would it be better to just keep creating new characters, or is it better to search through the array for the next available "inUse == false" character and reinitialize them with new values?
#23
The Rumpus Room / Re: Name the Game
Sun 11/10/2020 08:40:15
#24
The Rumpus Room / Re: Name the Game
Fri 09/10/2020 23:02:46
No one has it yet.
#25
The Rumpus Room / Re: Name the Game
Thu 01/10/2020 19:07:12
Here's a classic I've been replaying recently.

[imgzoom]https://i.imgur.com/6QL3CTa.png[/imgzoom]
#26
Quote from: VampireWombat on Wed 30/09/2020 22:35:48
I lacked the energy to complete my game. Good luck to anyone still working.

Me too. I have accrued several MAGS games in various stages of completion since 2016.
#28
( Í¡° ÍÅ"Êâ€" Í¡°)
#29
Quote from: selmiak on Sat 02/12/2017 15:00:41
Great Theme!
Finally it's time to actually do that blank white screen pixelhunt game where you have to find the one pixel in #fefefe color in 4k resolution... anyone interested in doing the art for my groundbreaking (it's in ultraHD!) pixelhunt project? :D ;)

Here you go.
#30
The Rumpus Room / Re: Trivia!
Sat 04/11/2017 13:22:45
Trivia is happening over!

Congrats to Babar and Gurok!

#1:    Babar   928
#2:    Gurok   850
#3:    ibispi   431
#4:    JimReed   190
#31
The Rumpus Room / Re: Trivia!
Sat 04/11/2017 06:31:27
I have Steam keys for:

Day of the Tentacle: Remastered
Grim Fandango: Remastered

for the top two scoring winners of the next round of trivia on #AGS!
#32
There is a definitive ending to the game.

I don't think he is sucking out their soul. He seems to be crushing their skulls.
For what purpose? I have no idea.

The game is based on these two scenes from S3E8:
1: Highway
2: Radio Station

One little tip: if you successfully headsplodesuck 3 people in a row, you refill 1 HP.

I can't remember what the maximum score is. Was working on making high scores persistent but I ran out of time.
#33
TMA: Won't find out until this coming Sunday evening. Until then, we're playing and rating the other games in the jam. I recommend checking them out, they're all pretty good!
#34
Hi, everyone.
Here is an experimental side-scroller that we have made based on S03E08 of Twin Peaks.

game by brewton
graphics by SecretFawful

Entry for Minimalist Jam 2017.

http://www.adventuregamestudio.co.uk/site/games/game/2178/

https://brewton.itch.io/got-a-light



EDIT: Added game to AGS database and added link.
EDIT 2: misspelled minimalistic
#35
Ah, I must have missed that part. Thanks again.

As an aside, it seems that there's no Move Up and Move Down options in either AGS v3.4.0.16 or AGS v3.4.1.3.
I managed to get it working by creating a new script.
#36
That's an odd solution. Thanks!  :-D
#37
Hi. I've got an enum set in the header of my global script. I'm modifying 9verbs template.
In guiscript I'm not able to use these enumerated values, getting an "undefined symbol" error.

Here's how I have it set up in my global header.
Code: ags
enum pc_char { // differentiates playable versions of characters from others
  pc_eOne,
  pc_eTwo,
  pc_eThree,
  pc_eFour,
  pc_eFive,
  pc_eSix 
};


Here's the code in the other script that throws the error.
current_kid is a global variable that is checked via a function called in repeatedly_execute.

Code: ags

    else if (action == eGA_Ability) { // ability verb setup
      if (current_kid == pc_eOne) tresult = "SPOILER %s";
      else if (current_kid == pc_eTwo)  tresult = "SPOILER %s";
      else if (current_kid == pc_eThree)  tresult = "SPOILER %s";
      else if (current_kid == pc_eFour)  tresult = "SPOILER %s";
      else if (current_kid == pc_eFive)   tresult = "SPOILER %s";
      else if (current_kid == pc_eSix) tresult = "SPOILER %s";
    }


I've tried importing the enum to guiscript, but that didn't work.
What am I doing wrong?
#38
King's Quest 2?
#39
Just replying so I can get updates :)
#40
The Rumpus Room / Re: Name the Game
Fri 10/03/2017 21:59:28
Looks like one of the Still Life games.
SMF spam blocked by CleanTalk