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 - rongel

#1
Quote from: Crimson Wizard on Tue 03/09/2024 12:00:26But in your case even that is not necessary. As you may see, the start and end indexes have a linear dependency on Tasklist_page value. So the code becomes:

Code: ags
int start_at = Tasklist_page * 5;
int end_at = start_at + 5;

for (int i = start_at; i < TaskReceivedCount && i < end_at; i++)    
{
    int taskID = TaskReceived[i];
    lstTaskList.AddItem(GameTasks[taskID].Name);
}

Beautiful! I'll start working on the proper version now, hopefully won't run into nasty problems anymore.

I'll add you in the game credits for sure!
#2
I've done some testing with this, it seems to work perfectly now. Thank you very much CW!

I'm now working on setting up the Task List page limit, so that each page can hold only limited amount of tasks.
I did some awful coding, but it *seems* to work. Currently I'm testing with 5 tasks per page limit:

Code: ags
function UpdateTasksGUI()
{
  lstTaskList.Clear();
  
  int i = 0; 
  
  // Tasklist page 1
  if(Tasklist_page == 1) {
    while (i < TaskReceivedCount && i < 5) 
    
    {
      int taskID = TaskReceived[i];
      lstTaskList.AddItem(GameTasks[taskID].Name);
      i ++;
    }
  }
  // Tasklist page 2
  else if(Tasklist_page == 2) {
    i = 5;
    while (i  < TaskReceivedCount && i < 10) 
    
    {
      int taskID = TaskReceived[i];
      lstTaskList.AddItem(GameTasks[taskID].Name);
      i ++;
    }
  }
  
  UpdateButtons();
}

I added a similar check to the UpdateButtons function and the button behavior *seems* to work as well. I think I can make the code a bit nicer, but can you already see if there's a problem brewing? Or is this approach ok?
#3
Quote from: Crimson Wizard on Sun 01/09/2024 14:58:44EDIT: probably the condition is wrong, should be:
Code: ags
  for (int j = i + 1; (j < TaskReceivedCount) && (TaskReceived[j] > parentIndex && TaskReceived[j] < parentIndex + maxSubs); j++)

I tested the new code, but got similar results. The added subtask goes on in the middle of the subtask list, not bottom. It could be that I've made some mistake, so just to clarify, here's what I've done:

At game_start:

Code: ags
  GameTasks[0].Name = "Go shopping";
  GameTasks[0].NumSubTasks = 3; // next 3 tasks are subtasks of this one
  GameTasks[1].Name = " - Buy food";
  GameTasks[2].Name = " - Buy a dress";
  GameTasks[3].Name = " - Buy a new carpet";
  
  AddTask(0, false); // shopping
  AddTask(2, false); // dress
  AddTask(3, false); // carpet
  
  UpdateTasksGUI_v2();

Then I add the third subtask later in the game:

Code: ags
  AddSubTask(0, 1);  // food
  UpdateTasksGUI_v2();

Which does this:

Code: ags
// ADD SUBTASK
function AddSubTask(int parentIndex, int subIndex)
{
  int insertAt = -1;
  for (int i = 0; i < TaskReceivedCount; i++)
  {
    if (TaskReceived[i] == parentIndex)
    {
        insertAt = i + 1;
        // Find if other subtasks are already added and skip these
        int maxSubs = GameTasks[parentIndex].NumSubTasks;
        for (int j = i + 1; (j < TaskReceivedCount) && (TaskReceived[j] > parentIndex && TaskReceived[j] < parentIndex + maxSubs); j++)
        {
          insertAt++;
        }
    }
  }

  // Copy everything to the right to free the index, in the reverse order
  for (int i = TaskReceivedCount; i > insertAt; i--)
  {
      TaskReceived[i] = TaskReceived[i - 1];
  }

  // And insert a subtask on its place
  TaskReceived[insertAt] = subIndex;
  TaskReceivedCount++;
}

The end result is still that the added subtask goes between subtask 2 (dress) and subtask 3 (carpet) instead of going to the bottom of the list. If I add subtask 1 (food) and subtask 2 (dress) at game_start, and the add subtask 3 (carpet) later, only then it will go to the bottom. This is a quite minor issue, but it would be great to get it working 100%!
#4
Ok, things seem to work much better now! A couple of questions:

