Quote:
Originally Posted by [GM]
iam trying to add a button to the GUI to set my speeds without writing them ingame
and the code is like:
PHP Code:
private void button1_Click(object sender, EventArgs e)
{
C.UpdateSpeed = 100;
C.JumpSpeed = 100;
C.AttackSpeed = 60;
}
but it says "The name 'C' does not exist in the current context" anyone can help?
|
Because C is never defined... you have TWO things defined...
object sender
and
EventArgs e
There is no Client C or w/e.
Ideally what I would do is in your gui create something like...
public Player Owner;
And on form creation accept a new param Player and assign Owner to it.
Then you can do Owner.Variables = blablabla from inside the forum.
If that makes no sense... here's an example from the multi version proxy we worked on.
Code:
public Listener User;
public ProxyBot(Listener owner)
{
Control.CheckForIllegalCrossThreadCalls = false;
InitializeComponent();
User = owner;
}
Note: Unless you do all sorts of cross thread handling to invoke things... you'll want to disable that checking. If not none of your cross thread calls will get through (the Winform should be on its own thread... which will mean it fails to communicate with anything on other threads... IE: the user)
Then when creating an instance of ProxyBot (it's just the gui created for every character that logs in on this proxy we made) I would do some extra lovely inheritance so that the bot itself can easily control the window... to do that do something inside the player/character/user class or w/e you wanna call it and add
public ProxyBot GUIWindow;
When creating it do something like...
user.ProxyBot = new ProxyBot(user);
and start up the new winform. Now you can do stuff like...
user.GUIWindow.Textbox1.Text = "blahhh";
It's just a simple way to interact between the two different things.