TEMPLATE: Tumbleweed Verbs 1.4

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

Previous topic - Next topic

abstauber

Hi,
putting the sprite numbers in this function is actually on purpose, so you have the chance to change the verbs graphics to their localised counterparts.

Code: ags
Verbs.LocalizeActionButton(eLangEN,eGA_Open,    59, 60, 'q');
eLangEN is the language token
eGA_Open (enum Global Action Open) is the verb action
59 is the sprite slot for the normal verb
60 is the sprite slot for the highlighted verb
q is the keyboard shortcut.


Regarding the slider, have a look at the manual here:
https://adventuregamestudio.github.io/ags-manual/Slider.html?highlight=slider&case_sensitive=0#slidervalue
Once the slide is being changed, you need to check if the slider is of certain value (such as 0 or 1).

Unfortunately I don't have a windows machine handy, so I can only provide untested pseudo code.

Code: ags
//switch GUI language
if (sldrLanguageSwitch.value == 0) {
  Game.ChangeTranslation("German");
  Verbs.VerbGuiOptions[eVerbGuiTemplateLanguage] = eLangDE;
}
else {
  Game.ChangeTranslation("");
  Verbs.VerbGuiOptions[eVerbGuiTemplateLanguage] = eLangEN;
}

Verbs.InitGuiLanguage();
Verbs.AdjustGUIText();

CCrane

#141
Quote from: abstauber on Wed 02/11/2022 13:28:51putting the sprite numbers in this function is actually on purpose, so you have the chance to change the verbs graphics to their localised counterparts.
Oh, of course. I actually realized it (but only later after I had already posted  :-D ) while I was assigning sprites to PushedImages and had them appear irrespective of language setting. Sorry to bother you with that.

Quote from: abstauber on Wed 02/11/2022 13:28:51Unfortunately I don't have a windows machine handy, so I can only provide untested pseudo code.
A big thanks for that. The slider didn't work but the code helped me to set up the language buttons, and that's just as good!
One strange thing happened, though. After I renamed the buttons (e.g. Button1 to btn2ger) they stopped functioning altogether. But when I added another button with the exact same function (and left the default name) it worked as intended and the other still renamed buttons worked all of a sudden again. :confused:
Maybe its AGS editor acting up in Linux ... anyways, I leave the default names now in place and everthing works.

best regards

Correction: This was due to the proper function name not having been updated in the events section of the properties pane.

@ChristophCrane_ (Indie author)

CCrane

Hi abstauber,

I'm using the Doors.AnyClickSpecial function and it works as intended. Now I want my character to walk some further steps (and disappear behind a walk-behind) before transitioning to the next room. It would just look nicer and smoother this way instead of the character merely "freezing".

So I'm wondering if there's a way to maybe combine aforementioned function with the hHotspot>e extension function but so far I was only partly lucky. The character just wanders off anytime the door hotspot is clicked, obviously, whether the door's open, closed or locked. Is there a way to execute the extension function only when the door is open?
I guess it could be changed in the function's module. Consequently I think an added walk off-set parameter would be a great addition to the function.

Any workaround is appreciated, though.


@ChristophCrane_ (Indie author)

abstauber

You're right, it would make a lot of sense for the door script to respect exit extensions. I'll see what I can do - although it might take a while

CCrane

#144
Hi,
thanks so much for looking into the matter but at the danger of becoming a pest I have another thing you might be able to help me with.

The AnyClickWalkLookPick function contains a string named lookat which is then used by a player.Say command.

