Adventure Game Studio

AGS Support => Modules, Plugins & Tools => Topic started by: monkey0506 on Sun 13/02/2011 02:30:28

Title: MODULE/TEMPLATE: Verbcoin v1.1 - 19 April 2011 - Now..some new stuff!
Post by: monkey0506 on Sun 13/02/2011 02:30:28
Hey there. I don't mean to offend (so sorry if this comes across the wrong way Elecktroshokker), but to me the verbcoin template that is distributed with AGS is somewhat of a mess. I can't tell what most of the functions are for without looking at the manual, because the naming convention is rather odd. Also, I seem to recall that none of the functions the template defines return a value, so you can't read anything back once it's been set..which seems rather unfriendly to me (writeonly??).

So I'm not here to bash the great work that Elecktroshokker has done, I'm here to present my take on the verbcoin interface. It has some similarities to the existing template, but not all of the functionality is the same between the two.

I've taken the liberty of making the template in the form of a short game which also serves as the demo for the module.

Part of the goal I had in writing this was also that of making it available as a stand-alone module. The existing template uses a lot of statically scripted, hard-coded items which make it impossible to do this. With this module you can simply import the script into an existing project, which could save a lot of work if you've already begun developing your game.

Anyway, without further ado..links:

Verbcoin template v1.1 (http://sites.google.com/site/monkey0506/Verbcoin_Template_1.1.rar) (For AGS 3.1.1+) (Includes module v1.1)
Verbcoin module v1.1 (http://sites.google.com/site/monkey0506/Verbcoin_1.1.rar) (For AGS 3.0+)
Verbcoin demo v1.0a (http://meleepta.x10hosting.com/Verbcoin_Demo_1.0a.rar) (Includes module v1.0a, but not template) (This is the same as the compiled version of the template v1.0a)

Other versions (for compatibility purposes):

Verbcoin template v1.0c (http://meleepta.x10hosting.com/Verbcoin_Template_1.0c.rar) (For AGS 3.0+) (No native coordinates, uses low-res coordinates*) (Includes module v1.0b)
Verbcoin template v1.0a (http://meleepta.x10hosting.com/Verbcoin_Template_1.0a.rar) (For AGS 3.1+) (No "normal" dialog scripting, uses run-script*) (Includes module v1.0a)

*This shouldn't make any difference in your own game if using a higher version of AGS, and would then only to the template files themselves.

Older versions:

Verbcoin template v1.0b (http://meleepta.x10hosting.com/Verbcoin_Template_1.0b.rar) (For AGS 3.1.1+) (Includes module v1.0a)
Verbcoin module v1.0b (http://meleepta.x10hosting.com/Verbcoin_1.0b.rar) (For AGS 3.0+)
Verbcoin template v1.0 (http://meleepta.x10hosting.com/Verbcoin_Template.rar) (Requires AGS 3.2.1+)
Verbcoin module v1.0 (http://meleepta.x10hosting.com/Verbcoin_1.0.rar) (Requires AGS 3.2+)
Verbcoin demo v1.0 (http://meleepta.x10hosting.com/Verbcoin_Demo.rar) (Includes module v1.0)

I've tried to thoroughly test everything, and the module itself is quite heavily documented, but let me know if you encounter any bugs, or just if you have any questions/comments/etc. I'll try to post mirrors soon.

Here's an excerpt from the documentation to give you an idea of how to implement the module functions in an existing game:

QuoteGetting started with the Verbcoin module:
-----------------------------------------

Getting started with the Verbcoin module is relatively simple. Import the module into your project, and set up your GUI
however you would like. We'll use Button controls to determine where our "verbs" are at, so be sure that you add these
controls where appropriate. Once you've got that taken care of, you'll need to add a few lines to your script to finish
setting up the interface.

Example:

// GlobalScript.asc

function game_start()
{
 Verbcoin.CoinGUI = gVerbcoin; // tell the module which GUI we will be using for our verbcoin
 Verbcoin.XOffset = gVerbcoin.Width / 2; // set the offset for displaying our GUI
 Verbcoin.YOffset = gVerbcoin.Height / 2; // here we'll just centre it
 Verbcoin.AddButton(btnLook, "Look at", eModeLookat); // add our buttons that the verbcoin will use
 Verbcoin.AddButton(btnTalk, "Talk to", eModeTalkto); // we tell the module what text we want associated with the button
 Verbcoin.AddButton(btnUse, "Use", eModeInteract); // as well as what CursorMode we want to associate the button with
}


And that's it! This is a fairly basic setup for a verbcoin interface, with three buttons for Look, Talk, and Use. There
are other settings that you may want to look at such as Verbcoin.DefaultMode or Verbcoin.Delay, but this should be
enough to get you started.

19 April 2011

Based on some of the recent feedback, I've added two new options to make the module more customizable: Verbcoin.MouseButtonToUse and Verbcoin.IgnoreInventoryClicks. In case the names weren't self-explanatory enough, let me elaborate.

MouseButtonToUse allows you to specify a different MouseButton for activating the verbcoin. For example, if you want to use the right mouse button for the verbcoin instead of the left mouse button, you would simply set this to eMouseRight.

IgnoreInventoryClicks lets you specify that the verbcoin should not be used for inventory interactions. By default, the module treats clicks on inventory items the same as a click on a character, object, or hotspot. If you want to handle inventory items differently, this property now lets you do that.

There are also a couple of other minor changes as well, but nothing very significant really.

03 March 2011

Okay, technically I'm not making this edit until the 5th, so sue me. :D I've uploaded the module v1.0b and template v1.0c for compatibility fixes.

The module v1.0b corrects backwards compatibility of the module which was referencing String.IsNullOrEmpty, the only thing preventing full AGS 3.0+ compatibility. Since it's such a simple function I just changed the function calls to check each of the possible conditions directly. The module is now fully 3.0+ compatible.

The template v1.0c, as you may have noticed, has not been set as the primary download link for the template. The reason for this being that most users are probably using at least AGS 3.1.1 or higher if they are using an AGS 3 version, and there have been some significant changes. The template v1.0c is designed with those using AGS 3.0 to 3.0.2 in mind, who are bound to using low-res coordinates. You can import the template into higher versions of AGS and use native coordinates if you wish, but the template itself and included resources use only low-res coordinates.

17 February 2011

I've uploaded versions 1.0a and 1.0b of the template, and version 1.0a of the module and demo. The template v1.0a is designed for AGS 3.1 only (though is compatible with). The template v1.0b is for AGS 3.1.1+. The only difference between the two is whether the example dialog included in the template uses normal scripting commands. For this reason future versions of the template will not be designed around versions of AGS prior to 3.1.1.

The module version 1.0a is a minor bugfix because I was referencing eMouseMiddleInv, which didn't exist until AGS 3.2. The module itself should be compatible with AGS 3.0+, though I might have overlooked something else. I have verified module compatibility as far back as 3.1, which I'm guessing should cover most 3.0+ users anyway, but I will still try and find a copy of AGS 3.0 to verify.
Title: Re: MODULE/TEMPLATE: Verbcoin - An alternative to the built-in template!
Post by: Sslaxx on Sun 13/02/2011 13:07:13
If I'm missing the obvious I apologise, but what's the minimum version of AGS you need to use this module?
Title: Re: MODULE/TEMPLATE: Verbcoin - An alternative to the built-in template!
Post by: monkey0506 on Sun 13/02/2011 21:48:57
Unless I've overlooked something, the module itself should be compatible with 3.0+.

I didn't think about it till just now, but the template was compiled with 3.2.1, so the template requires that version. I'm going to try and compile the template with a lower version as soon as I can get one. I couldn't find a working link for 3.0, but I'm downloading 3.1 right now.

I'll look around more and see if I can't find a mirror for 3.0 to test it out. (If anyone has it, feel free to let me know ;))

Edit: Apparently I forgot that normal scripting wasn't supported within dialog scripts until 3.1.1. Based on the way I scripted some of the dialogs in the template, it wouldn't be impossible, but it would be potentially bothersome to have to convert it over.

Also I looked at the module script in 3.1 and I referenced (exactly once) eMouseMiddleInv which didn't exist until 3.2. That would be very, very easy to fix with a simple bit of preprocessor conditioning.

I'm now downloading 3.1.1 to convert the template.

Oh, and Game.IgnoreUserInputAfterTextTimeoutMs was used in the template, but that can easily be removed.
Title: Re: MODULE/TEMPLATE: Verbcoin - An alternative to the built-in template!
Post by: silverwolfpet on Wed 16/02/2011 01:02:09
eMouseMiddleInv gave me some problems too.
Title: Re: MODULE/TEMPLATE: Verbcoin - An alternative to the built-in template!
Post by: monkey0506 on Wed 16/02/2011 01:27:54
I actually was able to work around the conditions by porting portions of the dialog script to the global script instead..which I didn't want to do.

So I've now got versions 1.0a and 1.0b of the template for 3.1 and 3.1.1+ respectively. As noted, the module itself should  be 3.0+ compatible (with the fix I implemented into the module 1.0a.).

I'll try and upload them tonight.
Title: Re: MODULE/TEMPLATE: Verbcoin - An alternative to the built-in template!
Post by: Shane 'ProgZmax' Stevens on Wed 16/02/2011 09:46:05
This is a pretty cool approach to the verbcoin since it allows you to easily supply more button functionality.  I definitely think this version should be included as an ags template.
Title: Re: MODULE/TEMPLATE: Verbcoin v1.0a/b - 17 February 2011 - Now AGS 3.1+ compatible!
Post by: monkey0506 on Thu 17/02/2011 23:48:01
I'm glad to hear that ProgZ.

I finally got around to uploading the new files, which should allow people to start using it without having to use unreleased/unofficial versions of AGS (meaning 3.2+).

Let me know what you think of the module, and of course if you find any problems! :)
Title: Re: MODULE/TEMPLATE: Verbcoin v1.0a/b - 17 February 2011 - Now AGS 3.1+ compatible!
Post by: silverwolfpet on Sun 20/02/2011 00:18:59
Hi!

I downloaded this one: Verbcoin template v1.0a (For AGS 3.1)
I have version 3.1.

I just import the script and, without setting up anything, I try and run the game, just to see if it runs without setting up the GUI and all that stuff. It freezes on the same line, at the same place.

Verbcoin.asc(826): Error (line 826): undefined symbol 'eMouseMiddleInv'

What am I doing wrong?

EDIT: I just deleted the 'eMouseMiddleInv', seems to run fine now...although I did notice a slight lower framerate. Could also be due to the music (3Mb).

Second EDIT:  Okay, got it to work, it's brilliant! One thing though...

I have two characters: Kauff and Gustav. I used to put this at the beginning of the global script:

function game_start()
{
 if (mouse.Mode == eModeWalkto) {
 Label1.Text = String.Format("Walk to @OVERHOTSPOT@");
}


And later on I added


function on_mouse_click(MouseButton button)
{
if (player == cKauff) {
   if (mouse.Mode == eModeWalkto) {
 Label1.Text = String.Format("Walk to @OVERHOTSPOT@");
 }
 else if (mouse.Mode == eModeLookat) {
 Label1.Text = String.Format("Analyze @OVERHOTSPOT@");
 }
 else if (mouse.Mode == eModeInteract) {
 Label1.Text = String.Format("Use @OVERHOTSPOT@");
 }
 else if (mouse.Mode == eModeTalkto) {
 Label1.Text = String.Format("Answer Question to @OVERHOTSPOT@");
 }}
 else {
     if (mouse.Mode == eModeWalkto) {
 Label1.Text = String.Format("Walk to @OVERHOTSPOT@");
 }
 else if (mouse.Mode == eModeLookat) {
 Label1.Text = String.Format("Examine @OVERHOTSPOT@");
 }
 else if (mouse.Mode == eModeInteract) {
 Label1.Text = String.Format("Use @OVERHOTSPOT@");
 }
 else if (mouse.Mode == eModeTalkto) {
 Label1.Text = String.Format("Contradict Kauff with @OVERHOTSPOT@");


Basically, I want each of these two playable characters to have unique actions (even though "Answer Question to" and "Contradict Kauff with" have the same function as "Talk to". It's just unique and I like it)

Now, when the GUI appears, mouseover works fine but it doesn't show the "Analyze", "Use" etc etc strings anymore.

I managed to give each character a unique GUI, with it's own buttons... like so:

function repeatedly_execute()
{
 if (player == cKauff){
 Verbcoin.CoinGUI = gKauffVerbcoin;
 Verbcoin.XOffset = gKauffVerbcoin.Width / 2;
 Verbcoin.YOffset = gKauffVerbcoin.Height / 2;
 Verbcoin.AddButton(btnKauffLook, "Look at", eModeLookat);
 Verbcoin.AddButton(btnKauffTalk, "Talk to", eModeTalkto);
 Verbcoin.AddButton(btnKauffUse, "Use", eModeInteract);
}
else if (player == cGustav) {
 Verbcoin.CoinGUI = gGustavVerbcoin;
 Verbcoin.XOffset = gGustavVerbcoin.Width / 2;
 Verbcoin.YOffset = gGustavVerbcoin.Height / 2;
 Verbcoin.AddButton(btnGustavLook, "Look at", eModeLookat);
 Verbcoin.AddButton(btnGustavTalk, "Talk to", eModeTalkto);
 Verbcoin.AddButton(btnGustavUse, "Use", eModeInteract);
}}


Where can I add/move the original code for the @overhotspot@ stuff to appear when I mouseover the buttons?

...that sounded like crap, but you get the idea of what I am asking. Thank you!
Title: Re: MODULE/TEMPLATE: Verbcoin v1.0a/b - 17 February 2011 - Now AGS 3.1+ compatible!
Post by: monkey0506 on Sun 20/02/2011 01:11:50
Dang it..I accidentally packaged the v1.0 module into all of the 1.0a downloads (template, module, and demo).

Apparently only the template v1.0b download has the v1.0a module SCM file in its package. The v1.0a template has the corrected module files updated though, so if you already downloaded the template you could extract the files from there (by creating a new project and then grabbing them).

Apparently I'm bad at this. :=
Title: Re: MODULE/TEMPLATE: Verbcoin v1.0a/b - 17 February 2011 - Now AGS 3.1+ compatible!
Post by: silverwolfpet on Sun 20/02/2011 02:26:40
Nah, it's fine, I just deleted that single line...no big deal. Wasn't going to use middle button anyway.

any suggestions on my problem? It's related to the Verbcoin. Do I have to modify your script?
Title: Re: MODULE/TEMPLATE: Verbcoin v1.0a/b - 17 February 2011 - Now AGS 3.1+ compatible!
Post by: monkey0506 on Sun 20/02/2011 03:00:08
Sorry, you must have edited around the same time I was posting.

@OVERHOTSPOT@ won't work when the GUI is shown, but that's what Verbcoin.LocationName is for.

I'd recommend making some changes. Put the following function somewhere toward the top of your GlobalScript.asc script file:

void SetPlayer(Character *theCharacter)
{
  if (theCharacter == cKauff)
  {
    Verbcoin.CoinGUI = gKauffVerbcoin;
    Verbcoin.XOffset = gKauffVerbcoin.Width / 2;
    Verbcoin.XOffset = gKauffVerbcoin.Height / 2;
    Verbcoin.AddButton(btnKauffLook, "Analyze", eModeLookat);
    Verbcoin.AddButton(btnKauffTalk, "Answer Question to", eModeTalkto);
    Verbcoin.AddButton(btnKauffUse, "Use", eModeInteract);
  }
  else if (theCharacter == cGustav)
  {
    Verbcoin.CoinGUI = gGustavVerbcoin;
    Verbcoin.XOffset = gGustavVerbcoin.Width / 2;
    Verbcoin.YOffset = gGustavVerbcoin.Height / 2;
    Verbcoin.AddButton(btnGustavLook, "Examine", eModeLookat);
    Verbcoin.AddButton(btnGustavTalk, "Contradict Kauff with", eModeTalkto);
    Verbcoin.AddButton(btnGustavUse, "Use", eModeInteract);
  }
  theCharacter.SetAsPlayer();
}


Then instead of using cKauff.SetAsPlayer or cGustav.SetAsPlayer you would use SetPlayer(cKauff). This handles processing the setup of the verbcoins when the player is changed, instead of doing it from repeatedly_execute (which would be queuing a lot of redundant function calls). So, remove the lines you already have there.

Also, you're going to need to rethink where you're updating your label, so go ahead and just get rid of the script you have in on_mouse_click. Now, going back to the repeatedly_execute function:

function repeatedly_execute()
{
  if (Verbcoin.ActionText == null) Label1.Text = String.Format("Walk to %s", Verbcoin.LocationName);
  else Label1.Text = String.Format("%s %s", Verbcoin.ActionText, Verbcoin.LocationName);
}


This will update your label so that if you don't have a verb on the verbcoin selected then it will show the walk-to text, otherwise it will show the appropriate interaction text for the selected button. This will be also take advantage of the module's built-in methods for alternate interaction text (look up the SetActionText functions in the included documentation).
Title: Re: MODULE/TEMPLATE: Verbcoin v1.0a/b - 17 February 2011 - Now AGS 3.1+ compatible!
Post by: silverwolfpet on Sun 20/02/2011 03:24:34
Well, I did exactly as you wrote... word for word. Copy paste.
Deleted exactly what you said.

Now it just shows me "Walk to" all the time, hotspots are without any name (so nothing appears, or nothing gets recognized) and the Verbcoin doesn't work anymore. Thoughts?
Title: Re: MODULE/TEMPLATE: Verbcoin v1.0a/b - 17 February 2011 - Now AGS 3.1+ compatible!
Post by: monkey0506 on Mon 21/02/2011 01:53:12
With that code you would need to call SetPlayer from game_start to initialize the Verbcoin, and then use SetPlayer when you are changing the player (IIRC you're using a button for this, right)?

And why would none of your hotspots have names? If they didn't have names then @OVERHOTSPOT@ wouldn't work either..unless you just mean to say that it's not adding anything for the hotspot names to the label..which actually sounds related to the issue with the verbcoin itself not working, which I believe is related to the above.

Make sure you call the given SetPlayer function from game_start and that should get it working for you.

Edit: On an unrelated note, I finally got ahold of a copy of 3.0, and it seems the only other thing I overlooked was the non-existence of String.IsNullOrEmpty in that version of AGS. I can work around using that function for the sake of furthered backwards compatibility!
Title: Re: MODULE/TEMPLATE: Verbcoin v1.0a/b - 17 February 2011 - Now AGS 3.1+ compatible!
Post by: silverwolfpet on Tue 22/02/2011 12:47:29
You're a genius! I made it work! Yes yes yes! Awesome! Everything works swell! :D

Two thumbs waaay way up! Thank you!
Title: Re: MODULE/TEMPLATE: Verbcoin v1.0a/b - 17 February 2011 - Now AGS 3.1+ compatible!
Post by: monkey0506 on Tue 22/02/2011 15:35:09
Sweet! Good to know you got it working.

I'm currently working on porting the template back to AGS 3.0 which is..a bit more work than I realized (no native coordinates primarily). The module itself is compatible now that I've fixed the references to String.IsNullOrEmpty (along with the other fixes from v1.0a of the module). I'll try and upload corrected archives for the 1.0a downloads as well with the correct module version in them.
Title: Re: MODULE/TEMPLATE: Verbcoin v1.0b - 03 March 2011 - Now AGS 3.0+ compatible!
Post by: monkey0506 on Sun 06/03/2011 01:30:21
Alright, so I've finally sorted out the compatibility issues and there are now versions of both the module and the template available which make this fully 3.0+ compatible. Isn't that nice? :)

The reason there's so many versions of the template if you're wondering is just to take advantage of various features of different versions of AGS within the template files. I do not intend to maintain three versions of the template, so these versions should be considered as "final" compatibility releases. Any newer version(s) of the template will be designed for AGS 3.1.1+ only.

I will though try to maintain backwards compatibility of the module, since the module code isn't dependent on those features like dialog scripting or what coordinate system is used (since it doesn't reference static coordinates, and only uses things like mouse.x and mouse.y). For any future versions, if you want to implement the new module into an older version of the template that I will try to make it so that you can just import the newer module into the template version matching your version of AGS.
Title: Re: MODULE/TEMPLATE: Verbcoin v1.0b - 03 March 2011 - Now AGS 3.0+ compatible!
Post by: TheRoger on Thu 14/04/2011 17:37:08
Damn...can get it my way...

Is it possible to make that when you press Left mouse button, character would be just walking, no matter how long you'll hold button. And coin would appear when you press Right mouse button, without character walking. It would be nice that coin would only disappear when you use any action or move mouse away.
Title: Re: MODULE/TEMPLATE: Verbcoin v1.0b - 03 March 2011 - Now AGS 3.0+ compatible!
Post by: monkey0506 on Thu 14/04/2011 21:14:28
You really want the verbcoin to deactivate if the user moves the mouse off of it?? That would be horrendously frustrating to me.

It wouldn't be that difficult for me to make the mouse button used to activate the coin something that could be customized.

If I understand you correctly, you want the verbcoin to be turned on by a right-click, and then stay on (without the user holding the mouse button down), right? That's actually pretty different than what this module was designed for. The built-in template by Electroshokker is labeled as a "SCUMM" verbcoin template, but if you actually compare it, this module/template is much closer to the workings of, say, The Curse of Monkey Island. (And just to be sure I wasn't remembering things wrong, I did in fact check while writing this.)

For your purposes, it might actually just be simpler for you to write your own script. Something like:

// top of script

int clicked_x;
int clicked_y;

void PositionAndShowVerbcoin()
{
  gVerbcoin.X = mouse.x - (gVerbcoin.Width / 2); // you can use your own offset here, I'll just show how to center it
  gVerbcoin.Y = mouse.y - (gVerbcoin.Height / 2);
  gVerbcoin.Visible = true;
}

// on_mouse_click
  // ...
  else if (button == eMouseRight) PositionAndShowVerbcoin();

// repeatedly_execute
  if ((gVerbcoin.Visible) && (GUI.GetAtScreenXY(mouse.x, mouse.y) != gVerbcoin)) gVerbcoin.Visible = false;

// on_event
  if (event == eEventGUIMouseDown)
  {
    if (data == gVerbcoin.ID)
    {
      GUIControl *gcat = GUIControl.GetAtScreenXY(mouse.x, mouse.y);
      if (gcat == null) return; // didn't click on a control..
      if (gcat == btnLook) ProcessClick(clicked_x, clicked_y, eModeLookat);
      else if (gcat == btnTalk) ProcessClick(clicked_x, clicked_y, eModeTalkto);
      else if (gcat == btnUse) ProcessClick(clicked_x, clicked_y, eModeInteract);
    }
  }


I'm only suggesting that because from what it sounds like you want an interface pretty different than that of the CMI-style SCUMM verbcoin interface, which is what this module/template implements.
Title: Re: MODULE/TEMPLATE: Verbcoin v1.0b - 03 March 2011 - Now AGS 3.0+ compatible!
Post by: TheRoger on Fri 15/04/2011 05:07:23
Well, I'll try this, though I'm bad at this kind of scripting.

EDIT:Hmm...Well the main thing what I want is that character wouldn't walk when you press Right button on walkable area.
Title: Re: MODULE/TEMPLATE: Verbcoin v1.0b - 03 March 2011 - Now AGS 3.0+ compatible!
Post by: monkey0506 on Fri 15/04/2011 19:22:07
So don't process a click in eModeWalkto when the user clicks the right mouse button. That's..pretty basic. The click is intercepted by on_mouse_click, and it won't be processed until you call the ProcessClick function.
Title: Re: MODULE/TEMPLATE: Verbcoin v1.0b - 03 March 2011 - Now AGS 3.0+ compatible!
Post by: TheRoger on Fri 15/04/2011 19:37:18
There is no eModeWalkTo function anywhere...used ctrl+f

Maybe it's possible to do, that coin appear only when it is pressed on hotspot/object/npc ?
Title: Re: MODULE/TEMPLATE: Verbcoin v1.0b - 03 March 2011 - Now AGS 3.0+ compatible!
Post by: monkey0506 on Fri 15/04/2011 20:34:51
I'm sorry, but are you using this module or template?

You don't seem to have a grasp on scripting in AGS at all from what you're saying. There's no such thing as a "eModeWalkTo function"..and Ctrl+F does not have a built-in function. Mouse-clicks are still processed through on_mouse_click.

Unless you're using this module, which it seems that you're not, then this discussion really doesn't belong here.

You need to understand how basic game logic works in AGS anyway or you're not going to be able to get any of this to work.
Title: Re: MODULE/TEMPLATE: Verbcoin v1.0b - 03 March 2011 - Now AGS 3.0+ compatible!
Post by: TheRoger on Sat 16/04/2011 05:55:00
Wow...I did it!!! It's working the way I want  ;D

I know that eModeWalkTo is not a function, I'm not native English speaker, so I didn't knew how to call that.
Ctrl+F means that search box.

Umm...is it possible to make, that when you use "pick up" mode, it wouldn't write hotspot/object name in status bar, just "pick up"

I believe it should be done in repeatedly execute section, these lines:

if (String.IsNullOrEmpty(Verbcoin.ActionText)) lblLocation.Text = Verbcoin.LocationName;
  else lblLocation.Text = String.Format("%s %s", Verbcoin.ActionText, Verbcoin.LocationName);


Also, where is Inventory interaction code? Because I also get VerbCoin in inventory view, when I press on item.
Title: Re: MODULE/TEMPLATE: Verbcoin v1.0b - 03 March 2011 - Now AGS 3.0+ compatible!
Post by: monkey0506 on Sat 16/04/2011 20:39:56
I'm still..confused..but hey, you got it working.

As for your question about pick up mode, that..still comes down to really basic logic:

// repeatedly_execute
  if (String.IsNullOrEmpty(Verbcoin.ActionText)) lblLocation.Text = Verbcoin.LocationName;
  else if (Verbcoin.ActionText == "Pick up") lblLocation.Text = Verbcoin.ActionText;
  else lblLocation.Text = String.Format("%s %s", Verbcoin.ActionText, Verbcoin.LocationName);


The code controlling the verbcoin in relation to the inventory is hard-coded as part of the module. I could make it optional to ignore inventory items, but it's more than just one or two lines of code.
Title: Re: MODULE/TEMPLATE: Verbcoin v1.0b - 03 March 2011 - Now AGS 3.0+ compatible!
Post by: TheRoger on Sat 16/04/2011 21:24:24
I tried this, it still writes with hotspot name.

I changed PickUp mode to open Inventory, and when I drag mouse there, this is what I get.

(http://i53.tinypic.com/s2y3h0.png)

It should be just Open Inventory, without PC (object name).
Title: Re: MODULE/TEMPLATE: Verbcoin v1.0b - 03 March 2011 - Now AGS 3.0+ compatible!
Post by: monkey0506 on Sat 16/04/2011 21:59:03
You changed what you wanted to do and wonder why the solution I provided doesn't fit a different problem. How strange.

Do this:

// repeatedly_execute
  if (String.IsNullOrEmpty(Verbcoin.ActionText)) lblLocation.Text = Verbcoin.LocationName;
  else if (GUIControl.GetAtScreenXY(mouse.x, mouse.y) == btnOpenInv) lblLocation.Text = Verbcoin.ActionText;
  else lblLocation.Text = String.Format("%s %s", Verbcoin.ActionText, Verbcoin.LocationName);
Title: Re: MODULE/TEMPLATE: Verbcoin v1.0b - 03 March 2011 - Now AGS 3.0+ compatible!
Post by: TheRoger on Sun 17/04/2011 06:34:43
My fault, sorry. It's working now, thank you.
Title: Re: MODULE/TEMPLATE: Verbcoin v1.1 - 19 April 2011 - Now..some new stuff!
Post by: monkey0506 on Wed 20/04/2011 07:43:20
Thanks for the ideas Roger! They're pretty good. :=
Title: Re: MODULE/TEMPLATE: Verbcoin v1.1 - 19 April 2011 - Now..some new stuff!
Post by: silverwolfpet on Thu 28/07/2011 16:39:51
Here's a challenge!

I've been using this module/template... it's brilliant. Never failed me so far.
However... I'm trying to make a little tweak to it for my game.

If you click on any object, you have USE, LOOK AT and TALK TO.
But how can I change the USE function to PICK UP for certain objects? not all...just for some.

Given that, how can I change the string on the bottom of the screen from
Use rock on fence
to
Smash fence
(or any other sentence I want to show) ?
Title: Re: MODULE/TEMPLATE: Verbcoin v1.1 - 19 April 2011 - Now..some new stuff!
Post by: monkey0506 on Fri 29/07/2011 00:25:33
QuoteGUI* Verbcoin.CoinGUI

  Used to get or set the GUI used as the "coin" of the verbcoin. This GUI *must* be the OwningGUI of any Buttons that
  you want to use on the verbcoin.

  Example:

    Verbcoin.CoinGUI = gVerbcoin;

  You would do something like this in game_start to set up your GUI for the first time, and of course it can be changed
  at runtime if needed.
 
  NOTE: Since all interaction text and mouse modes are linked to their respective Button controls, if the CoinGUI is
  changed at runtime, ALL of this information will be LOST. If you are using more than one GUI in your game, consider
  this carefully when setting up your game. You may want to just rearrange the existing GUI, or possibly use a custom
  function to switch between the GUIs.

  See Also: Verbcoin.AddButton, Verbcoin.RemoveButton, Verbcoin.XOffset, Verbcoin.YOffset

SetActionText functions:
************************

void Character.SetActionText(Button*, String actionText)
void Hotspot.SetActionText(Button*, String actionText)
void InventoryItem.SetActionText(Button*, String actionText)
void Object.SetActionText(Button*, String actionText)

  These four extender methods are provided by the module so that you can set custom interaction text for individual
  items. If the specified button is not in-use by the module then this function is ignored. To disable the custom
  interaction text and use the default instead, simply pass null as the second parameter.

  Example:

    iCracker.SetActionText(btnTalk, "Taste");

  Changes the interaction text for the iCracker inventory item to "Taste". This doesn't affect the default interaction
  text, so other items will still use "Talk to" as the action text, unless they have a custom value supplied.

  See Also: Verbcoin.ActionText, Verbcoin.ButtonActionText, Verbcoin.SetButtonActionText, GetActionText functions

So, seeing as you're using two separate GUIs, you'd need to make some very special provisions when changing from one character to another. What I'd actually recommend you do instead of using two separate GUIs is just to change the button graphics (and possibly the button action text). So, just going off the code I gave you before:

void CopyButtonGraphics(Button *from, Button *to)
{
  to.NormalGraphic = from.NormalGraphic;
  to.MouseOverGraphic = from.MouseOverGraphic;
  to.PushedGraphic = from.PushedGraphic;
  to.Width = from.Width;
  to.Height = from.Height;
}

void SetPlayer(Character *theCharacter)
{
  if (theCharacter == cKauff)
  {
    Verbcoin.CoinGUI.BackgroundGraphic = gKauffVerbcoin.BackgroundGraphic;
    Verbcoin.CoinGUI.SetSize(gKauffVerbcoin.Width, gKauffVerboin.Height);
    Verbcoin.XOffset = gKauffVerbcoin.Width / 2;
    Verbcoin.YOffset = gKauffVerbcoin.Height / 2;
    Verbcoin.SetButtonActionText(btnLook, "Analyze");
    Verbcoin.SetButtonActionText(btnTalk, "Answer Question to");
    CopyButtonGraphics(btnKauffLook, btnLook);
    CopyButtonGraphics(btnKauffTalk, btnTalk);
    CopyButtonGraphics(btnKauffUse, btnUse);
  }
  else if (theCharacter == cGustav)
  {
    Verbcoin.CoinGUI.BackgroundGraphic = gGustavVerbcoin.BackgroundGraphic;
    Verbcoin.CoinGUI.SetSize(gGustavVerbcoin.Width, gGustavVerboin.Height);
    Verbcoin.XOffset = gGustavVerbcoin.Width / 2;
    Verbcoin.YOffset = gGustavVerbcoin.Height / 2;
    Verbcoin.SetButtonActionText(btnLook, "Examine");
    Verbcoin.SetButtonActionText(btnTalk, "Contradict Kauff with");
    CopyButtonGraphics(btnGustavLook, btnLook);
    CopyButtonGraphics(btnGustavTalk, btnTalk);
    CopyButtonGraphics(btnGustavUse, btnUse);
  }
  theCharacter.SetAsPlayer();
}

function game_start()
{
  Verbcoin.CoinGUI = gVerbcoin;
  Verbcoin.AddButton(btnLook, "Analyze", eModeLookat);
  Verbcoin.AddButton(btnTalk, "Answer Question to", eModeTalkto);
  Verbcoin.AddButton(btnUse, "Use", eModeInteract);
  SetPlayer(cKauff);
}


Just create a GUI called gVerbcoin with buttons btnLook, btnTalk, and btnUse and the above code should work pretty much the same as what you were already doing (although it will actually be faster when changing players).

The reason I said to do that is so that you don't have to constantly rewrite the custom interaction text for every item when you're changing between players (because that would just be ridiculous! :P).

From there, to achieve what you wanted, you could do:

// change interaction for object oFence:
oFence.SetActionText(btnUse, "Smash");

// change interaction for character cKauff:
cKauff.SetActionText(btnTalk, "Ridicule");


If you specifically need separate interactions between the two characters, well there wouldn't really be a nice way around that, you'd have to change the text for each item every time you switched players, but hopefully that won't be necessary?
Title: Re: MODULE/TEMPLATE: Verbcoin v1.1 - 19 April 2011 - Now..some new stuff!
Post by: silverwolfpet on Fri 29/07/2011 00:31:19
Woah!

I should make a copy of the game as it is now, so I don't break something while implementing your code o.O

Thank you so much! I hope I can manage to implement this right.
I'll let you know how it goes. I'll do my best.  ;D
Title: Re: MODULE/TEMPLATE: Verbcoin v1.1 - 19 April 2011 - Now..some new stuff!
Post by: silverwolfpet on Sat 06/08/2011 18:13:24
Problem...
The three buttons I made... BtnLook, BtnTalk, BtnUse... they changed the initial position of the other buttons (btnKauffLook etc.)
Kauff and Gustav have different positions for those buttons... so if I modify btnLook to make btnKauffLook fit into the right place... btnGustavLook is messed up.

I don't suppose it can let the original buttons as they were, right?

On the other hand, the text-replacing works flawlessly. :)
Haven't tried it on characters yet, but I can finally "Pick up" rock instead of "Use" rock. :p

EDIT: I handled it! I'm awesome! :D  I just made the buttons change positions each time the player switches characters!

Thank you again dude! You're brilliant!! I'll let you know if it works on characters too!
Title: Re: MODULE/TEMPLATE: Verbcoin v1.1 - 19 April 2011 - Now..some new stuff!
Post by: monkey0506 on Sat 06/08/2011 18:40:28
Add the following lines to the CopyButtonGraphics function:

  to.X = from.X;
  to.Y = from.Y;


The reason I said not to use the original buttons is because the module currently requires the coin GUI to be the owning GUI of any buttons it uses (so that it doesn't have to keep track of multiple GUIs and making sure they're turned on and positioned properly, etc., etc.). The next part of the problem arises in that your custom action text, i.e. "Pick up rock" instead of "Use rock", is stored based on a per-button basis, so if you change the coin GUI, then the relation to the buttons is lost, and your custom action text would be destroyed.

Then, if you kept changing between the two characters and switching the GUI, then you'd constantly have to set up your custom action text for everything all over again.

By using only one GUI and changing button graphics instead of using different buttons altogether, you don't lose that information when changing players.

Something I could consider doing is allowing you to keep the custom action text based on the relative button ID as each was added to the verbcoin...and then assume that the relation is kept when new buttons are added. That would require some changes to be made, but it sounds feasible. Don't hold your breath for that though as I have a few higher priority projects underway at the moment. ;)
Title: Re: MODULE/TEMPLATE: Verbcoin v1.1 - 19 April 2011 - Now..some new stuff!
Post by: silverwolfpet on Wed 10/08/2011 19:38:59
Question:  If I pick up an inventory item from the inventory (let's say the Rock) and want to use it on Gustav... how can I change "Use Rock with Gustav" to "Hit Gustav with Rock" ?

I spent a few days trying to figure this out. The room's repeatedly_execute function seem to solve it partially...but then it messes up the entire room.

Any idea?
I really don't want to be a bother with this and I am giving it my best ^.^

...also, in the inventory panel, it seems that the verbcoin resets itself. How can I change the "Use Rock" to "Eat Rock" having iInvItem1 ? I mean, for the fence, I use object[1].SetActionText bla bla and it works fine... but there isn't any iInvItem1.Set ActionText...is there?
Title: Re: MODULE/TEMPLATE: Verbcoin v1.1 - 19 April 2011 - Now..some new stuff!
Post by: monkey0506 on Wed 10/08/2011 20:44:07
Regarding the first issue I was originally going to say that you should just use Verbcoin.ActiveInventoryActionFormat, but there's one important problem, in that you want the order of the item name and character name to be reversed from what the module expects to be the norm. So, you've got to do a bit more work yourself:

function repeatedly_execute()
{
  Character *cat = Character.GetAtScreenXY(mouse.x, mouse.y);
  if ((player == cKauff) && (player.ActiveInventory == iRock) && (cat == cGustav))
  {
    Verbcoin.ActiveInventoryActionFormat = "%s"; // change the format to use *only* the item name
    lblLocation.Text = String.Format("Hit %s with %s", Verbcoin.LocationName, Verbcoin.ActionText);
  }
  else
  {
    if (cat != null) Verbcoin.ActiveInventoryActionFormat = "Give %s to";
    else Verbcoin.ActiveInventoryActionFormat = "Use %s with";
    if (Verbcoin.ActionText == null) lblLocation.Text = Verbcoin.LocationName;
    else lblLocation.Text = String.Format("%s %s", Verbcoin.ActionText, Verbcoin.LocationName);
  }
}


Regarding the inventory, I'm not sure what you mean when you say that the verbcoin "resets itself". There is an InventoryItem.SetActionText function (implemented by the module). In fact, the example given in the quote from the Verbcoin manual that I posted not that long ago, specifically uses an inventory item. Provided that you're using the single-GUI setup like I've been helping you with, then you should be able to do something like this:

// game_start
// AFTER setting up the Verbcoin and its buttons....
  iRock.SetActionText(btnUse, "Eat");
  iPencil.SetActionText(btnTalk, "Chew");
  // ..etc.


If you're not using the single-GUI setup (and you're still switching between the two GUIs instead of just swapping graphics), then that would explain why it would be "resetting" as you say (which is why I told you to use the single-GUI route). I've actually been thinking about it, and the link between the GUI buttons and the custom action text is created based on the button's ID within the verbcoin, so it would actually be possible to force that to persist the custom text when the GUI is changed. The relation might not make any sense if the buttons were added in a different order, but it would be possible to keep it. That would actually require quite a bit of modifications though, so don't hold your breath.

For now the easiest thing to do is just swap out the graphics, size, and location of the GUIs for multi-coin games.
Title: Re: MODULE/TEMPLATE: Verbcoin v1.1 - 19 April 2011 - Now..some new stuff!
Post by: silverwolfpet on Thu 11/08/2011 00:51:42
How awesome can one person be? o.O Thank you very very much dude!!

One tiny issue...  The lblLocation.Text  had to be replaced with Label1.Text  (for my script).
Also, you made my "Walk to" disappear :p So I changed the script you gave me, by adding an extra "else if"


function room_RepExec()
{
{  Character *cat = Character.GetAtScreenXY(mouse.x, mouse.y);
  if ((player == cKauff) && (player.ActiveInventory == iInvItem1) && (cat == cGustav))
  {
    Verbcoin.ActiveInventoryActionFormat = "%s"; // change the format to use *only* the item name
    Label1.Text = String.Format("Hit %s with %s", Verbcoin.LocationName, Verbcoin.ActionText);
  }
  else if (Verbcoin.ActionText == null)
  {
    Label1.Text = String.Format("Walk to %s", Verbcoin.LocationName);
  }
  else   
  {
    if (cat != null) Verbcoin.ActiveInventoryActionFormat = "Give %s to";
    else Verbcoin.ActiveInventoryActionFormat = "Use %s with";
    if (Verbcoin.ActionText == null) Label1.Text = Verbcoin.LocationName;
    else Label1.Text = String.Format("%s %s", Verbcoin.ActionText, Verbcoin.LocationName);
  }
}
}


As for the inventory items, my bad, I explained in a bad way what was happening. Main idea is that you also solved the issue here. All is good now. No, actually, all is PERFECT now.

If I ever finish this game, I may have to marry you.

Title: Re: MODULE/TEMPLATE: Verbcoin v1.1 - 19 April 2011 - Now..some new stuff!
Post by: monkey0506 on Thu 11/08/2011 02:18:23
You didn't need to add an extra else if, you could have just modified the existing if statement (the one that was already checking whether Verbcoin.ActionText is null). Your logic is just a little skewed. Functionally it ends up the same, but you're just doing things kind of redundantly. Like your additional braces inside of your function. Not sure why you felt that was necessary (or indeed doing anything :=) but, in any case I'm glad you got it working.

For the record though:

function room_RepExec()
{
  Character *cat = Character.GetAtScreenXY(mouse.x, mouse.y);
  if ((player == cKauff) && (player.ActiveInventory == iRock) && (cat == cGustav))
  {
    Verbcoin.ActiveInventoryActionFormat = "%s"; // change the format to use *only* the item name
    lblLocation.Text = String.Format("Hit %s with %s", Verbcoin.LocationName, Verbcoin.ActionText);
  }
  else
  {
    if (cat != null) Verbcoin.ActiveInventoryActionFormat = "Give %s to";
    else Verbcoin.ActiveInventoryActionFormat = "Use %s with";
    if (Verbcoin.ActionText == null) lblLocation.Text = String.Format("Walk to %s", Verbcoin.LocationName);
    else lblLocation.Text = String.Format("%s %s", Verbcoin.ActionText, Verbcoin.LocationName);
  }
}


Oh, and the Verbcoin module documentation is now in the wiki (http://americangirlscouts.org/agswiki/Verbcoin_(module)), so that might help vs. the plain-text version. The table of contents actually makes a fair argument by itself as to why you might have overlooked something. :P Hopefully that will help you out.
Title: Re: MODULE/TEMPLATE: Verbcoin v1.1 - 19 April 2011 - Now..some new stuff!
Post by: Electroshokker on Tue 29/11/2011 12:50:36
Quote from: monkey_05_06 on Sun 13/02/2011 02:30:28
Hey there. I don't mean to offend (so sorry if this comes across the wrong way Elecktroshokker), but to me the verbcoin template that is distributed with AGS is somewhat of a mess. I can't tell what most of the functions are for without looking at the manual, because the naming convention is rather odd. Also, I seem to recall that none of the functions the template defines return a value, so you can't read anything back once it's been set..which seems rather unfriendly to me (writeonly??).

So I'm not here to bash the great work that Elecktroshokker has done, I'm here to present my take on the verbcoin interface. It has some similarities to the existing template, but not all of the functionality is the same between the two.

Hi there. I quite agree with you, I wrote the template long ago when I was just beginning to learn AGS. (whereas today I'm programming for a living, and would probably design the entire thing quite differently. The Picaroon interface code for instance is quite different from the verbcoin template.)

So basically: I don't mind at all, I think it's great people are taking that code and rewriting it to fit their needs. After all, it's just an example and can use much improvement, like what you've done.

Maybe once I get Picaroon - part 1 done, I'll take a closer look at your code and see if it would be useful to give you any of the improvements I made in my own code. I'll be in touch,

Cheers,

Tom
Title: Re: MODULE/TEMPLATE: Verbcoin v1.1 - 19 April 2011 - Now..some new stuff!
Post by: monkey0506 on Tue 29/11/2011 14:15:56
I'm glad you see it that way. :)

Merging any of your code directly into the module could be messy, but if there's a specific feature you'd like to see I could work on it. This module internally uses a lot of dynamic memory (through dynamic arrays), and particularly since AGS only supports single-dimension arrays, there's a lot of functions that are there just for the purpose of resizing and reallocating those arrays. The smallest of changes to those functions could make the entire module explode. :=

But I'd be more than happy to take a look at it with you sometime if you're interested.
Title: Re: MODULE/TEMPLATE: Verbcoin v1.1 - 19 April 2011 - Now..some new stuff!
Post by: Cassiebsg on Tue 08/03/2016 22:34:38
Firstly I wish to thank you for this module! (nod)

Secondly, I'll admit right off the bat that I'm code incompetent and have yet to figure more than half of the module's code. So, yes, I have NO IDEA what am doing. (roll)

On to my "problem": I have changed the verbcoin to the right button and deactivated the default walkto mouse click from the right button (cause I'm using the left button for that). So far so good, only problem is that I have yet to find out how to turn it off when in the inventory window, so that it won't pick anything up if I don't choose an option (I wish to use the left button for that). Could you point me to the line (or lines) that I need to change to accomplish the deactivation of the default when in inv window? (nod)

I've noticed the module also features some "add/remove button" stuff, could that be used for unhandled events?
I just thought this morning, that it would be cool to remove the options from the verbcoin that have no event associated instead of telling the player 100 times "You can't talk to that"... Would it be easy to do, or would it require too much code (that's beyond my current capability?)

Edit: Okay, I ended up using your snip reply to TheRoger and made my own VerbCoin, and after some work of trial and error I finally have it working like I want it now. (nod) Thanks. If anyone needs/wishes my VerbCoin code, just PM and I'll be happy to share it.