❔ Some image detecting thing
So, I took this script from talkai and I want to use it from the main script
https://paste.mod.gg/zonjixwvtmzk/0
Does it work with png and how do I use it from the main script? This thing is in a form and the main script is the main script.
BlazeBin - zonjixwvtmzk
A tool for sharing your source code with the world!
71 Replies
You have to create an instance of the form and then call
FindMatchingImage
on it.And how can I integrate that in my code?
It tells you there?
By not asking chatgpt of all things
did you create a new winform project from here?
its Visual Studio
I use Rider
ah rider cant create a winform project?
But I use windows forms
it can
through a template
because its suppose to generate some code in Program.cs
creates some code, yes
there is suppose to be something like
Application.Run(new Form1());
in the Program.cs
which basically will run your form instance when the app runsuhh
I have that
The template start thing is that
can u comment out line 26 and run ur program?
does a form open?
what is UI.MyFunction is it a method u created?
yes
a yellow square
can u show me that method
ok so
FindMatchingImage
is part of Form1
not Form
it looks like ur app only opens for 2 seconds then closes, correct?yes, because I set it in the function
BlazeBin - zonjixwvtmzk
A tool for sharing your source code with the world!
isnt this ur problem atm?
my problem is this atm
Ui.MyFunction thing is totally ok
so whats the problem in that code?
BlazeBin - zonjixwvtmzk
A tool for sharing your source code with the world!
??
whats the problem in this code?
well, I want to make a function that does this code process
and use it in the main script
do it then
but I dont know how to
imagine ur calling a method called
Walk()
who exactly will Walk?method
a human? a bear? and which human
human
which human tho
imagine a game, where there are 1000 humans
human number 1
exactly
right now ur trying to call the
FindMatchingImage
method
but it doesnt know who will do that actionso I need to make a class?
No, that action belongs to Form1 class, correct?
yes
so you dont need to make one
I meant static class
line
like that
or?
well no, because you require the form to call its messagebox
oh, I need to make the function public
well thats 1 fix
Form1 is already a class thing?
u see this code in ur detect position.cs
doing
BackColor = Color.Yellow;
wont work
it needs to know which object to change its backcolorclose, but Form1 here is like a blue print
of an object
like
class of a class?
no, Form1 is the class
like Human, human is a class
and you're an instance of a Human
doing Human.Walk() wouldnt make sense, because Human here is a type
see this code for example
its
form.BackColor = Color.Yellow;
not Form.BackColor = Color.Yellow;
yes
I need to make it not capital?
that's not the issue, form is an object of Form
because of this line
Form form = new Form();
imagine we are in a gameI think I dont have that line in the script
i literally copy pasted it from ur code
in the other one
well ofcourse, the reference of your new form is in the detect position.cs
so it would make sense to call your method in that file
how?
like this
form.FindMatchingImage();
this is calling a method of an instance
note that
i am really busy right now so how about going through the fundamentals in the links below $helloworldWritten interactive course https://learn.microsoft.com/en-us/dotnet/csharp/tour-of-csharp/tutorials/
Videos https://dotnet.microsoft.com/learn/videos
.
its not a global variable, its a local variable
when you say
My PC
ur obviously refering to your own computer right?
the variable only exists within its scope in the detect position.cs
anyway g2g, those links above will help youThats what I can only make
it's a
new Form1()
you would need, not a new FindMatchingImage()
Did you work through the course that was linked above? As it seems a bit like you're stumbling through things rather than understanding how they all piece togetherI didnt see the same thing from the links above
There won't be strictly the same thing in there, I think the point was you probably need to try and learn the fundamentals of C# first to get an understanding of how things work, as you're kind of jumping around/asking chatgpt for things that you don't fully understand and getting a bit lost in it all
Yes, but I think I already know the fundamentals on like 30% of all
ok, well, good luck
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.