Official Everybody Edits Forums

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 2015-11-10 03:22:27

Rapidgame7
Member
Joined: 2015-10-15
Posts: 16

[Question] I don't have a title that relates the questions

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

#2 2015-11-10 03:53:14, last edited by shadowda (2015-11-10 04:05:17)

shadowda
Member
From: somewhere probably.
Joined: 2015-02-19
Posts: 1,015

Re: [Question] I don't have a title that relates the questions

well for starters have you tried using multiple threads to allow code to run at the same time.

multi thread

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

team code

color = #1E1E1E       

latest?cb=20150604065609

Offline

#3 2015-11-10 03:57:16, last edited by hummerz5 (2015-11-10 03:57:53)

hummerz5
Member
From: wait I'm not a secret mod huh
Joined: 2015-08-10
Posts: 5,853

Re: [Question] I don't have a title that relates the questions

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

Wooted by:

#4 2015-11-10 04:03:14

Rapidgame7
Member
Joined: 2015-10-15
Posts: 16

Re: [Question] I don't have a title that relates the questions

hummerz5 wrote:

obviously that's oversimplified, but look for things like tha.

Long code

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

#5 2015-11-10 04:20:44

hummerz5
Member
From: wait I'm not a secret mod huh
Joined: 2015-08-10
Posts: 5,853

Re: [Question] I don't have a title that relates the questions

I haven't actually experienced that. Especially not with such small volumes of code.

Though, I set up my letters in a .txt file... then I didn't have to write the code...

Hidden text

B)

Offline

Wooted by:

#6 2015-11-10 16:23:39

ewoke
Member
Joined: 2015-02-20
Posts: 412

Re: [Question] I don't have a title that relates the questions

Rapidgame7 wrote:
hummerz5 wrote:

obviously that's oversimplified, but look for things like tha.

Long code

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".

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

#7 2015-11-10 19:14:27

Tomahawk
Forum Mod
From: UK
Joined: 2015-02-18
Posts: 2,847

Re: [Question] I don't have a title that relates the questions

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

Wooted by:

#8 2015-11-10 20:32:58, last edited by Processor (2015-11-10 20:33:52)

Processor
Member
Joined: 2015-02-15
Posts: 2,246

Re: [Question] I don't have a title that relates the questions

ewoke wrote:

please dont harcode the letters

WHY NOT? //forums.everybodyedits.com/img/smilies/big_smile

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

#9 2015-11-10 21:04:16, last edited by Zoey2070 (2015-11-11 00:38:05)

ewoke
Member
Joined: 2015-02-20
Posts: 412

Re: [Question] I don't have a title that relates the questions

Processor wrote:
ewoke wrote:

please dont harcode the letters

WHY NOT? //forums.everybodyedits.com/img/smilies/big_smile

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

ewoke1447185856557615

Board footer

Powered by FluxBB

[ Started around 1732766321.4472 - Generated in 0.153 seconds, 12 queries executed - Memory usage: 1.6 MiB (Peak: 1.8 MiB) ]