Custom dialog with dynamic scrolling

Started by bbalint85, Fri 26/11/2010 12:39:36

Previous topic - Next topic

bbalint85

Hi!
I'm scripting a custom dialog, the options are icons, and the goal is a dynamic scroll system. I mean, If you're on the left the first three options are visible, but as you move with the mouse to the right it scrolls the icons, and by the time you're at the rightmost the last three icons are there.

I'm done with the scrolling, it's smooth and looks nice, but I have some trouble, so I'm asking for suggestions.

-I used a tricky method to refresh the dialog ( mentioned in http://www.adventuregamestudio.co.uk/yabb/index.php?topic=39596.0 ), so I change the activeoptionID property between 0 and 1, and using another variable for storing the actual option selected. This way on every mouse movement the dialog gets refreshed.
The problem is, that AGS uses ActiveOptionID after a mouseclick, but I want to use there my own variable, which has the real value of the selected option.

There's no appropriate click handling either ( http://www.adventuregamestudio.co.uk/yabb/index.php?topic=36058.0 ) so I'm a little lost here. Any suggestions for an alternative method for refreshing the dialog surface or mouse click handling or something completely different?




Timeless Journey

abstauber

Quotealternative method for refreshing the dialog surface

Nope - that's the way it's currently being done.

Quotemouse click handling or something completely different

For a workaround you might want to explain what exactly you're trying to achieve. As far as mouse clicking is concerned, your options are very limited. If you don't want to trigger a dialog topic, you could run something in repeatedly_execute_always, which monitors your custom variable.

Ryan Timothy B

Curious, why do the icons have a distorted aspect ratio when the mouse is hovering over them?

I'd suggest creating a larger sprite for the enlarged size, and just downsize them in a paint program for the smaller size sprite. AGS only resizes by nearest neighbor, so that's one reason why your sprites look chunky when enlarged.

bbalint85

Quote from: Ryan Timothy on Fri 26/11/2010 15:16:21
Curious, why do the icons have a distorted aspect ratio when the mouse is hovering over them?
It's just for testing purposes, drawing the selected icon slightly larger, It's not important.

Quote from: abstauber on Fri 26/11/2010 14:43:29
Quotemouse click handling or something completely different
For a workaround you might want to explain what exactly you're trying to achieve. As far as mouse clicking is concerned, your options are very limited. If you don't want to trigger a dialog topic, you could run something in repeatedly_execute_always, which monitors your custom variable.
Okay, I'll try to explain it again. So the refreshing is done through ActiveOptionID, which is a system variable. As you also said, changing this is the only method for refreshing, so I can't store the selected dialog option in this system variable.
I'm storing the selected option (the one the mouse is over) in my own variable (actoption).
The task is: when the player ckicks on one of the options (stored in actoption, NOT in ActiveOptionID), the corresponding dialog option should activate, not the one in ActiveOptionID (which is now 0 or 1 thanks to the refreshing method).

Any thoughts? What do you mean by rep_exec_always? Is there a way to disable mouseclick and manually bring up a dialog option?

Timeless Journey

monkey0506

#4
Well if you're using the custom dialog functions then technically you can do whatever you want with it..you're not bound to use DialogOptionsRenderingInfo.ActiveOptionID in any specific manner within the actual rendering functions..just refer to "actoption" instead.

I forgot that dialog_options_mouse_click is (counterintuitively) only called when the mouse isn't over a dialog option. Sorry.

Why not just do:

Code: ags
// refresh options:
int actoption = info.ActiveOptionID;
info.ActiveOptionID = 0;
info.ActiveOptionID = actoption;


You could even put it into a function:

Code: ags
void Refresh(this DialogOptionsRenderingInfo*)
{
  int actoption = this.ActiveOptionID;
  this.ActiveOptionID = 0;
  this.ActiveOptionID = actoption;
}


Then you could just call:

Code: ags
info.Refresh();

bbalint85

Well, I tried this already, but it doesn't work like this. I think some function compares the result of ActiveOptionID with the previous value, and if it changes it refreshes the surface. It doesn't get triggered only by changing it inside a function.

I also tried putting some code in the dialogs, so maybe checking the custom variable there, and activating the corresponding option, but it doesn't really work..


Code: ags
// Dialog script file
@S  // Dialog startup entry point
	if  (gActOption == 3)
ego: Hi! What's up?
sam: I'm fine!
	else
ego: blabla
samu: bla


My other idea is to duplicate every dialogoption and then switching between the real and te dummy option for refreshing. This method should work, but it means a lot of manual work in the dialogs, and it's very hard to change after it's done...

Timeless Journey

SMF spam blocked by CleanTalk