TEMPLATE: 9-verb MI-style 1.6.4 - Last update: 4th April 2019

Started by abstauber, Thu 17/09/2009 16:16:37

Previous topic - Next topic

Crimson Wizard

#260
Quote from: Snarky on Tue 31/07/2018 09:07:47
Wait, can you actually do this in AGS script, or is this just something that ought to be possible? I never knew about this, if it's possible! Way cool!

This is how several array-like attributes are done, like Game.AudioClips, System.AudioChannels etc, you've been using these all along.

The attributes are still not documented inside the manual itself, there is only this slightly outdated wiki article: http://www.adventuregamestudio.co.uk/wiki/Keyword:_attribute

abstauber

Quote from: Snarky on Tue 31/07/2018 10:02:02
Sorry if this seems patronizing, you probably knew most of it already, but I wasn't sure exactly what part of it had you confused.
Not at all, this was quite insightful. Although I have to admit that in the end the wiki article did the trick of me fully understanding what attributes do in AGS :)

But since the wiki article mentions it: will this scripting feature still be supported in the future? I sure hope so ;)

Crimson Wizard

Quote from: abstauber on Tue 31/07/2018 13:45:57
But since the wiki article mentions it: will this scripting feature still be supported in the future? I sure hope so ;)

Like I said, the article is bit outdated, and attributes are fully supported and should not be abandoned.

abstauber

Many thanks! I've refactored the Tumbleweed template to use attributes now. But I won't do it with this template as I'd really like users to switch to the newer template and this one has not been refactored at all.

Maybe it would have been smarter to call the Tumbleweed Template "9-verb MI-Style 2.0" :-\

abstauber

@Monsieur OUXX
Have a look over here:
https://github.com/dkrey/ags_tumbleweed/blob/master/dialogscript.asc
https://github.com/dkrey/ags_tumbleweed/blob/master/dialogscript.ash

1) they make the things accessible from outside
check

2) they group the settings by category
I decided against individual arrays for each category of settings, as I find this a bit too confusing when setting up a new GUI. The options are still somehow categorized by the attribute name.

3) they make them reflexive (accessible by index or name in the array of settings, allowing to tie them to an in-game console system)
check

4) they clarify the initialization sequence and keep the object in a consistent state

err... 1/2 check? The initialization is done by the internal AGS functions. There is no needed sequence or order for the options to be set. Also the whole dialog GUI is now static.

And as said before: this won't make it into this template. But since the module doesn't have dependencies, you should have no problems importing the code from Tumbleweed Verbs.

croquetasesina

Hi!!! I was trying to change the GUI language by clicking on two buttons (one Spanish and one English flag).
Thanks to Khris, I did the following:
I added in guiscript.ash (header):

Code: ags

import int lang;


Then I opened the main guiscript.asc and above of int lang = eLangES (my first language in the 16 line); I scripted in the 17 line this

Code: ags

export lang;


After that I script in the English button event of Any_click this

Code: ags

function english_AnyClick()
{

  lang = eLangEN;
  AdjustLanguage();
  AdjustGUIText();
  
  if (Game.ChangeTranslation("English") == true) {
    Display("English loaded");
}
}


And everything seemed to work, the 9 verbs changed and the action text as well. However, I've noticed that when I press F5 to load or save the game, pause, or exit, those options remain in Spanish and have not changed no way.
What happen? What I can be doing wrong?[/code]

abstauber

Instead of AdjustLanguage(), try
InitGuiLanguage();

If I find the time I'll dig into this a bit deeper tomorrow.

edit: removed bogus

croquetasesina

I've tried what you told me abstauber, but the exact same thing is still happening

abstauber

Haha, a bug after all those years  8-0  (laugh)

You are totally right, there is something wrong in the code. In order to fix it you have to either wait until I release a fixed version or do the following:

In guiscript.asc find the function AdjustGuiText() - it should start around line 784
Now replace the lines
Code: ags

    // english is the default language, nothing to adjust
return;


