Author Topic: TEMPLATE: Tumbleweed Verbs 1.1 Last update: 3rd August 2018  (Read 6815 times)

abstauber

  • Cavefish
  • Mittens Knight
  • still mowing the lawn
    • abstauber worked on a game that was nominated for an AGS Award!
      abstauber worked on a game that won an AGS Award!
Hi,
as long as you know your ways around AGS, it should not be too hard. The whole GUI stuff is already pretty much modulized.
You need to export the optiongui module from the template, as well as the GUIs: gSave, gSaveConfirm, gLoad (and optionally gOptions).

In gOptions you might want to remove the Layout slider and the code behind it, since this is the only(?) template specific thing in this module.

Hi,
as long as you know your ways around AGS, it should not be too hard. The whole GUI stuff is already pretty much modulized.
You need to export the optiongui module from the template, as well as the GUIs: gSave, gSaveConfirm, gLoad (and optionally gOptions).

In gOptions you might want to remove the Layout slider and the code behind it, since this is the only(?) template specific thing in this module.

Thank you very much!:-D
I'm at my first game and I'm currently Learning Scripting but I'm confident to be able to do it (nod)

Hi Abstauber!

I tried to import the module but my AGS version is slightly older than the one you used for the module... so the importing failed
do you know if is it possible to use it in another way?

Sure, that is actually not a big deal. First you need to resize the gAction GUI to your game's screen resolution (eg 320x200)
Now you need to copy over this adjusted  AdjustActionBarPosition function to your template and make sure it is called in repeatedly_execute_always

Code: Adventure Game Studio
  1. void AdjustActionBarPosition()
  2. {
  3.   int actionLabelWidth = GetTextWidth(ActionLine.Text, eFontTextOut) + 4;
  4.   int actionLabelHalf = actionLabelWidth / 2;
  5.   int xpos = mouse.x - actionLabelHalf ;
  6.   int ypos = mouse.y - Game.SpriteHeight[mouse.GetModeGraphic(mouse.Mode)] - 4;
  7.  
  8.   if (xpos + actionLabelWidth >= System.ScreenWidth) xpos = System.ScreenWidth - actionLabelWidth;
  9.   else if (xpos < 0) xpos = 0;
  10.  
  11.   if (ypos < 0 ) ypos = 0;
  12.  
  13.   ActionLine.X = xpos;
  14.   ActionLine.Y = ypos;
  15.   ActionLine.Width = actionLabelWidth;
  16. }
  17.  


This is perfect! Thank you. But is it possible to hide the actionline when starting an action, in an easy way?
"Talk to character" for example is still on the screen (highlighted) when the dialog goes on. And sometimes those texts even overlap each other.

Thank you!

Monsieur OUXX

  • Cavefish
  • Mittens Vassal
  • Mittens Half Initiate
    • I can help with proof reading
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
helping me with the existing translation.

Watch out you made a copy&paste mistake in the French screenshot : It's not "ourvrir", it's supposed to be "ouvrir".

Question : apart from the new copy&save, are there any other improvements? We've just finished integrating the 9verb into the "custom save with screenshots" and bam, just at the same time you release it packaged. So I'm thinking if it's worth integrating again.
« Last Edit: 19 Apr 2018, 10:05 by Monsieur OUXX »
 

abstauber

  • Cavefish
  • Mittens Knight
  • still mowing the lawn
    • abstauber worked on a game that was nominated for an AGS Award!
      abstauber worked on a game that won an AGS Award!
@zurik I'll have a look tomorrow

@Monsieur Ouxx
Hehe, thanks for the hint. I'll update the graphics in the future. How comes that you stumble upon this template almost exactly a year after it's release? (laugh)
Quote
We've just finished integrating the 9verb into the "custom save with screenshots" and bam, just at the same time you release it packaged.
Did I release something recently?

The main additions are double click running and the new save gui. And of course the whole code reorganizing and refactoring stuff, but technically these aren't features ;)
« Last Edit: 19 Apr 2018, 20:58 by abstauber »

abstauber

  • Cavefish
  • Mittens Knight
  • still mowing the lawn
    • abstauber worked on a game that was nominated for an AGS Award!
      abstauber worked on a game that won an AGS Award!
@zurik
I think the trick was to set the action label to an empty string after an action was executed or the GUI gets disabled. The GUI gets disabled once a dialog starts, so we use this effect.

This is from the tumbleweed script, so there's a bit work left to adapt it to the 9verb GUI variable and function names.

