Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?
You are not logged in.
1) How can I make a variable that will be holded by a player? More like Lua's "player.whatever = 1", but on C#.
2) How do I access a specific player? For example, to get the variables of the player, or to get their coordinates, or to get their team. Or to set a team to them.
3) Related to the two above, is there any way I can make the bot register when two players are touching?
4) On Visual Studio, specifically the Community 2015 one, how can I make the code shorter? I've got a switch condition that is going to be extremely large, with more than 30 cases and calls a function several times, and using #region on all of them won't do it. And the worst part is that after that switch condition, there is going to be another switch condition, possibly more. It slows down the program when it happens to check for errors. What do I do here?
I guess these are all the questions I have right now.
I can make servers of anything if I put dedication into it
And if I don't, no server
I'm on Steam too
Offline
well for starters have you tried using multiple threads to allow code to run at the same time.
im one of the worst coders here but for variables on visual studios i usually use text boxes...
something like
if(textbox1.Text == "1")
{
}
usually works if you want something less advanced.
i believe you can use the info from capasha's website
to find a players coords and team. most of the info is up to date but check possessors update to be safe
color = #1E1E1E
Offline
Create a class. Someone will soon reply with an example
but, if I make a class
public class MyPlayerInstance{
public int userID;
public int whatever = 1;
}
// and then
public List<MyPlayerInstance> myCollection = new List<MyPlayerInstance>();
You need more code than that, but basically keep a collection of user objects... in this case, I made a class. and used a list. ...
well... that would be myCollection.Where(x=>x.userID == YOUR_USER_ID).First().whatever;
3. needs a lot of coding... unless yo urely on the zombie effect
4. no idea. But, you're probably not to the "slowing things down" stage. Consider why you have a "switch condition" and look into an alternative method.
what not to do:
var addition = 1;
switch(addition)
{
case 0:
myVar += 0;
case 1:
myVar += 1;
case 2:
myVar += 2;
}
obviously that's oversimplified, but look for things like tha.
edit:
shadowda makes a great point, but the "m" packets don't tell collisions if, say, the users hold keys.
Offline
obviously that's oversimplified, but look for things like tha.
Fun fact: I still have several characters to do.
Also, the bot isn't slowing down, the one that is slowing down is the spelling checker from Visual Studio. That one that tells you if the code is right, I don't think it is called "spelling checker".
I can make servers of anything if I put dedication into it
And if I don't, no server
I'm on Steam too
Offline
Offline
hummerz5 wrote:obviously that's oversimplified, but look for things like tha.
▼Long codeFun fact: I still have several characters to do.
Also, the bot isn't slowing down, the one that is slowing down is the spelling checker from Visual Studio. That one that tells you if the code is right, I don't think it is called "spelling checker".
please dont harcode the letters, atilla made a neat script that writes text
http://forums.everybodyedits.com/viewtopic.php?id=28648 check dis
if you can read this....good for you
Offline
Three of those four questions were about relatively simple C#, not about bots.
Are C# tutorials suddenly useless, or do people find it more constructive to jump in at the deep end and call for help?
One bot to rule them all, one bot to find them. One bot to bring them all... and with this cliché blind them.
Offline
please dont harcode the letters
WHY NOT?
http://pastebin.com/yYpUdpqV DO NOT USE DO NOT USE DO NOT USE I REPEAT DO NOT USE DO NOT USE ...
I have never thought of programming for reputation and honor. What I have in my heart must come out. That is the reason why I code.
Offline
ewoke wrote:please dont harcode the letters
WHY NOT?
http://pastebin.com/yYpUdpqV DO NOT USE DO NOT USE DO NOT USE I REPEAT DO NOT USE DO NOT USE ...
<snip> you processor ;D
if you can read this....good for you
Offline
[ Started around 1732446517.8298 - Generated in 0.145 seconds, 12 queries executed - Memory usage: 1.6 MiB (Peak: 1.8 MiB) ]