with this:
Code: ags

    // English
    OptionsTitle.Text   = "Options";
    OptionsMusic.Text   = "Music Volume";
    OptionsSound.Text   = "Sound Effects Volume";
    OptionsSpeed.Text   = "Game Speed";
    OptionsDefault.Text = "Default";
    OptionsSave.Text    = "Save";
    OptionsLoad.Text    = "Load";
    OptionsRestart.Text = "Restart";
    OptionsQuit.Text    = "Quit";
    OptionsPlay.Text    = "Resume";
    gPausedText.Text    = "Game paused. Press <Space> to continue";
    RestoreTitle.Text   = "Please choose a game to load";
    RestoreCancel.Text  = "Cancel";
    SaveTitle.Text      = "Please enter a name";
    SaveOK.Text         = "Save";
    SaveCancel.Text     = "Cancel";
    gConfirmexitText.Text = "Are you sure, you want to quit? (Y/N)";
    gRestartText.Text   = "Are you sure, you want to restart? (Y/N)";


(the curly braces need to stay of course, so just replace the comment and the return command - nothing else ;) )
after that, it should work just fine.

croquetasesina

Now it works perfect! Oh, you can not imagine the headache this brought me. I thank you very much for your help and I owe you at least 4 or 5 blue glasses full of beer, or with what you prefer to fill them! ;)  (roll) (roll) (roll)

abstauber

Great that you got it working and thanks for reporting the bug. I'll be updating the template soon.

The template has been updated.

croquetasesina

I'm doing my graphic adventure with score. So far I have no problem to increase the score as you go. However, I would like the score to be shown in the GUI gOptions, under the RESUME button.
How could I do this?

abstauber

You just add a label and as text you define:
Code: ags

@SCORE@

AGS handles the rest for you.

WatchDaToast

Heya! I really needed to bump this thread for a reason.
I have been using this great plugin for my game troughout the last two yeas and made some custom changes to it here and there (mostly altering the way some verbs works).

However, now I want the player to be able to talk to any hotspot and object troughout the game, not only to characters. I have been looking for a line of code I could edit to enable this, but I haven't found anything similiar, nor do I know how I could achieve that with another (hacky?) way.
Any help is greatly appreciated <3

abstauber

Hi there,
there's support for this feature for a few years - so chances are high, that also your version of the template has this it in.

in guiscript.asc keep looking for this (around line43) and set it to true:

Code: ags
bool objHotTalk                 = false;  // Talk to Objects and Hotspots

WatchDaToast

Thank you! It's that easy actually?

I have look into the guiscript.acs, but I couldn`t find said line even with a search. I started using version 1.5.2 of the plugin in late 2017. :(
Could I do it an a different, more hacky way?

abstauber

Oh I see, it seems like you've missed it only by a few months.

But thanks to github, here's the change I made:

https://github.com/dkrey/ags_9verb-template/commit/ff32959675395ceffb73d018d8b35e27a3a12d79#diff-a615dc2d3934cff60e75e03baab6ae21


First you need to add  objHotTalk to guiscript.asc
Code: ags
bool objHotTalk                 = true;


And then you need to change this line:
Code: ags
  
    cond =((isAction(eGA_TalkTo) || (isAction(eGA_GiveTo) && (Mouse.Mode == eModeUseinv))) && (GetLocationType(mouse.x, mouse.y) != eLocationCharacter));


to this lines:
Code: ags

    if (objHotTalk && isAction(eGA_TalkTo) ) {
      cond = false;     
    }  
    else {
      cond =((isAction(eGA_TalkTo) || (isAction(eGA_GiveTo) && (Mouse.Mode == eModeUseinv))) && (GetLocationType(mouse.x, mouse.y) != eLocationCharacter));
    }
  


That should do the trick.


croquetasesina

Hi!! Is possible select an item in the inventory with script? I need to select it to see “use rope on...” in the verbs line when I pick up a room object.

croquetasesina

Hi again!!!
Could anyone help me with an issue? How could I use a background object on a character appearing on the same background? I would like to combine it... that is, "use OBJETC X in CHARACTER" without needing to take it. Any idea?

SMF spam blocked by CleanTalk