Code: Adventure Game Studio
  1. function repeatedly_execute_always() {
  2.  
  3.  
  4.   if (!IsGamePaused() && !Verbs.IsGuiDisabled()) {
  5.  
  6.     // Update Actionbar
  7.     if (classicGui == false) {
  8.       Verbs.CheckDefaultAction();
  9.  
  10.       // Update Actionbar after command is executed
  11.       if (location_clicked != null && location_clicked.Length > 0) {
  12.         if (location_clicked.IndexOf(">") > 0) temp_location = location_clicked.Truncate(location_clicked.IndexOf(">"));
  13.         else temp_location = location_clicked;
  14.       }
  15.       else temp_location = "";
  16.  
  17.       if (IsInterfaceEnabled() || temp_location != location || location == "") {
  18.         Verbs.UpdateActionBar();
  19.         location_clicked = "";
  20.       }
  21.       Verbs.AdjustActionBarPosition();
  22.     }
  23.     // Doubleclick Timer
  24.     if (dc_timer_run == true)
  25.     {
  26.       if (disableDoubleclick) {
  27.         dc_timer_run = false;
  28.       }
  29.       else {
  30.         dc_timer_click++;
  31.         if (dc_timer_click >= dc_speed){
  32.           dc_timer_click = 0;
  33.           dc_timer_run = false;
  34.         }
  35.       }
  36.     }
  37.   }
  38. }
  39.  
  40.  

Monsieur OUXX

  • Cavefish
  • Mittens Vassal
  • Mittens Half Initiate
    • I can help with proof reading
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
The main additions are double click running and the new save gui. And of course the whole code reorganizing and refactoring stuff, but technically these aren't features ;)

So basically it does exactly what our template does. Even the running. I'm gutted. Proof I should visit the forums more often ;)
 

Hi Abstauber!

First of all, love the new Verbs, great design.

I'm having some trouble with the doors. I set up the doors as I learned and the Anyclick works. Problem is this: in my new game I will have more than one playable characters, the user can switch anytime he wants. So, what I want to get working is this: If a Character on one side of a door opens the doors(but steps not trough it), then it should also be open in the next room, even if an other characzer approaches it from the other side, right?
I put the Getdoorstate in room_load on both sides, trying to always update the door state. Ot works for going trough the door, but it doesn't change the corrsponding object. Hence:
You will step trough an open bit displayed closed, door.
Well this is how I set doors up:

Code: Adventure Game Studio
  1. Room_First_Load {  
  2. //Set up a doors with ID 20 and set it to unlocked but closed
  3.  
  4. Doors.Initobject (20, oDoor.ID);
  5.  Doors.Setdoorstate (20, 0);
  6. }
  7.  
  8. Room_Load{
  9.  //check if door is closed or open
  10. Doors.Getdoorstate (20);
  11. }
  12.  
  13.  
Code: Adventure Game Studio
  1. Room_First_Load {  
  2. //Set up a doors with ID 20 and set it to open
  3.  
  4. Doors.Initobject (20, oDoor.ID);
  5.  Doors.Setdoorstate (20, 1);
  6. }
  7.  
  8.  
  9. Room_Load{
  10.  //check if door is closed or open
  11. Doors.Getdoorstate (20);
  12. }
  13.  

abstauber

  • Cavefish
  • Mittens Knight
  • still mowing the lawn
    • abstauber worked on a game that was nominated for an AGS Award!
      abstauber worked on a game that won an AGS Award!
Hi and thanks for the kind words.

Without testing it I'd say you need to init the door object every time the room loads.
GetDoorState just return the state of the door, but doesn't apply it. InitObject does both: it get the state and modifies the object if needed.

Code: Adventure Game Studio
  1. Room_First_Load {  
  2. //Set up a doors with ID 20 and set it to open
  3.  Doors.Setdoorstate (20, 1);
  4. }
  5.  
  6.  
  7. Room_Load{
  8.  //check if door is closed or open
  9. Doors.InitObject (20, oDoor.ID);
  10. }
  11.  

EDIT: Doors work now! I'am so happy!

Thanks! I'll try this evening and let you know :)
Oh, I also had another bug regarding the safe-system. I have to recreate it in the evening because I'm at work now, but I would describe it like this:
If I open the Menu via the GUI Button I can safe and load without problem. But If I open the Menu via F5 and safe I get an error. As I said I have to recreate it, but I recall it pointed to the part of the script where you added a comment saying "workaround for taking a screenshot without the menu-gui".

I tried with both compiled game and the testeun with AGS open.


EDIT: The Error Reads "Error running function 'repeatedly_excecute'": Error: Null String referenced

and it refers to the line 402 of the optiongui.asc

Code: Adventure Game Studio
  1. if (save_scheduled) {
  2.     SaveGameSlot(saveSlotId, saveSlotString);
  3.     saveSlotId = 0;
  4.     saveSlotString = "";      
  5.     save_scheduled = false;
  6.   }
  7.  
« Last Edit: 24 Apr 2018, 15:04 by Loslem »

abstauber

  • Cavefish
  • Mittens Knight
  • still mowing the lawn
    • abstauber worked on a game that was nominated for an AGS Award!
      abstauber worked on a game that won an AGS Award!
A good thing, that I called this a release candidate ;)

Here's your bugfix.

In globalscript.asc at line 25 edit your code like this:
Code: Adventure Game Studio
  1.   if (keycode == eKeyF5) {
  2.     //gOptions.Visible=true; // F5 - OPTIONS
  3.     Verbs.UpdateActionBar();
  4.     OptionGui.ShowOptions();
  5.   }
  6.  
