C
C#8mo ago
Rofus-_-

❔ Big Problem in C# plz someone help

so i'm new to coding (just so you know so if you say something to advanced i will maybe not know what it is) and i have made or making a a movement for the mouse to go down with basiclly when i left click i want my mouse to go down and rn the code is about 3600 lines and i got some big problems that no one really haces on the internet or at least what i can find, this is the problems in one of the codes:
void OnEvent(string eventName, int arg)
{
//guner 5
if (eventName == "MOUSE_BUTTON_PRESSED" && arg == guner 5
{
kickback = !kickback;
gun = arg;
if (kickback == false)
{
Console.WriteLine("guner_5_off");
}
else
{
Console.WriteLine("guner_5_on");
EnablePrimaryMouseButtonEvents(true);
}
}
void OnEvent(string eventName, int arg)
{
//guner 5
if (eventName == "MOUSE_BUTTON_PRESSED" && arg == guner 5
{
kickback = !kickback;
gun = arg;
if (kickback == false)
{
Console.WriteLine("guner_5_off");
}
else
{
Console.WriteLine("guner_5_on");
EnablePrimaryMouseButtonEvents(true);
}
}
the name 'EnablePrimaryMouseButtonEvents' does not exist in the current context and i have much more such as ..
The name 'IsMouseButtonPressed' does not exist in the current context
The name 'IsModifierPressed' does not exist in the current context
The name 'PressKey' does not exist in the current context
The name 'ReleaseKey' does not exist in the current context
The name 'IsMouseButtonPressed' does not exist in the current context
The name 'IsModifierPressed' does not exist in the current context
The name 'PressKey' does not exist in the current context
The name 'ReleaseKey' does not exist in the current context
that i had on soooo many locations but i fixed it some what with using this:
bool IsMouseButtonPressed(int button);
bool IsModifierPressed(string modifier);
void PressKey(string key);
void ReleaseKey(string key);
bool IsMouseButtonPressed(int button);
bool IsModifierPressed(string modifier);
void PressKey(string key);
void ReleaseKey(string key);
now with using does i lost a lot of errors i had in the code but it still says that the "Local function 'IsMouseButtonPressed(int)' must declare a body because it is not marked 'static extern'" (for example) and idk what to do with that info. i guess i'm supposed to give it a comand on what is "IsMouseButtonPressed" but idk how to give it a command that works or does not give me does scream errors
6 Replies
Rofus-_-
Rofus-_-8mo ago
now if someone wants the hole code then tell me and i will edit some stuff just because i am going to make this something that is privet, because the code is done but i needed to make it work and while doing it does things happend, but just tell me if you want the code and i will give you it (or send it here)
Joschi
Joschi8mo ago
The error you send means, that the compiler does not know what EnablePrimaryMouseButtonEvents is supposed to be. It simply does not exist and so the program cannot work. For example you got a simple Hello World Program
Console.WriteLine("Hello World");
Console.WriteLine("Hello World");
You could put that string Hello World into it's own variale.
string helloVariable = "Hello World";
Console.WriteLine(helloVariable)
string helloVariable = "Hello World";
Console.WriteLine(helloVariable)
This is functionally the same. But now you do this:
Console.WriteLine(goodbyeVariable)
Console.WriteLine(goodbyeVariable)
What is the program supposed to do? It has no clue what goodbyeVariable is supposed to be. Is it some other string? Is it a function that returns a string? What you basically did with declaring those local functions was the following:
string goodbyeVariable;
Console.WriteLine(goodbyeVariable);
string goodbyeVariable;
Console.WriteLine(goodbyeVariable);
Great, now the program knows it's a string. But that string has no value? So it won't print anything.
Rofus-_-
Rofus-_-8mo ago
ok got i will see what i can do it with +rep i wounder if i can use user32.dll in some way cuz it will help with movement
Joschi
Joschi8mo ago
P/Invoke source generation - .NET
Learn about compile-time source generation for platform invokes in .NET.
Joschi
Joschi8mo ago
I guess Before .NET7 there is [DllImport] to work with external dlls
Accord
Accord8mo ago
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.
Want results from more Discord servers?
Add your server
More Posts
❔ How do I name an object after a variable in that object?I have a class with a variable called "name", how would i make "name" the name of the object?❔ Hi for some reason this exercise on indexing isnt clicking for me can someone guide me this?1-im used to properties that have a name this property has no name so i guess it refers to the class❔ Limit incremental generator's RegisterPostInitializationOutput() call to one specific assemblyIs it possible to add an attribute declaration code to a single assembly and let the code generation❔ What happening in background when i return Task.CompletedTask?I just wonder, what c# doing if i have async method returning Task.completedTask? does it try to syn✅ Razor pages, not reaching OnPost methodI have made a <form method="post"> and within it i have a <button type="submit" >. when i click on ❔ Visual Studio build error: "mark of the web"???Get this error every time I try to build my project. All I did was add a toolstrip to a form and now✅ Replace enum with class nameI'm working on an API right now which, for those familiar with OpenMP, is a parallel programming API❔ What is the identity open-source platform such as Keycloack for asp.net core backend ?title✅ How do I make a window unselectableHow do I make a window like this (I'm using avalonia but any help is preferable)❔ Blazor .NET 8 RenderModeInteractiveAuto - fetch data via APIBlazor WASM: use `HttpClient` to call service (co-hosted or external) Blazor Server: interactivity i