Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Eclipse Origins: Tutorial | Part 7: Introduction to Visual Basic 6


Recommended Posts

![alt text](http://i.imgur.com/jGWoUl3.png)

You may want to tweak some features in your game, or just add new features. You will need VB6 for this. `Visual Basic 6` will allow you to add in any custom features.

Learning VB6 will also help you gain programming knowledge in the other Basic languages (VB6, VB Net, VBS, etc.), and will teach you how to code if you're new to programming.

**Note `VB6` is discontinued and finding an official copy is hard to find/buy. The easiest way to obtain VB6 if to find a pirated copy on a torrent site, or you can ask a trusted member on the forums for a link.** (We don't condone pirating software).

***
***

This guide will assume you have successfully installed VB6. Please use google.com if you need help installing VB6 successfully.

***

Once opened, VB6 should look something like this (we'll be using `Andur Engine` -> `dev suite` for this guide)

![VB6 IDE](https://i.postimg.cc/522dhXKn/gNeZDh5.png)

On the right side you can see

* `Forms` (stores windows forms)
* `Modules` (stores the scripts)
* `Class Modules` (DX related scripts. You don't need to open this)
* `Related Document` (Includes misc scripts. You don't need to open this. Found in Andur Engine)

take a look around the code and explore the VB6 IDE. We can move on with the tutorial once you're more comfortable with the development environment.

***
***

First off, let's make a simple code that will display a text in the chatbox.

Go to `modInput`, press `Ctrl` + `F`, and search for `"/help"`

You should see something similar to this"
```
Case "/help"
Call AddText("Debug Commands: /info, /who, /fps, /fpslock", HelpColor)
Call AddText("/chatcommands - Chat commands", Blue)
Call AddText("For Chat room command help: /chathelp", BrightGreen)
Call AddText("Leave Party: /leaveparty - leave party/group", Yellow)
Call AddText("Bounty commands: /bountyhelp - Bounty commands", BrightRed)
Call AddText("Mail: /mail - Open the Mail window", Green)
```

After that block of code, add this:
```
Case “/HelloWorld”
Call AddText("Hello World", Blue)
```

Now, if you type `/HelloWorld` in the chat box in game, then a message should appear in the chat box with `Hello World` in blue text.

***

Let's go over what each part of that code does:

* `Case "/HelloWorld"` - Case is a conditional that activates the code inside if the condition is true. If you type `/HelloWorld` in chat, then the condition checks if what you type is the same as what's in the code.

* `Call AddText` - Shows message in the chat box (no one else will see this message)

***
***

Next, let's make a roll dice command:

Under the Hello World code we just added, add this code:
```
Case “/roll”
Dim rndNum As Byte
rndNum = Rand(1, 10)
AddText(rndNum, Red)
```

Let's go over what each part of that code does:

* `Case "/roll` - Case is a conditional that activates the code inside when the value is true. If you type `/roll` into chat, the condition will be true and the code will be activated.

* `Rand(lowNum, highNum)` is EO’s random number generator; it will return a value within the bounds given. In this case, the bounds are 1 and 10.

* `Dim` - This is used to declare a variable. In this case, we are declaring `randNum` as a `Byte`.

* `AddText(rndNum. Red)` ~ This shows the number we got from `Rand(1, 10)` in the chat (again, only you will see this message, no one else will).

And there you have it, you now have a dice roll feature in your engine. It's not too complex but it does show a few things you can do with the engine and is a good start.

***

Following the above code will only add the code to the source files, it's not actually added to the exe file. To add it to the exe so users can have the feature, go to `File -> Make *GAME NAME*.exe`.

For ER: `File -> Make Eclipse Renewal.exe`
For AE: `File -> Make Andure Engine.exe`

And that's your first feature in your engine! You have now learned some of the basics :D

***
***

[Tutorial Index](https://www.eclipseorigins.com/topic/86346/solid-and-mohenjo-s-tutorial-index)

Part 6: [Distributing the client](https://www.eclipseorigins.com/topic/86540/eclipse-origins-tutorial-part-6-sending-the-client-to-friends)

***
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...