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

How to Add A New Option


Kemerd
 Share

Recommended Posts

For this tutorial, I'll be adding the option, WASD movement.

Here's how to add an option for all those people who want options for certian things. This can only be used if you need an option for, let's say, transparent trees (like mine), in the code where the transparent trees make the trees transparent, I added

```

If Options.STT = 1 Then

MAKE TREE TRANSPARENT

Else

MAKE TREE NORMAL

End If

```
So, this will require some thinking after the option is made. So with that, let's being.

–----------------------------------------------------------------------------------------------------------------------------------

First, you want to go into frmMain, and bring the options to the front. (An easy trick is to right click on the front of the place where the options should be, and keep clicking go to back until the options are in the front. This is a simple yet useful trick when editing the pictureboxes.)

Next, copy the label for music, and when it asks you to create a control array, select no.

Create two _OptionButton_s. Name one WASDon and one WASDoff (or what your option is going to be named).

Double click on the ON option button. Add this.

```

Options.WASD = 1

' save to config.ini

SaveOptions

```

Double click on the OFF option button. Add this.

```

Options.WASD = 0

' save to config.ini

SaveOptions

```

–-------------------------------------------------------------------------------

Next, in modDatabase search for:

```

Call PutVar(filename, "Options", "Sound", str(Options.sound))

```

At the bottom of that list, add:

```

Call PutVar(filename, "Options", "WASD", str(Options.WASD))

```

Still in modDatabase, search for:

```

Options.Music = 1

```

Add before SaveOptions:

```

Options.STT = (1 if you want the default to be on, and 0 if you want the default button to be off.)

```

Now, search for:

```

Options.Music = GetVar(filename, "Options", "Music")

```

Before that End If, add:

```

Options.STT = GetVar(filename, "Options", "WASD")

```

Now, search for:

```

If Options.sound = 0 Then

frmMain.optSOff.value = True

Else

frmMain.optSOn.value = True

End If

```

Under that, add:

```

If Options.WASD = 0 Then

frmMain.WASDoff.value = True

Else

frmMain.WASDon.value = True

End If

```

That should be it! Now you just have to call on the code where you need an Option!

Option.WASD = 0 **- Off**

Option.WASD = 1 **- On**

So call on it like.

```

If Option.WASD = 1 Then

BLABLA CODE

Else (This means that it is seeing if it's not on, so it must be off.)

(You may want code that does something else when it's off, but most of the time you just want it to End, or End If. Do nothing.)

End if

```
Link to comment
Share on other sites

> Checkboxses are resetting i think or it was on my version >.>
>
> I like Options more too beause it just looks better and you get an file where you can see everything whats on and what not :-)
>
> Nice Tutorial its already there but its hard to find ;-)
>
> (Abhi nice signature lol)

Checkboxes values can also be saved in a file ![-_-](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/sleep.png)

Thanks ![:P](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/tongue.png)
Link to comment
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
 Share

×
×
  • Create New...