Please login or register.

Login with username, password and session length
Advanced search  


IRC channel - server:  channel: #wme (read more)

Author Topic: Customised Captions  (Read 1662 times)

0 Members and 1 Guest are viewing this topic.


  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 8
    • View Profile
Customised Captions
« on: September 04, 2009, 10:59:31 PM »

This is going to seem like a really dumb question, and I apologise if this is in the manual somewhere, because I can't find it in there anywhere.

I am currently using the standard set-up for the 'action/verb' menu, with no changes to the 'look at', 'pick up' and 'talk to' buttons (other than new graphics).

I can see that there is a text box that displays 'caption' in the WindowEdit view, which when viewed in game displays the 'caption' field of the item you have right clicked on (e.g. So when I right click on a cup, the text box object below my action window states 'cup').

What coding would I need to use and within which script, so that when I right click on my 'cup' item and then hover over my 'look at' button, the caption text box object no longer just reads 'cup', but would now say 'look at cup'?

I can use the 'caption' field on each of the 'look at' 'pick up' and 'talk to' buttons to display the correct 'Look at...' e.t.c, but without it including the name of the item at the end of the caption.

I hope this makes sense to someone and that some kind soul out there will be able to point me in the right direction.


  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Customised Captions
« Reply #1 on: September 07, 2009, 01:21:19 PM »

You'd need to attach a script to each of the buttons. The script would contain a "MouseEntry" handler.
Sor example the Look At button would contain something like this (untested):

Code: WME Script
  2. // this variable is filled with the correct object by game.script; we'll just use it
  3. global MenuObject;
  5. // same with menu window
  6. global WinMenu;
  8. on "MouseEntry"
  9. {
  10.   if(MenuObject != null)
  11.   {
  12.     var CaptionText = "Look at " + MenuObject.Caption;
  14.     // now we need to display the caption somewhere
  15.     // we'll ask the menu window for a control called "caption"   
  16.     var CaptionControl = WinMenu.GetControl("caption");
  17.     CaptionControl.Text = CaptionText;   
  18.   }
  19. }
  22. on "MouseLeave"
  23. {
  24.   // clear the caption when the mouse moves outside the button
  25.   var CaptionControl = WinMenu.GetControl("caption");
  26.   CaptionControl.Text = "";
  27. }
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave


  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 8
    • View Profile
Re: Customised Captions
« Reply #2 on: September 07, 2009, 08:59:51 PM »

I'm sure you hear this all the time Mnemonic, but you are an absolute genius! I wouldn't have known where to start with this one.

I've made one small change, by making it return to the standard object caption, rather than becoming blank, but other than that, it works brilliantly!

Page created in 0.222 seconds with 23 queries.