Code: ags
    // PICKUP and make object invisible
    else if(Verbs.UsedAction(eGA_PickUp)) {
      Verbs.AnyClickWalkLookPick(160, 285, eDirectionLeft, "Damn, it's broken. ... Anyway", oHandgun.ID, iHandgun);
      GiveScore(5);

Since I use Snarky's bubbleSpeech module I'd like to change say to sayBubble. I found only two instances of player.Say(lookat) in VerbGui but changing them gave me this error:

SayBubble is not a public member of character

Is it just me being stupid or is that impossible to alter?

@ChristophCrane_ (Indie author)

abstauber

#145
Test 123, Cleantalk is awful!

Could you please test this portion of Doors::AnyClickSpecial ? I've marked the part I've changed.

Code: ags
else if (Verbs.UsedAction(eGA_WalkTo)) {
    if (Doors.GetDoorState(door_id) == 1) {
      if ( verbsData.exitDoorDoubleclick && DoubleClick.Event[eMouseLeft] ) 
      {
        if (Verbs.MovePlayerEx(player.x, player.y, eWalkableAreas) > 0 ) player.EnterRoom(nr_room, nr_x, nr_y, nr_dir);
        result = 2;
      }
      else 
      {
        if (Verbs.GoTo(2)) {
          // Start Test
          if (Verbs.ExtensionEx(1, verbsData.location_clicked)=='e') {
            int player_x = player.x, 
                player_y = player.y;
                
            int offset = verbsData.walkOffScreenOffset;
            int exit_dir = Verbs.ExtensionEx(2,verbsData.location_clicked);
            
            if      (exit_dir=='u') player_y -= offset;
            else if (exit_dir=='d') player_y += offset;
            else if (exit_dir=='l') player_x -= offset;
            else if (exit_dir=='r') player_x += offset;
         
            
            if (Verbs.MovePlayerEx(player_x, player_y, eAnywhere) >0) {
              player.EnterRoom(nr_room, nr_x, nr_y, nr_dir);
              result = 2;   
            }
          }
          // End Test
          player.EnterRoom(nr_room, nr_x, nr_y, nr_dir);
          result = 2;          
        }
        
      }
    }
    else Verbs.AnyClickMove(x, y, dir);

  }

CCrane

I tested it on my own demo game, and the character seemed again to walk past hHotspot>er irrespective of door state. My game seems to be corrupted however right now so I checked also with the Tumbleweed demo game.

I renamed Holodoor>v in room 2 to Holodoor>er and here I couldn't even interact with the door at first, i.e. I couldn't use the keycard on the door to unlock it. Next I set door state to closed but again I couldn't open the door so I set doorstate to open. This worked and character made some steps.

@ChristophCrane_ (Indie author)

AndreasBlack

So since there is some action in this thread.. :-D

Abstauber, do you have any idea how to create the double click/run function on a gamepad with the latest AGS Controller plugin? I've tried to use simulatemouse click syntax. I've also tried to just call verbs.startrunning(); on a button, but didn't work!


Thanks!

AndreasBlack

@abstauber There's a bug in the template. Funny thing tho A-boo i thought i tagged you a-who before, but maybe i didn't 8-0 If you try to GIVE TO it won't give the NPC character the item, until the second time you push the verb! It seems to be related to the distance of the characters, but i'm no coder so i could be wrong (wrong) 
Here's a Ambulance i've done for the game, so you'll get all a-reno and fix it!






abstauber

#149
Hey, as always sorry for the late reply. I could have sworn, that this did work at a time. This option in the TemplateSettings controls this behavior
  Verbs.VerbGuiOptions[eVerbGuiApproachCharInteract] = true;

Found it
In VerbGui.asc at around 2488 (depends on your version of the template)
instead of
Code: ags
(IsInteractionAvailable (x, y, eModeUseinv) == 1)
use
Code: ags
character[verbsData.location_id].IsInteractionAvailable (eModeUseinv) == 1
Here's the complete block.
Code: ags
      // Giveto
      else if (( verbsData.AGSCursorMode == eModeUseinv) && verbsData.location_type==eLocationCharacter && Verbs.IsAction(eGA_GiveTo)) {
        lblAction.TextColor = verbsData.actionLabelColorHighlighted;
        verbsData.ItemGiven=player.ActiveInventory;
        Verbs.SetAction (eGA_Default);
        if (verbsData.approachCharInteract == false) {
          if (character[verbsData.location_id].IsInteractionAvailable (eModeUseinv) == 1) {
            character[verbsData.location_id].RunInteraction(eModeUseinv);
          }
        }
        else {
          if (Verbs.GoToCharacter(character[verbsData.location_id], 0, verbsData.NPCfacingPlayer, 2)) {
           
            if (character[verbsData.location_id].IsInteractionAvailable (eModeUseinv) == 1) {
              character[verbsData.location_id].RunInteraction(eModeUseinv);        
            }
          }
        }
        
      } 

This might also affect other bits of the template, so I won't push the update just yet.
And I still wonder if IsInteractionAvailable used to return any interaction, not just for rooms.

AndreasBlack

Thanks! I'll try it tommorrow! I have to erase my own code attempts i realised they were still left in there!  (laugh) I still wanted to have parts of my code in there somewhat, if it's possible. That is to have a character throwing out his hand and meeting the others hand and exchanging items. I did that with a-reno NPC that is standing still, i mean it looks nicer!

Apart from that a-who, i've had no issues with the template, i finally got your DM code to work yesterday on objects in the room since i have a huge gate that is two objects and not a normal "door" so i had to setup the custom properties finally got that working, so that's nice! I'm all set for a future more serious game demo, expect a demo soon in the future!  (nod)

abstauber

I'd just like to add that the fix is safe to use and I've already updated the Github Project.

Is there anything else that needs fixing while I'm around? Not that you have to wait another year or so   ;)

AndreasBlack

Quote from: abstauber on Fri 29/09/2023 10:51:16I'd just like to add that the fix is safe to use and I've already updated the Github Project.

Is there anything else that needs fixing while I'm around? Not that you have to wait another year or so   ;)

Haha, yes there is! Ability to make the save files screenshot highres. When loading and saving it should look "good". I wrote about it in the beginners forum, but didn't get help (laugh). Since you can change the resolution now in AGS i do it quite a lot in my game so far actually, and yeah it would be nice to be able to have higher resolution on the screenshots of the save files!  (nod)

eri0o

#153
@abstauber , hey the new update in the GitHub project then, can I push it to ags? Just to clear this for new games!

Spoiler
The git diff is like ten thousand lines so this is why I am anxious to push it because I can't tell what's different in there exactly.
[close]

abstauber

@AndreasBlack I'm afraid the template uses the built-in function "DynamicSprite.CreateFromSaveGame". So whatever resolution is set in the savegame screenshot, will be used to draw the button image.

@eri0o
I really just changed a single line, but on a Mac using Crossover. So maybe the fileencoding changed too and therefore git wasn't able to detect the changes anymore.

Crimson Wizard

#155
Quote from: AndreasBlack on Fri 29/09/2023 12:33:42Since you can change the resolution now in AGS i do it quite a lot in my game so far actually

What do you mean, how do you "change the resolution in AGS"?

Like i mentioned in another thread, the screenshot is always in the game's resolution, the question is how this screenshot is resized when drawn on gui.

Looking in the template, it resizes the screenshots to the size of the buttons on the Load/Save menu. So the only existing solution is to:
a) resize the buttons, make them larger;
b) adjust script or gui sprites if necessary
I did not find out how it decides which size to use, so I hoped that somebody more familiar with the template could help with this.

