Use Input in Range - input

I recently started to work on a game(i'm a beginner) and I'm struggling with an quest system, I only want to make one quest, or maybe two, I've managed to get the QuestWindow to appear when the player is in an npc range(collider, with OnTriggerEnter), and i also have the system for quest, you can accept the quest and it is marked as active and stuff like that, but now i want to get the player to do something, more exactly, to pickup items, and i want to make something simple, like finding the object, press a key and get it, but i dont Know how can i use the Input in a Range, like, you press "E", but if you are not close enough to the object, you can't pick it up(destroy it) and count it in my quest system, Can Someone help please? I've also tried to make another OnTriggerEnter but i cant get it work because i cant use the currentAmount variable in a another script, please helpp.
[Long Story Short] How can I use Input.GetKey(KeyCode.E)) in a 10m range or something like that.
I use Unity and C#

Related

Does anyone know how to change Oak's parcel script in XSE?

So I'm making a Pokémon ROM hack using advanced map, XSE, and some other tools for the process. I'm having trouble finding the script where you actually receive the parcel in Pokémon Fire Red, and its well possible because its been done before.
I've looked all over online and cant seem to find where the script for it is, does anybody possibly know where I could find this? I understand the location number for the script may be different, I would just like to know how I could find it.

Intelij extract method keeps trying to replace duplicate method signatures - please stop

Intellij has a really neat feature, that lets me seamlessly extract a block of code into its own method. I can then give this method a nice, descriptive name and move on with life.
However, intellij also tries to find other blocks of code that are similar, and then tries to perusade me that I should also refactor them too, to use this new method its made. And then, when I hit the oddly-named "cancel" button (which implies the whole operation is cancelled, but it's not, it just stops asking about any remaining blocks), it leaves me looking at whatever the block of code it last asked me about.
I really don't like this feature. Here's why: If I'm say comparing two ints - the naming of the code block will depend on the context of those two ints, but intellij will find any comparison between two ints anywhere in that file, and then insist that this is also a candidate for extraction.
Most times it is not, and to make it worse, when I ask intellij to stop it, in a fit of pique, leaves me wherever the last comparison was, so now I have to navigate back to where I was working.
How do I tell intellij just to extract exactly what I selected, and do nothing else?
Please follow/vote/comment the issue created for this usability problem at YouTrack:
https://youtrack.jetbrains.com/issue/IDEA-233201

Howto set number to last run in intellij

What do I need to do that my saved run -configurations get numbers so that I can call them directly. I dont want to mess-around with cursor up and down.
In the following screenshot there is a "1" for run configuration (blue background) but I do not know how it came there and what do I have to search for in IntellijDoc to add numbers like 2 to other configurations. :-)
I don't think it is possible yet, what I do, is rename the configurations with a number at the beginning, i.e. 2. Test All so I can take advantage of the search feature of the run dialog for achieving almost what you want to do. In this way you are going to type a bit more, but you are not going to need to use the mouse :)

