string.RunInteraction

Started by Martyn, Thu 05/11/2015 20:49:20

Previous topic - Next topic

Vincent

:offtopic:

I'm not encouraging anyone to a bad behaviour as you claim.
Rather, I support all of you who say that need to be clear as well when you are intended to ask a question.
I want only to make you understand that what you asked could be answered shortly.

Because
Quote from: Martyn on Thu 05/11/2015 22:35:04
Right now i pick up the name like this in a string!
Code: ags
location = Game.GetLocationName(mouse.x, mouse.y); 


After he probably added a new global variable String called 'myHotspot'
Quote from: Martyn on Fri 06/11/2015 16:35:01
Code: ags
myHotspot = Game.GetLocationName(mouse.x, mouse.y);

This works almost the way i want.


Quote from: Martyn on Fri 06/11/2015 16:35:01
Code: ags
myHotspot = Hotspot.GetAtScreenXY(mouse.x, mouse.y);

This get error, can not convert hotspot* to int or string! ???

Actually, Im not wonder what 'myHotspot' is, except the clarity of his intentions.

Snarky

Yes, what CW said. A good technical question starts by explaining WHY you're doing what you're trying to do. I just saw this example from a reference librarian (whose job it is to help people find information they're looking for):

Bad way to ask for help: "Where are the books about dogs?"
Good way to ask for help: "Hi, I'm starting a dog grooming business and I need information on the local market for my business plan."

It should be obvious (though clearly it isn't), and it doesn't take any technical expertise to do.

For the technical part, post the code you've tried that isn't working IN CONTEXT. Not just a single line, but the code around it, the variable declaration, the functions it's trying to call, etc. Post the error message you get, too. If you had done that, I'm sure we would have found your mistake right away. (Although even after you've solved it, it's not exactly clear what the problem was, making this thread useless for anyone else who might be having similar difficulties.)

Anyway, lots of people don't follow this simple advice. What really got me mad was that you kept ignoring us when we asked you about it over and over:

Quote from: Snarky on Thu 05/11/2015 21:19:53maybe explain what you're trying to achieve?
Quote from: Khris on Fri 06/11/2015 11:12:39
Martyn, please describe in a general, non-tech way the game mechanic you want to implement.
It's probably something quite simple, for which there exists a simple, well-known solution.
Quote from: MiteWiseacreLives! on Fri 06/11/2015 16:40:33
is myHotspot a String, Int or a Pointer  ??? ??? ???
Please explain what you are trying to accomplish, then someone could help you quite easily I'm sure.

You never answered this; never even acknowledged the question. That is just damn rude when people are trying to help you.



Quote from: Vincent on Sat 07/11/2015 09:56:58
I want only to make you understand that what you asked could be answered shortly.

Yes, I assumed (after the first couple of rounds of confused questions) that his immediate problem was that he'd defined myHotspot as a String instead of a Hotspot*, but changing that wouldn't be enough if the method in the GlobalScript expected a String. Which is why a fuller explanation of his process was necessary. I don't see how defining a global String variable would solve this problem anyway, so I'm actually skeptical that he has fixed the problem correctly.

Vincent

Quote from: Snarky on Sat 07/11/2015 10:29:03
Yes, I assumed (after the first couple of rounds of confused questions) that his immediate problem was that he'd defined myHotspot as a String instead of a Hotspot*, but changing that wouldn't be enough if the method in the GlobalScript expected a String. Which is why a fuller explanation of his process was necessary. I don't see how defining a global String variable would solve this problem anyway, so I'm actually skeptical that he has fixed the problem correctly.

Yes, I think so too indeed.
A fuller explanation of the process that you are intended to achieve is compulsory.
In this way you allows people in the community to help you properly.
Also, this would avoid as well someone that have your same problem to collapse in a no achievement thread.
Because the goal to be achieved is not clear.

Martyn

#23
Sorry for the confusing mess!

I should have been more distinkt when the problem was solved att the reply 3 and 7!
I miss them att first! And then clerd out that the first question was not the real problem here:
QuoteIs it possible to change "hotspot[0]" in to a string name?
More like this:
QuoteI can not pass my string from the room in to the Global Script.

Yesterday i was at the school and could only write shortly, not as you guys, i'm impressed!
You are amazing here att AGS! :grin:

here is a description:

One click att a hotspot, A GUI windows poppups, in that window ther is a few moment and choises to do, and when the GUI is close, it go back and  run the rest of the script in that hotspot.

The problem was that ther was no myHotspot to run myHotspot.RunInteraction with.
with help of Vincent tip of Global variabels and AGS manuals i get it to work.

Now it locks lik this and myHotspot goes over Global variabels:
Code: ags
hotspot[myHotspot].RunInteraction(eModeInteract);

It work perfect and I certainly think it can be solved in other ways too! :-)

Has difficult to explain in English from the beginning, so i'm definitely not gonna try again! :wink:
What can I say, sorry!

MiteWiseacreLives!

Wow, I'm surprised that actually works.
I would use the hotspot number or (more neatly) a pointer... but if it works with a String, party on ;)
Quote
After he probably added a new global variable String called 'myHotspot'
I can make pretty good guesses too, Vincent, but probably doesn't hold much water when trying to help with scripting.
I know your only being helpful, sorry I let this get me upset.  :)

Vincent

Quote from: Vincent on Fri 06/11/2015 18:30:02
Should not be that hard to guess :D

This was a humorous saying about the context unclear.
My intention was not to offend you or anything else.
I'm sorry you did misinterpreted it.

Quote from: MiteWiseacreLives! on Sat 07/11/2015 16:34:31
I can make pretty good guesses too, Vincent

Stupot+ should arranges the next tournament because I'd like to challenge you (jokes) :)


Crimson Wizard

Quote from: Martyn on Sat 07/11/2015 14:08:31
Now it locks lik this and myHotspot goes over Global variabels:
Code: ags
hotspot[myHotspot].RunInteraction(eModeInteract);

It work perfect and I certainly think it can be solved in other ways too! :-)
Quote from: MiteWiseacreLives! on Sat 07/11/2015 16:34:31
Wow, I'm surprised that actually works.
I would use the hotspot number or (more neatly) a pointer... but if it works with a String, party on ;)

It should not work with String.
Either myHotspot is an integer, or there is a bug in AGS script compiler. I would suggest testing whether this works with all hotspots before continuing.

SMF spam blocked by CleanTalk