1. How exactly should I use the subTask feature at game start? Let's say I have three subtasks, two of them active at game start and one will get activated later on. For example:

Code: ags
GameTasks[0].Name = "Go shopping";
GameTasks[0].NumSubTasks = 3; // next 3 tasks are subtasks of this one
GameTasks[1].Name = "Buy food";
GameTasks[2].Name = "Buy a dress";
GameTasks[3].Name = "Buy a new carpet";

AddTask(0, true);

Now all the subtasks will be visible already from the beginning, which is bad. The carpet option should be added later. Is this the correct way to do it:

Code: ags
GameTasks[0].NumSubTasks = 2;

Now the third option doesn't get shown yet. And then later on I'll do this:

Code: ags
AddSubTask(0, 3);

2. I'd prefer that the later on added subtask would go to the bottom of the substack list. Right now it seems to go in the middle, or one row below the first item? Is there a way to do it by editing the insertAt int?

Code: ags
if (TaskReceived[i] == parentIndex)
  {
  insertAt = i + 1;
  // Find if other subtasks are already added and skip these
  int maxSubs = GameTasks[parentIndex].NumSubTasks;
  for (int j = i + 1; (j < TaskReceivedCount) && (TaskReceived[j] < parentIndex + maxSubs); j++)
  {
  insertAt++;
  }
}
#5
Thanks again for the great help! That kind of system seems perfect for my purposes. I did some testing with it and got partial success.
First of all, I got an error saying "Error parsing path; unexpected token after array index" from these lines in the AddTask function:

Code: ags
TaskReceived[TaskReceivedCount++] = taskIndex;

TaskReceived[TaskReceivedCount++] = taskIndex + i;

I managed to get rid of the error by formatting it into TaskReceived[TaskReceivedCount +1], but I couldn't get any of the tasks appear with it. I simplified the code for testing purposes and got the "basic" addTask function to work by doing this:

Code: ags
function AddTask(int taskIndex)
{
  TaskReceived[TaskReceivedCount] = taskIndex;
  TaskReceivedCount ++;
}

Now I can add tasks and they appear at the end of the task list. I tried to do the same (and many other things) with the addSubtasks bool, but couldn't get it to work properly, it was giving me duplicates etc.

The function AddSubTask(int parentIndex, int subIndex) seems to work nicely, with that I can insert subtasks under the main task in correct position.

So there's some kind of formatting problem with the AddTask function. Any ideas how to properly fix it, and get the addSubtasks part working as well?
#6
One issue I noticed now: In the game, the player can get these tasks quite freely in a non-linear order. The problem is that now the task placement is fixed to the order of the array at game_start. So when a player gets a new task, it could jump at the beginning of the list, or in the middle of it, rather than appearing at the bottom (like when using ListBox.AddItem).

The optimal situation would be that the new tasks appear at the bottom of the list, unless they are subtasks. Subtasks would appear in the correct category, and rearrange the list.
#7
Did some quick testing and it seems to work nicely! Buttons appear in the right places etc. I had to do some adjustments to make it work. This for example was giving me error in the UpdateButtons function:

Code: ags
int top_index = ListBox.TopItem; // an index of active tasks visible on GUI
int row_count = ListBox.RowCount; // how many active tasks are visible on GUI

I changed it into this, and got rid of the error:

Code: ags
int top_index = lstTaskList.TopItem; // an index of active tasks visible on GUI
int row_count = lstTaskList.RowCount; // how many active tasks are visible on GUI

Also not 100% sure what the "NumSubTasks" does actually? What would be the difference if I wouldn't use it?

I'll continue with this next week, and probably have more questions. But huge thanks already!
#8
Wonderful! Thanks so much for this CW! I was kind of transitioning to some system like this, but didn't know how (in my previous game the simple and crude task list worked well enough). I'll start testing this approach now.