That fixed the issue for me.

Hi it's me again, back to bother you! :D

Say: It's super convienient to set Door Hotspots with the extension >o, so that right click right opens them. Problem: if you click right again you always get the door string for the open door.
Is there a way to implement that the door is closed again with a right click?

EDIT: Sorry I found it on site 14 of your Verbs Manual. Good write!
« Last Edit: 12 Jun 2018, 22:16 by Loslem »

abstauber

  • Cavefish
  • Mittens Knight
  • still mowing the lawn
    • abstauber worked on a game that was nominated for an AGS Award!
      abstauber worked on a game that won an AGS Award!
Great that you've sorted it out.

And since we're at it, I've added the fixes to Github and updated the template.
So after over a year in RC state, I now proudly call it 1.0 :-D

imsomnia212

  • Imsomnia
First of all I really love the template.
Well, I have a question: Is possible to show the save screenshot with anti-alising when your game is nearest-neighbor? I wan't to show it like the way Thimbleweed do, but in the template with a nearest-neighbor game, it pixelate and lose information in the screenshot.
Are u a tuna?

Crimson Wizard

  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Well, I have a question: Is possible to show the save screenshot with anti-alising when your game is nearest-neighbor? I wan't to show it like the way Thimbleweed do, but in the template with a nearest-neighbor game, it pixelate and lose information in the screenshot.

This would require applying different graphic filter at runtime, which AGS currently cannot do, I am afraid. (Well, technically it could, but there is no script command or option to make it do so).

Monsieur OUXX

  • Cavefish
  • Mittens Vassal
  • Mittens Half Initiate
    • I can help with proof reading
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
imsomnia212 : What you can do is apply the anti-aliasing AFTER taking the screenshot.
I'm not detailing, but :
1) locate the place in the module where the screenshot is taken
2) Open the file from disk or start fiddling with the dynamic sprite directly (I haven't checked which of those two scenarios applies here)
2) Resize the sprite using the DynamicSprite and DrawingSurface scaling abilities -- apply the antialiasing at that time.
3) Save the sprite as a file where it should normally have been saved in the first place
 

Snarky

  • Global Moderator
  • Mittens Earl
  • Private Insultant
    • I can help with proof reading
    •  
    • I can help with translating
    •  
2) Resize the sprite using the DynamicSprite and DrawingSurface scaling abilities -- apply the antialiasing at that time.

I don't understand how this step is supposed to work. Neither DrawingSurface.DrawImage()/DrawSurface() nor DynamicSprite.Resize() allow you to specify antialiasing – I'm not sure whether it's always off or whether it depends on the "Smooth scaled sprites" setting in winsetup, but it's not something you can control through AGS script (the best you can do is game.disable_antialiasing, but there's no game.force_antialiasing).

It might be possible to write a function to do bilinear sprite scaling by reading and drawing individual pixels, but that would be SLOOOW.

Crimson Wizard

  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
2) Resize the sprite using the DynamicSprite and DrawingSurface scaling abilities -- apply the antialiasing at that time.

I don't understand how this step is supposed to work. Neither DrawingSurface.DrawImage()/DrawSurface() nor DynamicSprite.Resize() allow you to specify antialiasing – I'm not sure whether it's always off or whether it depends on the "Smooth scaled sprites" setting in winsetup, but it's not something you can control through AGS script (the best you can do is game.disable_antialiasing, but there's no game.force_antialiasing).

I was too confused by this advice. At first I thought there is a mode for SetGameOption I forgot about, but then I checked engine code, and this is not the case with anti-aliased sprites. But that option is not even applied to DrawingSurface operations, only when drawing characters and objects in the room.
(Which may be an oversight really. Also, that should be technically possible to add an option to switch sprite anti-aliasing at runtime, if really necessary)
« Last Edit: 23 Jul 2018, 12:37 by Crimson Wizard »

Snarky

  • Global Moderator
  • Mittens Earl
  • Private Insultant
    • I can help with proof reading
    •  
    • I can help with translating
    •  
But that option is not even applied to DrawingSurface operations, only when drawing characters and objects in the room.
(Which may be an oversight really. Also, that should be technically possible to add an option to switch sprite anti-aliasing at runtime, if really necessary)

It feels like a design decision made back in 2000 or thereabouts that doesn't make much sense any more.

How I would want it to work, ideally:

-Antialiasing (or more properly interpolation) for scaling characters is a game setting that can be controlled in script
-There's a game-wide default value, but it can also be overridden for individual characters
-Possible values for this setting would be Nearest Neighbor, Bilinear, Bicubic and User-Configured (which would then be controlled by winsetup; the default for backwards compatibility), with option to extend later
-For relevant DrawingSurface/DynamicSprite operation (scaling and rotation), there would be an optional interpolation argument with the same possible values, defaulting to Nearest Neighbor
-While we're at it, also add a subpixel Translate operation to shift a sprite by a fraction of a pixel (using any of the interpolation settings – though Nearest Neighbor wouldn't really do much).