Above is the only thing that you may achieve with the template's script. Anything else would require changes in the engine.

AndreasBlack

#156
Thanks as always for your input @Crimson Wizard ! I'm never expecting you to look into code you haven't written! And when i wrote "i didn't get any help" i meant from a perspective of actual code since it's mission impossible for a none-coder like me to do some of this stuff, even tho you seem to have some faith in me! I'm still using the manual cause i can't remember how to do a "do while" syntax, that speaks volumes!  (laugh)
 
I meant "momentarily". I tried to do exactly that. Inside of the codeblocks of the "Thumble Save function" i put in "Game.Camera.SetSize(1080x1200) as an attempt. I guess changing the resolution perhaps is the wrong expression. Changing the bakground to whatever resolution you want. Probably like always i confuse things so let's set the record straight.

If you can type "Game.Camera.SetSize(640x480)" obviously the bakground and everything in the room is now a different resolution from the original Game Setttings (320x200). The Gui's as i understood it is still 320x200, but the screenshot doesn't take those into account equals the ending resolution in the screenshot would appear to be 640x480 even tho the game "isn't really" in 640x480 overall??? Am i right or wrong here? 

Or am i confusing the bakgrounds resolution for the entire games assets apart from the GUI. Perhaps i am! The painful potential solution ofc upscaling all gui's, UI, BG's, characters, etc and set the game to a higher resolution is a valid option. I'm still kinda early in the development so i can still do it.

