PtokaX forum

Development Section => HOW-TO's => Topic started by: -PT-B2S on 09 September, 2005, 02:16:59

Title: [HOW TO] Do a simple GUI to a script
Post by: -PT-B2S on 09 September, 2005, 02:16:59
Hello, i have made an all in one script (with the most functions of robocop, but not so heavy) called JEDi Script.

Now i want to do a GUI to the script. Nothing very complicated. When i have the script with the GUI, i will publish it here.

Can someone help me to do the GUI?

I really don't understand nothin about programing (C++, vb, etc), only LUA. Please help me, and you will have a good LUA5 all in one script in return :)

Thanks
Title:
Post by: bluebear on 10 September, 2005, 10:50:53
You can do that in lua. http://www.luascript.thersgb.net/
Title: Hello again
Post by: -PT-B2S on 11 September, 2005, 21:14:16
bluebear , i tried that, but i think its a bit difficult...

Is there any guide to do a GUI that opens TBL files and write on them, and this things? i mean, my script is like robocop and so many others that work with tbl files...
All i want is to organize the script and make it easier to configure. Any help? it would be precious. Thnks in advance...

Props
Title:
Post by: Optimus on 11 September, 2005, 21:53:53
Check Kepps bot Guarding he published his menu source it's written in .NET maybe you can use that.

- Optimus
Title: Hello again
Post by: -PT-B2S on 11 September, 2005, 22:01:15
Thanks Optimus. I really don't know nothin abou .NET, so if there is a guide or something... it will help... Thnks again

If somebody know other way to do a GUI and a guide that explains how to do it, it is welcome too

Thanks

Props    
Title: Hello Again
Post by: -PT-B2S on 26 September, 2005, 21:07:50

Hello people,

Since there isn't any help, i've tried Visual Basic. It's very easy to work, i think, but i want some help (special help from optimus, i know he knows :P ) with codes to load settings from .tbl files and to save the things inserted in the GUI to the .tbl files.

For example:

iTableMinShare = {
[1] = {
["1-Unit"] = "GB",
["2-Share"] = 50,
},
[2] = {
["1-Unit"] = "GB",
["2-Share"] = 70,
},
[3] = {
["1-Unit"] = "GB",
["2-Share"] = 10,
},
[4] = {
["1-Unit"] = "GB",
["2-Share"] = 0,
},
[5] = {
["1-Unit"] = "GB",
["2-Share"] = 0,
},
[-1] = {
["1-Unit"] = "GB",
["2-Share"] = 1,
},
[0] = {
["1-Unit"] = "GB",
["2-Share"] = 0,
},
}


i have a file called  minshare.tbl  that contains this code.
I want to load this code to the GUI and edit it with the GUI, and then save the file when i close dthe program.

Does somebody have a code of a GUI made in Visual Basic or knows how to do this?

Thanks and good scripts.