QuoteBecause ListBox may have a lot of items in it but display only certain range at once, you'd also need to know that range and adjust buttons whenever ListBox is scrolled by the player. I don't know if you deal with this now, and if yes then how. In the simple case you just need to know the range: first index to display, and displayed count.
I was thinking to simulate a paper task list, and if the page is full, it will continue on the next page. I'm sure it would cause all sorts of problems, but a scrolling list doesn't really fit into the game's atmosphere.
#9
Hello! I'm making a Task list with a listbox. When a task is completed, a button with an image of a line appears on top of it, marking it as completed. For each of the tasks, I have an invisible button image ready. This works fine:

Code: ags
function RemoveTaskListItem(String nameofentry) {
  int index;
  while (index < lstTaskList.ItemCount) {
    
    // Button with a line appears 
    if(lstTaskList.Items[index].CompareTo(nameofentry) ==0) {
      if(index ==0) btnTaskList_0.Visible = true;
      if(index ==1) btnTaskList_1.Visible = true;
      if(index ==2) btnTaskList_2.Visible = true;
    }
    else index ++;
  }
}

However, I'm trying to make it a bit more fancy and add categories to it: There is the topic and maybe three tasks under it. Now it can happen that a new task is added inside a topic, using InsertItemAt command. That will move all the listbox items under it nicely, but it will break the button placement, if there already is a completed task below.

My question is how to link my button images to the Listbox items? When the order of the list changes, the buttons placement needs to be updated, but I can't really figure out a good way to do this.

Any ideas? Thanks!
#10
Quote from: eri0o on Thu 18/04/2024 01:36:19@rongel maybe this is helpful, let me know. The custom dialog though I think it's better if you read on and make your own version of it.
Thanks, I really appreciate your work on this, hopefully your module will help others as well. I'm currently working on something else, but I'll delve into your module more closely next week.
#11
Quote from: eri0o on Wed 17/04/2024 16:15:08Hey, I kinda don't remember, when showing dialog options in AGS, does it already has something to make the "title text"? Like in that screen you show options at the bottom and a text at the top, how do you set that text?

That is made with a GUI with a label on top. The custom dialog gui is placed at the bottom. When player selects a dialog option from the bottom, it updates the text label at the top. So there is no actual speech or dialog, just a label.Text command inside the dialog editor.
#12
Quote from: eri0o on Tue 16/04/2024 13:21:57I would suggest first if you can find some screenshot that is exactly what you want or if you can draw in a paint program, to do a mockup of exactly what you want, then it should be easier.
The thing is that I'm still figuring it out myself, and still testing different mechanics. BUT I do have a working prototype, made with ugly tricks and deceit.

Basically it's a short text-based multiple choice event, made with a custom dialog system. Clicking on the dialog option updates the description label and gives new dialog options. In the end, some results may end up positive or negative. Different coloring will highlight the special dialog options and positive / negative results. A rough example:

       


       

So currently I have two requests:

  • Edit the color of a specific word in dialog options (image 1)
  • Edit the color of a specific word in a text label (image 4)

I think I could do this with cheating (placing color labels under dialog options, like in image 1), or by having multiple labels (like in image 4), but it would be nicer if there was an easier way.

I hope this makes sense!
#13
Quote from: eri0o on Tue 16/04/2024 09:58:59I don't understand, dialog options are fully cistomizeable...

https://adventuregamestudio.github.io/ags-manual/CustomDialogOptions.html

You can draw them how you want and also control them how you want. :/

So it's possible to change the color of specific dialog option using custom dialog option rendering? Or to change the color of a single word? I have never touched custom dialog options rendering, I fear it's above my skills.

I'm using the CustomDialogGui module which is easy to use, but doesn't have that function. In my example, I was thinking of inserting code to the dialog option, or something similar.
#14
Sorry for the abcensce, great to see discussion about this! I'll try @eri0o your module soon, looks very nice!

Quote from: Crimson Wizard on Fri 12/04/2024 07:02:34The starting request has 2 conditions, at least from my understanding:
1. Being able to color particular words or sequence of words.
2. The text is static, so "raw" drawn once and then kept displayed without changes.

Is this correct, or was there anything else to it?

Yes, I wanted to simply highlight a specific word with a different color in a text sentence. And so that it works otherwise normally and can be translated to different language without trouble.

In addition, if that functionality could be added to dialog options (in the dialog editor), it would be even better. The dialog system is very nice and simple to use, but the lack of dialog option customization limits its creative use.