However i'm afraid code in the script needs to be changed then since a lot of the custom dialogs seems to be basing it's stuff on various widths and heights that would probably only work in a 320x200 setting right @abstauber ? And then i'm beeped since i'm no coder! So i don't think it's as simple as just "upscaling" everything and changing the game setting to 1920 x 1200 or could i just go multiplication x6 on your various heights/width settings in the Thumbleweed template to get it "right" looking, @abstauber?



Crimson Wizard

Quote from: AndreasBlack on Mon 02/10/2023 09:21:12If you can type "Game.Camera.SetAt(640x480)" obviously the bakground and everything in the room is now a different resolution from the original Game Setttings (320x200).

No, this is all wrong...
Firstly it's SetSize, not SetAt, but that's a typo. More importantly, this command does not change background's resolution, it scales the room's image, but resolution stays always the same. Resolution means "how many pixels you may have on screen at the same time".

Scaling camera means that room's pixels are duplicated or cut down. For instance, scaling x2 would mean that instead of 1 room pixel there will be 4 (2x2). But the total amount of pixels on the game screen will be the same (320x200)!

The screenshot uses game's resolution. It does not matter how much room is scaled, the game's resolution will be same, and therefore the screenshot will have always same resolution.

AndreasBlack

Quote from: Crimson Wizard on Mon 02/10/2023 09:32:17
Quote from: AndreasBlack on Mon 02/10/2023 09:21:12If you can type "Game.Camera.SetAt(640x480)" obviously the bakground and everything in the room is now a different resolution from the original Game Setttings (320x200).

No, this is all wrong...
Firstly it's SetSize, not SetAt, but that's a typo. More importantly, this command does not change background's resolution, it scales the room's image, but resolution stays always the same. Resolution means "how many pixels you may have on screen at the same time".

Scaling camera means that room's pixels are duplicated or cut down. For instance, scaling x2 would mean that instead of 1 room pixel there will be 4 (2x2). But the total amount of pixels on the game screen will be the same!

What about this. Having the GUI's code go out to something else in the room instead (Think Room equals the main screen "New Game, Load, Quit, etc". Forexample as a clickable object and have the object act as a "psuedo gui". I'm trying to think of ways to make the same effect as a 1920 x 1200 resolution game setting momentarely. Clearly i could make such a start screen, so wouldn't that be an alternative instead of upscaling everything in the actual game?

It's still probably to advanced for my coding skills..However if that's possible i have to use some form of code for the game to remember which room the player was in before, but that should be quite easy i think with something like player.previousroom? = go there after you've clicked in the main menu's if you push the "resume" object or "go back to game". And yeah, it was a typo ofc, i'm editing it! Is it an alternative that's more doable?







Crimson Wizard

Quote from: AndreasBlack on Mon 02/10/2023 09:45:29What about this. Having the GUI's code go out to something else in the room instead (Think Room equals the main screen "New Game, Load, Quit, etc". Forexample as a clickable object and have the object act as a "psuedo gui". I'm trying to think of ways to make the same effect as a 1920 x 1200 resolution game setting momentarely. Clearly i could make such a start screen, so wouldn't that be an alternative instead of upscaling everything in the actual game?

I'm sorry, but I cannot understand what do you mean by that, and how this will make the screenshots have better resolution.

SMF spam blocked by CleanTalk