Okay, here's another problem I'm working on at the moment:
In my game, I have a verb coin GUI and a status bar, normally displaying @OVERHOTSPOT@, but when the cerb coin is up, it displays "Look at <object>", "Talk to <object>" or "Use <object>".
So far everything works well, but in some cases, these phrases aren't suitable, 'talk to' should become 'eat' when clicking on an apple, 'use' should become 'pick up' etc.
I'm using three global strings to achieve this, but these have to be set before bringing up the coin. For hotspots, this is done in the 'mouse moves over hotspot' section, but for characters and objects, there isn't any such function. For some reason, 'any click on hotspot' is only triggered after the actual look/talk/use action is finished, so setting the Global strings in there didn't help either.
This is where my suggestion comes in:
either a "mouse moves over character" and "mouse moves over object" action, or an option to make 'any click on' execute before anything else happens.
I hope you understand what I mean. Any comments? Or is there another way to do it that I don't see at the moment?
I think you can currectly check them in the rep. exec text script. But yes, maybe adding such interaction triggers can be a good idea.
I'm not sure if they're really useful though.
Yeah, I found a workaround: I run a custom function CheckForObject() that checks whether at the mouse coordinates there is an object and detects which one by running if room == ? and if object ==?. It's a bit tedious, but it does the job.
Hit me with a kipper and call me stupid, but why can't you set these up at the beginning of your code that brings up the coin?
I probably haven't understood quite how your interafec works...
Of course I could detect which hotspot/object/character the mouse is over and how they would alter the interaction text in the coin function, but imagine how the code would look if I did that for every single hotspot, character and object in the game :-\
I think what SSH is suggesting is that you have something like:
function CoinOn () {
// detect what the mouse is over and set the label
GUIOn (VERBCOIN);
}
and you use that to switch the coin on when they click the mouse.
You can use GetLocationName to get the name of whatever is there, you don't need lots of "if room == X" type checks.
Well, cover me with flour and eggs and bake me for 40 minutes, CJ not only described the solution far better than I did, but he pointed out the handy GetLocationName function. You'd think that he wrote AGS or something. I had a feeling there was a function like that, but I couldn't find it with a quick look.
I was obviously far too busy thinking of an amusing introduction to the post to be that useful. AT least Dragonrose quoted me
;D
And it was a very worthy introduction, so no worries ;)
Hey, thanks for your replies, but it looks like I didn't get my point across properly, so I'll try to state it clearer:
As soon as the coin is up, my status bar consists of two elements: the location name (found by GetLocationName) and a special interaction text, "Look at", "Talk to" and "Use" by standard. However, this interaction text is not fixed but stored in three global ints to enable certain hotspots, objects and characters to change them. That way, the window hotspot changes the Global String for "Use" to "Open" in the "mouse moves over hotspot" section, so that the correct text "Open window" is shown when the coin is up and the mouse is over the use button.
However, Objects and Characters don't have this "mouse moves over" section, so I have to run my CheckForObject custom function every time the right mouse button which brings up the coin is clicked. Now it's not enough to know the location name, but the correct room and object number to know which interaction text has to be changed to which new string.
At the moment this is working, but the more rooms and objects there will be in that game, the messier the code will look like. Thus, I suggested the "mouse moves over object" and character sections.
I hope I'm making more sense this time.
Cheers,
Thunder
I am not sure if it'll help but what about calling ProcessClick(mouse.x, mouse.y, 9); to trigger any_click event first. I assume mode 9 isn't used for anything. So the any click event whould be called two times: before and after normal interaction event.
-Cheers
Ah, I see - ok, suggestion noted, thanks.
Hey Scorpious, I tried triggering it using ProcessClick with cursor 8 (also unused) yesterday, and it works just fine! Yippee!
So - if the mouseover functions are to be implemented, I wouldn't consider them high priority anymore, as noone ever seemed to need them except me.