.[/B]
Title:
Post by: Chibok on 26 September, 2005, 21:22:09
tries to see this site (http://sashipa.ben.free.fr/dcplaya/Documentation/html/group__dcplaya__lua.html) of information on the subject

or visite this page (http://www.wxwidgets.org/)

**edited to add new link
Title: Hello Again
Post by: -PT-B2S on 26 September, 2005, 21:36:44
Hello,

It's not this chibok, but thanks. Those links only have LUA and C++ information. I want Visual Basic. Any more?

Thanks and good scripts




.
Title:
Post by: Chibok on 26 September, 2005, 21:41:17
I thought that you intended to make a GUI with LUA :D
Title:
Post by: -PT-B2S on 26 September, 2005, 23:53:27
any more?
Title:
Post by: Optimus on 27 September, 2005, 11:43:27
I advice you to use .NET
With visual basic it's way to hard to make it work, you need lots of left$ right$ mid$ etc not nice

Thats why i switched to .NET alot easyer there
Title: Hello Again
Post by: -PT-B2S on 27 September, 2005, 19:00:23
Hello,

Thanks for the advice optimus.

Can you write here the program's name to do the GUI and the code you use, just to see it and learn from it ???

Tell me everything i need to do a GUI in .NET please.

Thanks again

(if somebody knows something more, i apreciate him to help please.)

Props, and good scripts

 

.
Title:
Post by: -PT-B2S on 28 September, 2005, 20:14:22
nobody???


.
Title:
Post by: LoTeK_ on 29 September, 2005, 01:44:28
QuoteOriginally posted by -PT-B2S
Hello,

Thanks for the advice optimus.

Can you write here the program's name to do the GUI and the code you use, just to see it and learn from it ???

Tell me everything i need to do a GUI in .NET please.
 

You could obtain a .NET manual and read it. Much more simple and less timewaster for everyone.
This is not a program where a simple guide or a single post can explain its functionality.
Title:
Post by: -PT-B2S on 29 September, 2005, 21:31:04
hello,

Yes, but if someone just put here a GUI's code, it will be easier for me to learn. Does someone knows where i can get an example? Thanks
Title:
Post by: bastya_elvtars on 30 September, 2005, 01:18:18
QuoteOriginally posted by -PT-B2S
hello,

Yes, but if someone just put here a GUI's code, it will be easier for me to learn. Does someone knows where i can get an example? Thanks

Try meka-meka.com they have a cool programming forum.
Title:
Post by: Typhoon on 30 September, 2005, 14:23:32
well for postingexamples and code that's usefull for you , Optimus allready told your :)
Kepp has released his GUI source from that you can learn what you want, and it's written i C#.NET/Lua5 ..


QuoteOriginally posted by Optimus
Check Kepps bot Guarding he published his menu source it's written in .NET maybe you can use that.

- Optimus


 Typhoon?
Title:
Post by: Jelf on 30 September, 2005, 19:23:28
I am also in the same situation, I have done the GUI just need it to read and write to the bots settings file (.DAT), so have been watchin this thread.

Have tried to get Kepps source for Guarding but cant find it anywhere, also his link is dead in his signature, would be good if someone had this please.
Title:
Post by: ??????Hawk?????? on 30 September, 2005, 21:01:36
google UK  --->   c# writing to a file


First page, top link..   * Click *

How To: Reading and Writing Text Files
by Joe Mayo, 2/17/02

Text files provide a common denominator format where both people and programs can read and understand.  The .NET Framework includes convenience classes that make reading and writing text files very easy.  The following sequence outlines the basic steps necessary to work with text files:

Open the file
Read/Write to the file
Close the file
It's that simple.  Listing 1 shows how to write text data to a file.

to a Text File
Listing 1: Writing Text Data to a File: TextFileWriter.cs
using System;
using System.IO;

namespace csharp_station.howto
{
    class TextFileWriter
    {
        static void Main(string[] args)
        {
            // create a writer and open the file
            TextWriter tw = new StreamWriter("date.txt");

            // write a line of text to the file
            tw.WriteLine(DateTime.Now);

            // close the stream
            tw.Close();
        }
    }
}

This program creates a text file when it runs.  In the directory where the executable program is located, you'll find a file named date.txt.  If you view the contents of this file, you'll see the following textual representation of the date and time when the program last ran:

2/15/2002 8:54:51 PM
The first task in Listing 1 is to open the file.  This happens by instantiating a StreamWriter class, which returns an object of type TextWriter.  The result could have also been assigned to a StreamWriter instance.  The StreamWriter was called with a single parameter, indicating the name of the file to open.  If this file doesn't exist, the StreamWriter will create it.  The StreamWriter also has 6 other constructor overloads that permit you to specify the file in different ways, buffer info, and text encoding.  Here's the line that opens the date.txt file:

            TextWriter tw = new StreamWriter("date.txt");

Using the TextWriter instance, tw, you can write text info to the file.  The example writes the text for the current date and time, using the static Now property of the DateTime class.  Here's the line from the code:

            tw.WriteLine(DateTime.Now);

When you're done writing to the file, be sure to close it as follows:

            tw.Close();

From a Text File
Listing 2 shows how to read from a text file:

Listing 2: Reading Text Data from a File: TextFileReader.cs
using System;
using System.IO;

namespace csharp_station.howto
{
    class TextFileReader
    {
        static void Main(string[] args)
        {
            // create reader & open file
            TextReader tr = new StreamReader("date.txt");

            // read a line of text
            Console.WriteLine(tr.ReadLine());

            // close the stream
            tr.Close();
        }
    }
}

In Listing 2, the text file is opened in a manner similar to the method used in Listing 1, except it uses a StreamReader class constructor to create an instance of a TextReader.  The StreamReader class includes additional overloads that allow you to specify the file in different ways, text format encoding, and buffer info.  This program opens the date.txt file, which should be in the same directory as the executable file:

            TextReader tr = new StreamReader("date.txt");

Within a Console.WriteLine statement, the program reads a line of text from the file, using the ReadLine() method of the TextReader instance.  The TextReader class also includes methods that allow you to invoke the Read() method to read one or more character or use the Peek() method to see what the next character is without pulling it from the stream.  Here's the code that reads an entire line from the text file:

            Console.WriteLine(tr.ReadLine());

When done reading, you should close the file as follows:

            tr.Close();

This article showed how to write text to a file and read it back out.  For more details on additional methods, consult the .NET Frameworks reference on the StreamWriter, StreamReader, TextWriter, and TextReader classes.

Title:
Post by: -PT-B2S on 01 October, 2005, 04:58:50
QuoteOriginally posted by Optimus
Check Kepps bot Guarding he published his menu source it's written in .NET maybe you can use that.

- Optimus

Hi, would someone please write here another link to the source, since this one seems "dead"???

Thanks and good scripts


.[/B]
Title:
Post by: Jelf on 01 October, 2005, 20:22:09
Thanks for that info Hawk, is C# the same as .Net?? <
Title:
Post by: -PT-B2S on 02 October, 2005, 13:31:33
QuoteOriginally posted by Optimus
Check Kepps bot Guarding he published his menu source it's written in .NET maybe you can use that.

- Optimus

Hi, would someone please write here another link to the source, since this one seems "dead"???

Thanks and good scripts


.[/B]    
Title:
Post by: Meka][Meka on 05 October, 2005, 11:34:06
QuoteOriginally posted by Jelf
Thanks for that info Hawk, is C# the same as .Net?? <

newer c# is .net, vs c#.net

ThreadStarter: I advise NOT to use .net, reason 1, .net to install is 20mb+, meaning users that dont have .net need to dl it....quite annoying for those, unless the project was big, but 20mb for a project of 200k or so...... reason 2, resource usage highly increases, for a small GUI.....
Title:
Post by: Pothead on 05 October, 2005, 12:11:35
QuoteOriginally posted by Meka][Meka
ThreadStarter: I advise NOT to use .net,
reason 1, .net to install is 20mb+, meaning users that dont have .net need to dl it....quite annoying for those, unless the project was big, but 20mb for a project of 200k or so......
reason 2, resource usage highly increases, for a small GUI.....
a 3rd reason, .Net is just another un-needed level of compilcation.
Title:
Post by: Meka][Meka on 05 October, 2005, 12:19:37
QuoteOriginally posted by Pothead
QuoteOriginally posted by Meka][Meka
ThreadStarter: I advise NOT to use .net,
reason 1, .net to install is 20mb+, meaning users that dont have .net need to dl it....quite annoying for those, unless the project was big, but 20mb for a project of 200k or so......
reason 2, resource usage highly increases, for a small GUI.....
a 3rd reason, .Net is just another un-needed level of compilcation.

well .net is easier to learn, and not far from original vb,or c#, but like i said the first 2 reasons for such a small project, aint good at all....
Title: More resources
Post by: Mardeg on 29 October, 2005, 08:01:59
from http://wxdsgn.sourceforge.net (http://wxdsgn.sourceforge.net) page:
QuoteWith all the good features of dev-cpp, wx-DevCpp hosts a wxWidgets form designer with the latest wx library. This program helps you to create Dialogs and Frames for wxWidgets visually.


UPDATE: Here's one that uses Lua for it's GUI, aswell as for provide Networking, Databases & XML - http://www.murga.org/devPages/murgaLua/ (http://www.murga.org/devPages/murgaLua/)

To Mutor: If this proves useful enough, perhaps it should be included in The PtokaX LUA Board > Developing > Lua tools section?