Game authors and players, please read this thread!

Author Topic: The ultimate Cursor [Solved]  (Read 1227 times)  Share 

« Last Edit: 11 Jul 2012, 15:55 by Caracal »

Re: The ultimate Cursor
« Reply #1 on: 06 Jul 2012, 15:05 »
One thing I'm doing with my game now is putting this in rep_exec in  room script

if (Hotspot.GetAtScreenXY(mouse.x, mouse.y) == hwillsign){
mouse.Mode=eModeLookat;} //Where hwillsign is the scriptname for that particular hotspot)
else if (Object.GetAtScreenXY(mouse.x, mouse.y) == odoor && gInventory.Visible==false){
mouse.Mode=eModeInteract;}
else { mouse.Mode =eModeWalkto;}
}
and I'm using only one cursor...a white crosshair  which turns green if it's over a point of interest and I disabled right click. So walking and interacting etc. is all done with left clicking only. Maybe there's a much better way to achieve this but that's the way I did it and it works great. I guess Khris has something to say about this though (He do have better solutions to most things I've noticed) so bring it on man ;)
For that other question. Couldn't you have a label within the GUI where you display the dead character and have it randomize different texts? (If i understand you correctly)
« Last Edit: 06 Jul 2012, 15:21 by Mouth for war »
mass genocide is the most exhausting activity one can engage in, next to soccer

Khris

  • Evil Dark Emperor Death-Kill
    • Lifetime Achievement Award Winner
    •  
    • I can help with play testing
    •  
    • I can help with scripting
    •  
    • I can help with translating
    •  
Re: The ultimate Cursor
« Reply #2 on: 06 Jul 2012, 15:30 »
I sure do :-D
Things as these are NEVER done on a per-room basis. Code for each and every object and hotspot? Good night.

Lookie here for a very similar solution: http://www.adventuregamestudio.co.uk/yabb/index.php?topic=46367.0
http://whathaveyoutried.com/

The other day on yahoo answers:
"Can you print colored images with black ink? If so tell me how please Thanx Kimberly"

Re: The ultimate Cursor
« Reply #3 on: 06 Jul 2012, 18:50 »
damn Mr. know it all...;) yeah that's ALOT better...I'm just doing stuff on my own so I'm still learning too hehe.
mass genocide is the most exhausting activity one can engage in, next to soccer

Re: The ultimate Cursor
« Reply #4 on: 06 Jul 2012, 18:52 »
I sure do :-D
Things as these are NEVER done on a per-room basis. Code for each and every object and hotspot? Good night.

Lookie here for a very similar solution: http://www.adventuregamestudio.co.uk/yabb/index.php?topic=46367.0

@ Krhis :
"GlobalScript.asc(70): Error (line 70): '.GetLocationType' is not a public member of 'Game'. Are you sure you spelt it correctly (remember, capital letters are important)?"
is what AGS tells me as soon as i give in the suggested function in the threat you pointet out.
I have decited to do the following: i crossed out this function:
else if (button == eMouseRight || button == eMouseWheelSouth){
    // right-click our mouse-wheel down, so cycle cursor
   // mouse.SelectNextMode();                                                 // this is what i crossed out for the cursorwheel
  }
