n
n
CC#
Created by n on 5/27/2024 in #help
Weird error to do with index out of range
thanks for the help nevertheless @Saber
14 replies
CC#
Created by n on 5/27/2024 in #help
Weird error to do with index out of range
so it was choosing a number that was no longer present after the first pick
14 replies
CC#
Created by n on 5/27/2024 in #help
Weird error to do with index out of range
I need to check the _possibleEvents.Count rather than Events.Count, since the latter is constant and the first one changes after some events are removed from the list
14 replies
CC#
Created by n on 5/27/2024 in #help
Weird error to do with index out of range
Ohhhh shit wtf i just realised
14 replies
CC#
Created by n on 5/27/2024 in #help
Weird error to do with index out of range
so that should be fine
14 replies
CC#
Created by n on 5/27/2024 in #help
Weird error to do with index out of range
Rand.Next(10) will return a random integer less than 10
14 replies
CC#
Created by n on 5/27/2024 in #help
Weird error to do with index out of range
I was thinking something like that because of how random the error appears, but for example if there are 10 events and they are stored at indexes 0-9 within Event.Events, surely Rand.Next(Event.Events.Count) will generate a number between 0 and 9 inclusive?
14 replies
CC#
Created by n on 5/27/2024 in #help
Weird error to do with index out of range
If it works once, the event list is never touched after server start
14 replies
CC#
Created by n on 5/27/2024 in #help
Weird error to do with index out of range
It is initialised when the server starts (and the plugin is initialised)
14 replies
CC#
Created by n on 5/27/2024 in #help
Weird error to do with index out of range
Event.Events is always populated for the entirety that this is running and I very much doubt that could be causing the issue - my event voting system works fine a couple of times and then randomly will just break with this error, crashing it
14 replies
CC#
Created by n on 1/16/2024 in #help
First time using delegates/lambda expressions
and yeah that was a multicast delegate, I never thought about it using overloaded methods though that's interesting
33 replies
CC#
Created by n on 1/16/2024 in #help
First time using delegates/lambda expressions
I think it's a bit of both, and more of like when to actually use the lambda expression, I think it'll come with more practice though
33 replies
CC#
Created by n on 1/16/2024 in #help
First time using delegates/lambda expressions
thank you for your help though
33 replies
CC#
Created by n on 1/16/2024 in #help
First time using delegates/lambda expressions
i might need to jump back to something simpler if i want to understand this though because i still can't really get my head around it
33 replies
CC#
Created by n on 1/16/2024 in #help
First time using delegates/lambda expressions
I kind of see what you're saying
33 replies
CC#
Created by n on 1/16/2024 in #help
First time using delegates/lambda expressions
i don't fully understand lambda expressions yet
33 replies
CC#
Created by n on 1/16/2024 in #help
First time using delegates/lambda expressions
so what exactly is the lamba expression doing in the second line that the first line isnt doing
33 replies
CC#
Created by n on 1/16/2024 in #help
First time using delegates/lambda expressions
I see, I think the video I was watching first did it using the delegate keyword to show what it is doing in more simple terms then
33 replies
CC#
Created by n on 1/16/2024 in #help
First time using delegates/lambda expressions
so this is correct
// anonymous method
TestDelegate testDelegate = delegate () { Console.WriteLine("Hello!"); };

// anonymous method with lambda expression
testDelegate += () => { Console.WriteLine("Hello 2!"); };
// anonymous method
TestDelegate testDelegate = delegate () { Console.WriteLine("Hello!"); };

// anonymous method with lambda expression
testDelegate += () => { Console.WriteLine("Hello 2!"); };
but when i remove delegate from the top line
// anonymous method
TestDelegate testDelegate = () { Console.WriteLine("Hello!"); };

// anonymous method with lambda expression
testDelegate += () => { Console.WriteLine("Hello 2!"); };
// anonymous method
TestDelegate testDelegate = () { Console.WriteLine("Hello!"); };

// anonymous method with lambda expression
testDelegate += () => { Console.WriteLine("Hello 2!"); };
it doesnt like that, but the line with the lambda expression doesnt have it
33 replies
CC#
Created by n on 1/16/2024 in #help
First time using delegates/lambda expressions
is that only with lambda? because when i remove the delegate type from the first statement it throws an error
33 replies