Displaying a message after a walk cursor click

Started by Goldsmith, Mon 13/09/2004 02:54:01

Previous topic - Next topic

Goldsmith

Is it possible to make the walk cursor display a message after being used in a specific situation? Something like the look cursor for example.

Let's say we have the edge of a chasm in a room. The walkable area only extends to the edge. Whenever the character tries to "walk" to the chasm, I want a message displayed saying "You shouldn't try that" or something to that effect. I tried making the chasm a hotspot and then, using the interaction editor, I had it display a message for "any click on hotspot", under which I put a conditional - "cursor mode is 0" (0 being my walk cursor), but the message won't display that way.

Edwin Xie

#1
Hmm, and easier way to do that would be setting a hotspot as the chasm and then put the message under "any click on hotspot" on the chasm interaction menu or, add a region on the area of the chasm and put the message under "Walk onto region".
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

Goldsmith

Thought of that.
The problem with the hotspot suggestion is that I want to have other interactions with the chasm: looking at it, trying to talk to it, and later using an inventory item on it.
The problem with the region suggestion is that you'd actually have to be ON the chasm in order to see the message, so you'd probably fall down and by the time you could see it  :)

I realize that I could put a small region on the edge and have the message displayed there, but I wanted to know if there's an answer to my original question.

Barbarian

#3
I had a similar problem with a part of my game (when a certain event happened, I did not want the character to be able to walk on or go to a certain area.), and one of the tricky things is that Walk Mode doesn't register as a normal "interactive type of click" with various objects, hotspots, etc...

But, here's what I did under that room's "Repeatedly Execute". I had it set so if a varible I wanted was set to a certain value to run as script... here's a snippit of my script, and it check's if the user has clicked on HotSpot number 1 while the cursor is still in walk mode, and if so to make the character stop walking and to display a message:

Code: ags

ifÃ,  ((GetHotspotAt(mouse.x, mouse.y) == 1) && (GetCursorMode()==0) && (IsButtonDown(LEFT)==1)){
Ã,  
Display("That place is too dangerous. I can't walk there.");

StopMoving(EGO);  
}



I know it's not a perfect script (as I'm still a "newbie" in many ways in regards to scripting and such), but it may be what you're looking for?

Let me know if it works for ya. If not, I have some other ideas too.Ã,  :)
Conan: "To crush your enemies, see them driven before you, and to hear the lamentation of the women!"
Mongol General: "That is good."

Blade of Rage: www.BladeOfRage.com

Edwin Xie

#4
But then it would be very hard. You would have to set a global variable if the user changes to the "walk" cursor like:

if (GetCursorMode() == MODE_WALK){
int whetheryouusedmodewalkornot = 1;
}

And 1 would equal that you used mode walk and 0 means you didn't use use mode walk. And then you could put the following code after "any click on hotspot":

if (whetheryouusedmodewalkornot == 1){
Display("You shouldn't try that.");
}
EDIT: Bah, I did not know why it took too long for me to do this.
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

Barbarian

You don't need to set any global variables to use that script.

Just put it in a room's "Repeatedly Execute" part in a script. It works for me.
Conan: "To crush your enemies, see them driven before you, and to hear the lamentation of the women!"
Mongol General: "That is good."

Blade of Rage: www.BladeOfRage.com

Edwin Xie

#6
I see, but they both focus on GetCursorMode = 0..... Let me take a minute to review your script.......
What's with the "IsButtonDown(LEFT) == 1"?
And you could put "StopMoving(EGO);" before the message. That would make more sense.
And uh, I don't get what mouse.x and mouse.y is used for.
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

Barbarian

#7
Quote from: Edwin Xie on Mon 13/09/2004 05:12:29
I see, but they both focus on GetCursorMode = 0..... Let me take a minute to review your script.......
What's with the "IsButtonDown(LEFT) == 1"?
And you could put "StopMoving(EGO);" before the message. That would make more sense.

