TEMPLATE: Tumbleweed Verbs 1.4

Started by abstauber, Sat 29/04/2017 15:41:50

Previous topic - Next topic

abstauber

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.

Jigen Daisuke

Quote from: abstauber on Fri 15/12/2017 12:37:39
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)

Jigen Daisuke

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?

zurik

Quote from: abstauber on Thu 01/06/2017 12:38:52
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: ags

void AdjustActionBarPosition() 
{
  int actionLabelWidth = GetTextWidth(ActionLine.Text, eFontTextOut) + 4;
  int actionLabelHalf = actionLabelWidth / 2;
  int xpos = mouse.x - actionLabelHalf ;
  int ypos = mouse.y - Game.SpriteHeight[mouse.GetModeGraphic(mouse.Mode)] - 4;
  
  if (xpos + actionLabelWidth >= System.ScreenWidth) xpos = System.ScreenWidth - actionLabelWidth;
  else if (xpos < 0) xpos = 0;
  
  if (ypos < 0 ) ypos = 0;
  
  ActionLine.X = xpos;
  ActionLine.Y = ypos;
  ActionLine.Width = actionLabelWidth;
}



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

#24
Quote from: abstauber on Thu 04/05/2017 10:25:01
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.
 

abstauber

@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 ;)

abstauber

@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: ags

function repeatedly_execute_always() {
  
  
  if (!IsGamePaused() && !Verbs.IsGuiDisabled()) {
  
    // Update Actionbar
    if (classicGui == false) {
      Verbs.CheckDefaultAction();

      // Update Actionbar after command is executed
      if (location_clicked != null && location_clicked.Length > 0) {
        if (location_clicked.IndexOf(">") > 0) temp_location = location_clicked.Truncate(location_clicked.IndexOf(">"));
        else temp_location = location_clicked;
      }
      else temp_location = "";

      if (IsInterfaceEnabled() || temp_location != location || location == "") {
        Verbs.UpdateActionBar();
        location_clicked = "";
      }
      Verbs.AdjustActionBarPosition();
    }
    // Doubleclick Timer
    if (dc_timer_run == true)
    {
      if (disableDoubleclick) {
        dc_timer_run = false;
      }
      else {
        dc_timer_click++;
        if (dc_timer_click >= dc_speed){
          dc_timer_click = 0;
          dc_timer_run = false;
        }
      }
    }
  }
}


Monsieur OUXX

Quote from: abstauber on Thu 19/04/2018 20:53:31
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 ;)
 

Loslem

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: ags

Room_First_Load {  
//Set up a doors with ID 20 and set it to unlocked but closed

Doors.Initobject (20, oDoor.ID);
 Doors.Setdoorstate (20, 0);
}

Room_Load{
 //check if door is closed or open
Doors.Getdoorstate (20);
}


Code: ags

Room_First_Load {  
//Set up a doors with ID 20 and set it to open

Doors.Initobject (20, oDoor.ID);
 Doors.Setdoorstate (20, 1);
}


Room_Load{
 //check if door is closed or open
Doors.Getdoorstate (20);
}

abstauber

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: ags

Room_First_Load {  
//Set up a doors with ID 20 and set it to open
 Doors.Setdoorstate (20, 1);
}
 
 
Room_Load{
 //check if door is closed or open
Doors.InitObject (20, oDoor.ID);
}

Loslem

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: ags

if (save_scheduled) {
    SaveGameSlot(saveSlotId, saveSlotString);
    saveSlotId = 0;
    saveSlotString = "";       
    save_scheduled = false;
  }

abstauber

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: ags

  if (keycode == eKeyF5) {
    //gOptions.Visible=true; // F5 - OPTIONS
    Verbs.UpdateActionBar();
    OptionGui.ShowOptions();
  }

That fixed the issue for me.

Loslem

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!

abstauber

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

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

Quote from: imsomnia212 on Sat 21/07/2018 21:33:05
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

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

Quote from: Monsieur OUXX on Mon 23/07/2018 11:24:30
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

#38
Quote from: Snarky on Mon 23/07/2018 11:55:26
Quote from: Monsieur OUXX on Mon 23/07/2018 11:24:30
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)

Snarky

Quote from: Crimson Wizard on Mon 23/07/2018 12:33:41But 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).

SMF spam blocked by CleanTalk