I did an ugly test to get the result I was looking for: this is made with CustomDialogGui module, and with three dialog options available. I left the top dialog option empty (actually it has one empty space) and placed a green text label in the same location. When clicking on the green label, the empty dialog option gets selected and the whole text "puzzle" works from the dialog editor. The green label is there just for the graphics.



If something like this would be possible, I think it could open up new creative ways to use the dialog system.
#15
Quote from: Crimson Wizard on Wed 10/04/2024 15:33:51A more universal way to do this would be to implement an extended type of Label that supports some kind of a display formatting in a string, using tags.

Quote from: eri0o on Wed 10/04/2024 23:15:02I think tags are a nice way, it could be like there is a DrawStringWrapped it could have a DrawFancyStringWrapped or whatever the name for it that adds such feature - in addition to LabelFancy or whatever, like Winforms has TextBox and RichTextBox.

It would be great to have that kind of functionality added to labels. It could be used to emphasize a certain word in a dialog (by changing the font / color), or by making fancy RPG Guis for example.

If that functionality could be added to dialog options as well, everything would be perfect  :=
#16
Quote from: Snarky on Wed 10/04/2024 11:50:39To do this you will need to draw the string yourself in multiple steps, each with a different color, using DrawingSurface.DrawString().

Thanks Snarky for the advice! I'll look into DrawingSurface, but I have a feeling that path will complicate my current setup too much. Currently I have a custom dialog Gui and a text label for the descriptions. They work together nicely, and it's easy to create and edit similar scenarios as in the screenshot. So I might just try to use separate labels and see if something similar is possible.

Quote from: Matti on Wed 10/04/2024 09:52:01I was just wondering the same thing. I also experimented with text labels and wasn't able to have different colors within a single label/line. Would be a great functionality.

I agree 100%!
#17
Hello!

I looking into using several colors in a line of text, highlighting key words and effects. Is this possible at all?
I'm experimenting with text labels and the dialog system. The point is to do something a bit similar than in Slay the Spire and many other RPG's:



I'm using abstauber's CustomDialogGui 1.9, which is great, but it doesn't offer that kind of functionality with colors afaik.

When searching the topic, I found SSH's Hypertext module, which is supposed to do this, but the module is very outdated, and doesn't seem to work that well anymore.

Thanks for any help! 
#18
Wow, amazing to see Dreams in the Witch House in so many categories! Huge thanks to everyone who voted for it, and congrats to everyone who got nominated!  :=
#19
For Your Consideration
DREAMS IN THE WITCH HOUSE


Dreams in the Witch House is a genre-bending mix of point and click adventure and a survival RPG. Guide Walter Gilman, as he prepares to face the dreaded May-Eve witch ritual in the legend-haunted city of Arkham. Choose your own approach and reveal the secret of the Witch House before it's too late.
Based on the short story by H.P. Lovecraft.







Please consider for:

  • Best Game of the Year
  • Best Audio
  • Best Visuals
  • Best Writing
  • Best Programming
  • Best Character
  • Best Gameplay
#20


The French and Spanish translations for DITWH are available on Steam!

The new 1.08 version is released first as an optional beta, as it will unfortunately break the save game compatibility.

HOW TO ENABLE THE 1.08 VERSION:
1. In the Steam library, right-click Dreams in the Witch House.
2. Select "Properties..."
3. Select "Betas"
4. Select "beta - Version 1.08" from the Beta Participation drop-down menu

That's it! The new version should start to download immediately.

Version 1.08 Changelog:
- Added translations to French and Spanish
- Walter can buy alchemy ingredients from the Pharmacy, if the alchemy skill is unlocked
- Special collection access can be gained from Armitage, if Walter has shown him enough occult evidence
- Removed empty city events
- Better randomization of the city events
- Fixed a bug concerning "Anthropogenesis" and "Cosmogenesis" books
- Edited Walter's comments about covering the rat hole to make them more logical
- Minor fixes to library index cards
- Minor typo & grammar fixes

A huge thanks to Ténébreux & Ghylard for the French version, and Alejandra for the Spanish version!
SMF spam blocked by CleanTalk