I left the other modes as they are (the player can not reach them since he can not leave the walk mode. Can i now basically change the symbol of the Walk icon... and put over every hotspot "any click on object/hotspot/character" the event i want.
This way I should archieve the same result, right??

And @ mouth of war:
Thanks for the idea. But for the death panel i always want the same things to be displayed, the Protrait is always going to look alike. Only the things, that the portrait says are diffrent, depending on the occured death scene.

Re: The ultimate Cursor
« Reply #5 on: 06 Jul 2012, 19:06 »
Oh i just noticed that my idea is not the smartest since the game will not properly work.
If i just rename the "walkto" button the game will be screwed unless i change every single "walkto" in the global script. The entire defaultgame is based on the idea of cursorchanges.

Frito Master

  • 0% Trans-Fat 100% Toxic
    • I can help with animation
    •  
    • I can help with backgrounds
    •  
    • I can help with characters
    •  
    • I can help with voice acting
    •  
Re: The ultimate Cursor
« Reply #6 on: 06 Jul 2012, 19:26 »
If you search there is a module that works fine, I think its called single cursor.
Your favorite brandname chip friend.

Re: The ultimate Cursor
« Reply #7 on: 06 Jul 2012, 20:15 »
If you search there is a module that works fine, I think its called single cursor.
Modules are not working for me... I just dont know how to use them if i havent set the skripting up myself i wont learn how to do it by myself next time! ;_;

Frito Master

  • 0% Trans-Fat 100% Toxic
    • I can help with animation
    •  
    • I can help with backgrounds
    •  
    • I can help with characters
    •  
    • I can help with voice acting
    •  
Re: The ultimate Cursor
« Reply #8 on: 06 Jul 2012, 20:17 »
You could look at the module's code? Learn from that.
Also installing them is as easy as right clicking script and import.

Edit:

Linky

http://www.adventuregamestudio.co.uk/yabb/index.php?topic=44421
« Last Edit: 06 Jul 2012, 20:28 by Frito Master »
Your favorite brandname chip friend.

Khris

  • Evil Dark Emperor Death-Kill
    • Lifetime Achievement Award Winner
    •  
    • I can help with play testing
    •  
    • I can help with scripting
    •  
    • I can help with translating
    •  
Re: The ultimate Cursor
« Reply #9 on: 07 Jul 2012, 07:32 »
"GlobalScript.asc(70): Error (line 70): '.GetLocationType' is not a public member of 'Game'. Are you sure you spelt it correctly (remember, capital letters are important)?"
Fixed the code in the other thread. Just remove the "Game." part.
http://whathaveyoutried.com/

The other day on yahoo answers:
"Can you print colored images with black ink? If so tell me how please Thanx Kimberly"

Re: The ultimate Cursor
« Reply #10 on: 07 Jul 2012, 15:48 »
Ah at the first look it seems to work, i will double check this later. Greater problems have developed (as you can see in the "black pixel" threat) ;-P
But i thiank you!!!

Re: The ultimate Cursor
« Reply #11 on: 08 Jul 2012, 16:15 »
One itsy bits problems remains:
When i click on a (for example) hotspot then the triggered event occures twice for some reason.
I used "any click on object", rather then "when player looks at object" since this is obsolet.

Khris

  • Evil Dark Emperor Death-Kill
    • Lifetime Achievement Award Winner
    •  
    • I can help with play testing
    •  
    • I can help with scripting
    •  
    • I can help with translating
    •  
Re: The ultimate Cursor
« Reply #12 on: 08 Jul 2012, 18:29 »
All my code does is switch mouse.Mode.
The "any click on" event is triggered even if another event, for instance "interact with", has already been executed, maybe thats the reason for the duplication.

You don't need to use "any click on" though; just use the regular event interact/talk to event.
http://whathaveyoutried.com/

The other day on yahoo answers:
"Can you print colored images with black ink? If so tell me how please Thanx Kimberly"

Re: The ultimate Cursor
« Reply #13 on: 09 Jul 2012, 10:51 »
You don't need to use "any click on" though; just use the regular event interact/talk to event.
Well the problem is, if i put this code into my script:
function repeatedly_execute() {
 
  int mm = mouse.Mode;                                                      // Ultimate Cursor code from Krhis!!!
  int lt = GetLocationType(mouse.x, mouse.y);
  int nm;
  if (lt == eLocationHotspot || lt == eLocationObject) nm = eModeInteract;
  else if (lt == eLocationCharacter) nm = eModeTalkto;
  else nm = eModeWalkto;
  if (nm != mm) mouse.Mode = nm;

-the code you created. and i trigger "any click on object (or hotspot)" then the event occures twice. If i trigger "look at object/hotspot" then nothing happens at all. So only any click on object works and this even twice. Looking at the mouse code i cant see how or why this happens, since everything (as far as i am able to understand) just focuses on the cursor.

ThreeOhFour

  • Order of the Maggot
  • AGS Baker
  • Wild colonial boy.
  • ThreeOhFour worked on a game that was nominated for an AGS Award!ThreeOhFour worked on a game that won an AGS Award!
Re: The ultimate Cursor
« Reply #14 on: 09 Jul 2012, 11:46 »
That code doesn't reference the eModeLookat anywhere, all it is doing is switching it to the Interact mode over a hotspot or an object, the Talkto mode over a character and the Walkto mode when it's not over any of these.

Therefore, instead of trying to trigger looking or any clicking, you should be using the talking function on characters and the interact with function on object and hotspots.

Khris

  • Evil Dark Emperor Death-Kill
    • Lifetime Achievement Award Winner
    •  
    • I can help with play testing
    •  
    • I can help with scripting
    •  
    • I can help with translating
    •  
Re: The ultimate Cursor
« Reply #15 on: 09 Jul 2012, 14:41 »
Yes, and for this to work properly, in on_mouse_click / eMouseRight, instead of switching to the next cursor mode, you should call ProcessClick(mouse.x, mouse.y, eModeLookat); (or is it eModeLook? I can never remember.)
Now, just to make sure: DON'T USE THE "ANY CLICK ON..." EVENT.

And until you post the code in your room script, we can only guess where the error is.
http://whathaveyoutried.com/

The other day on yahoo answers:
"Can you print colored images with black ink? If so tell me how please Thanx Kimberly"

Re: The ultimate Cursor
« Reply #16 on: 10 Jul 2012, 17:39 »
Yes, and for this to work properly, in on_mouse_click / eMouseRight, instead of switching to the next cursor mode, you should call ProcessClick(mouse.x, mouse.y, eModeLookat); (or is it eModeLook? I can never remember.)
Now, just to make sure: DON'T USE THE "ANY CLICK ON..." EVENT.

And until you post the code in your room script, we can only guess where the error is.

Now wait. i am suppose to put this into the room script?
I thought i had to go to the globalscript.asc under the "repeadeately executed" function???!!

Re: The ultimate Cursor
« Reply #17 on: 10 Jul 2012, 17:39 »
That code doesn't reference the eModeLookat anywhere, all it is doing is switching it to the Interact mode over a hotspot or an object, the Talkto mode over a character and the Walkto mode when it's not over any of these.

Therefore, instead of trying to trigger looking or any clicking, you should be using the talking function on characters and the interact with function on object and hotspots.
Ok. that was a helpful hint! Thank you, now that i use interact (rather than look at) on a hotspot it works. BUT the event is still triggered twice. How does that work???

ThreeOhFour

  • Order of the Maggot
  • AGS Baker
  • Wild colonial boy.
  • ThreeOhFour worked on a game that was nominated for an AGS Award!ThreeOhFour worked on a game that won an AGS Award!
Re: The ultimate Cursor
« Reply #18 on: 10 Jul 2012, 18:41 »
1. Do you still have "Any click" mode active? This could be a reason.
2. Do you have mouse clicks detected in the repeatedly_execute function AND the mouse click function? This could be a reason.

The most efficient way to get help is to show us your code. We're guessing blindly if you only tell us the symptoms. For us to give you comprehensive assistance you will need to find the following pieces of code and paste them in here so that we can see them:

-Your entire repeatedly_execute function from your global script.
-The entire contents of your repeatedly_execute_always function (unless you have nothing in there), from your global script.
-The entire contents of your on_mouse_click function, also from your global script.
-The entire contents of your hotspot/object interact function from your room script.
-The entire contents of your hotspot/object any click function from your room script.

These are all possible areas in which the error could be occurring, depending on what code you've written. Details are essential in order for people to assist you.

Khris

  • Evil Dark Emperor Death-Kill
    • Lifetime Achievement Award Winner
    •  
    • I can help with play testing
    •  
    • I can help with scripting
    •  
    • I can help with translating
    •  
Re: The ultimate Cursor
« Reply #19 on: 10 Jul 2012, 22:00 »
Now wait. i am suppose to put this into the room script?
I thought i had to go to the globalscript.asc under the "repeadeately executed" function???!!
Sure, but the hotspot event functions are in the room script, aren't they?
I just wanted to take a look at the contents of your hHotspot_Interact, hHotspot_AnyClick, etc. functions.
http://whathaveyoutried.com/

The other day on yahoo answers:
"Can you print colored images with black ink? If so tell me how please Thanx Kimberly"