Resetting integer (DS) to 0 in Ladder Logic for PLC (Koyo's Click PLC)

I'm not sure if this is the good website for ladder logic programming questions but I will it a try.
I'm using a Click PLC C0-01 DR-D by Koyo (Desc page: http://www.automationdirect.com/adc/Overview/Catalog/Software_Products/Programmable_Controller_Software/CLICK_PLC_Programming_Software) with it's free software. I'm trying to make a program in Ladder Logic to executes multiples operations by the PLC. To keep track of the current operation, I use an integer value I'm incrementing as the current operation ID. However, I'm not able to reset this value to 0.
First I tried with the COPY but there's a radio button to ignore zeros. This radio button is checked and disabled (can't change it). . The documentation of the software says "Option: This Option is available when the Source is a Data Memory Register Address and the Destination is a TXT Address." But since I just want an ID and I need to compare this ID with = everywhere in my program and increment it, I don't want to put a string.
Then, I can use math to assign a formula to a variable. I tried put zero and it's working half the time. Note that the "One shot" checkbox isn't selected even if it may to be acting like so.
About this option, the documentation says "One Shot: Select One Shot to solve the formula only once after each OFF-to-ON transition of the enabling rung."
However, to be able to set the value to 0 again, I need to restart the PLC. When I first execute the program everything is fine because the value is already 0. When I restart it, the value didn't reset so it's still 7 and it skips all my operations. Then it resets to 0 (it's doing so at the end) and when I restart the PLC, I'm able to run it normally for one time.
Here an example of the current passing but the value not set:
Is it a bug from the PLC ? Is there a workaround ?
In short, I'm looking for a reliable way to set a value to 0.
Thanks in advance for the answers. Sorry If I violated 40 rules, I'm new and happy to join this community.
I though I resolved my problem but I just pushed it further. Thanks to Garry Shortt with his youtube channel dedicated to PLC programming for helping me out with my problem.
His explanation to the problem is "Changed the math to a copy command and placed it in the main program where you had it before. The program seems to work well.
The only thing that I can think of is when you use subroutines, and they are not being scanned. The items within the routine is the same unless you them changed in another part of your program."
Hope it will be helpful for someone someday.

On Smalltalk IDEs (Squeak, VisualWorks, etc), how can you navigate away from a message's code you're working on to inspect another?

In every IDE I've tried so far, if I'm partway through writing a message and need to look at the code of another, the browser asks me if I want to save. But if I say I do want to save, it actually tries to compile/syntax check the code, and refuses to perform the save if it does not pass. The only way to view the source of another message seems to be to say "no" to save and have everything wiped. How can I look at another class incidentally, or save code I am partway through working on that might not build right now?
Smalltalk is a multi-browser system. You'll need to have lots of different browsers open. Smalltalk is opinionated. The system browser (Nautilus) doesn't make it easy to view long methods, steering you towards writing short ones. It doesn't make it easy to have non-compiling code in a method, to steer you towards making small changes.
Experimental/prototypical code you might want to have in a Workspace/Playground. That can save to disk.
We are aware that it is an issue for people new to Smalltalk. We tried some fixes, they were a lot worse.
For now there is no easy way to do that. The two easiest opting are
Make the current method syntactically correct and save it.
Open another browser. If you want to see a class or method that is in your current code, you can cmd+click it or use "browse it", "implementors of", shortcuts that will open another window.
Also in pharo you can use GTSpotter to quickly find what you are looking for and preview its source code
When you say "this seems like a pretty huge thing to be missing,
and it could be gotten around by just having the option to use
a regular editor" I'm afraid you've entirely missed the point.
Understandable, though -- happens to us all.
Or did. Perhaps it was long ago, but we
were all there.
You might be thinking about the task in terms of
scrolling a giant text up and down to find what
you want. Scroll up -- read a little -- scroll back --
and continue making your changes.
And when you say " I can't imagine any circumstance
where it is OK, in pursuit of any agenda, to throw away
the coder's work against their will "
you are spot on correct, of course.
Imagine -- scrolling around, making dozens of little changes,
and before you've saved them -- poof -- they're all thrown away --
a mistake, perhaps, but completely against your will.
That would be awful. We're agreed.
(In fact, the editor I'm using to type this
is like that -- I can scroll around the whole thing,
making little improvements, all over, but it could
all go --poof-- and disappear, All of it.
Fairly common occurrence, when editing the web.
)
So let's try another run through that same task.
You get one little teensy, DUMB AS A POST editor,
where you can only see one thing at a time.
And now you just want to scroll somewhere else,
for a moment, and come right back.
Which actually means that
you are attempting to look up a second method,
while already changing a first method
(which would require the browser toforget the
context of the first method, and move to the second).
The browser does not know how long you will be away
from this context. You might go chaining along from
place to place, stop and read an email, take a call,
and go to lunch.
So, the browser cautions
"Hey - want to save this first?"
as if to say:
"
Hey - I can't imagine any circumstance where it is OK,
in pursuit of any agenda, to throw away the coder's work
against their will.
So listen up, coder.
You want to save this first?
"
But you can't save it.
You must first look something up.
Conundrum.
Ah-ha! There is a list of methods in that other pane.
One of them is highlighted.
Not those -- that one.
Double click that one.
The one you're already in.
As if to say
" Thanks. Good catch.
Yes, I know - can't though.
I need to change contexts.
You stay right here.
And give me another context
to go wandering about in.
please.
"
Soon, I expect, they'll start actually talking.