Okay, in my game the (GetCursorMode()==0), where mode 0 is equal to my walk mode, you could however try to replace that with (GetCursorMode()==WALK_MODE)Ã,  if you changed the mode-number of your walking (or change to the mode number of your game's walking mode).

The (IsButtonDown(LEFT)==1) checks to see if it was a left-mouse-click. Otherwise, if omitted that part of the script, then simply moving your cursor-in-walk-mode over the hotspot would repeatedly keep giving you the message (essentially locking up your game), and you only want the message to be displayed when the button is clicked in-walk-mode on your hotspot right?

Yes, you could try putting the StopMoving(EGO);Ã,  before and/or after the message. Experiment and see what gives you the best results.Ã,  Give it a try, and see if it works. It may need a little tweaking to get the best results for you, but, for me the script works fine.

The (GetHotspotAt(mouse.x, mouse.y) == 1)  checks to see if the mouse-cursor is currently in position over top of hotspot 1 before you click on the hot-spot.
Conan: "To crush your enemies, see them driven before you, and to hear the lamentation of the women!"
Mongol General: "That is good."

Blade of Rage: www.BladeOfRage.com

Edwin Xie

Quote from: Barbarian on Mon 13/09/2004 05:29:24
....The (IsButtonDown(LEFT)==1) checks to see if it was a left-mouse-click. Otherwise, if omitted that part of the script, then simply moving your cursor-in-walk-mode over the hotspot would repeatedly keep giving you the message (essentially locking up your game), and you only want the message to be displayed when the button is clicked in-walk-mode on your hotspot right?....

Still, how would it repeatedly keep giving you the message and how would (IsButtonDonw(LEFT) == 1) stop it? Sorry if I am asking questions like a "newbie" but I am not very familiar with scripts.
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

Alynn

Strange I have plenty of areas that I use this in.... Oh! one question... do you have Don't automaticly move in walk mode checked? Maybe thats why it works for me as I had to make moving handled by scripting, I had to set it this way to get the effects like you talk about...

Barbarian

#10
Quote
Still, how would it repeatedly keep giving you the message and how would (IsButtonDonw(LEFT) == 1) stop it? Sorry if I am asking questions like a "newbie" but I am not very familiar with scripts.


I know, scripts are tricky to understand sometimes. I'm still learning a lot about it too.

Okay, try and carefully read my messages, as all of the answers to your questions are right in front of you. Ã, ;)

But, you only want the message to be displayed when you actually click on that hotspot while the cursor is in your walk mode right?

And, as the script is to be included under the "Repetedly Execute" part of that room's script, then if you don't check for the mouse click, Ã,  (IsButtonDown(LEFT) == 1) Ã,  , then simply moving the cursor over top of the hotspot while in walk mode would repeatdly give you the message over and over and over.... pretty much locking up the game.

Here's how to include it in your room's Repeatdly Execute script.


In the AGS editor, Ã, from the Room Editor, select your room to edit that you want to run this script in.

Then from "Settings" area, towards the top menu-button you'll see a big "i" button (interactions). Click on that button. It opens up an "interaction editor" window with lots of options. Scroll down untill you see the "Repeatedly Execute" line. Then Right-Click on that and choose "New Action". From there, a new window will appear in which you can select from a drop-down menu of various actions. Select "Run Script". then "Ok", then click "Edit Script" and a Script Editor window will open. Copy and paste the code I gave above into your script. Then from the menu select "File" then "Exit and save changes" then click on the "Close" button. And then test out your game. Ã, ;D Ã,  I don't know if I can make it any clearer than that. Good luck.
Conan: "To crush your enemies, see them driven before you, and to hear the lamentation of the women!"
Mongol General: "That is good."

Blade of Rage: www.BladeOfRage.com

Phemar

Quote from: Goldsmith on Mon 13/09/2004 02:54:01
Is it possible to make the walk cursor display a message after being used in a specific situation? Something like the look cursor for example.

Let's say we have the edge of a chasm in a room. The walkable area only extends to the edge. Whenever the character tries to "walk" to the chasm, I want a message displayed saying "You shouldn't try that" or something to that effect. I tried making the chasm a hotspot and then, using the interaction editor, I had it display a message for "any click on hotspot", under which I put a conditional - "cursor mode is 0" (0 being my walk cursor), but the message won't display that way.

I'm using this as for my game. Set cursor 9 (or 8) to Walk to, and then in mouse_click check if cursor mode is 9, then cjeck if the interaction is available for cursormode, process click, else Move the Chracter to mouse.x, and mouse.y

Then under Walk to in the interaction editor, just put the code, or leave it blank.

Quite simple actually.

Mr Jake

#12
you dont you just put a really thin region around the edge of the chasm and when he stand on it have him display and message and then walk back... Just in the interaction editor.

Player walks on Region
-Character - stop character walking
-Game - DisplayMessage(#)
-Character - move character

Barbarian

Quote from: Hotspot on Mon 13/09/2004 09:20:03
you dont you just put a really thin region around the edge of the chasm and when he stand on it have him display and message and then walk back... Just in the interaction editor.

Player walks on Region
-Character - stop character walking
-Game - DisplayMessage(#)
-Character - move character

Yes, that's the other way I tend to do it do.  ;)  Though don't make the region too "thin" or the character may walk right over it depending on the character's walk settings.
Conan: "To crush your enemies, see them driven before you, and to hear the lamentation of the women!"
Mongol General: "That is good."

Blade of Rage: www.BladeOfRage.com

Moox

I would do what hotspot said, thats how I manage it

Goldsmith

Barbarian's solution was the one I was looking for.

Of course, it remains to be seen whether or not that solution will conflict with the room's further development. If it does, I'll probably go for the region idea.

SMF spam blocked by CleanTalk