[Menu Scripting] How to make an Rcontool - Part 1

> >

Created 3 years ago

[Menu Scripting] How to make an Rcontool - Part 1

Learn step by step how to create your own rcontools and mods with this tutorial!


In this tutorial you will learn how to make your own rcontool in Call of Duty 1 and other Quake 3-based games. I never found any good tutorial for menu scripting so i thought why not invest 2 hours and teach people from my own experiences and make it available forever?

You may know me as the guy who coded Rafi's RconTool in 2009. When i started, didn't really follow any tutorial on how to do that, i just looked at existing code and learned from it. It was a matter of hours to get started, so it really isn't as complicated as you might think.

You will need the following things before you can start with this tutorial:
  1. A Call of Duty 1.1 Installation
  2. Patience and the will to experiment

This tutorial consists of the following parts:
  1. What is a .PK3 file and how is it related to rcontools?
  2. Let's get started - Introduction
  3. My first window!

1. What is a .PK3 file and how is it related to rcontools?

Every Call of Duty installation has a "Main" folder which contains all the .pk3 files, menus, scripts, configs and other assets for the game. So this is the place you would put all your mods in. Your Call of Duty installation is most likely located in C:\Program Files (x86)\Call of Duty

A .pk3 file is a normal ZIP-archive that has been renamed to .pk3 and contains all the game assets such as menus, models, textures, scripts, animations, sounds, weapons, etc.. So you don't need any special program to create a .pk3 archive, you can just use WinRAR, create a zip and rename it into pk3 and it will be exactly the same.

So what's the deal with the .pk3 stuff now?

Our rcontool will be in a pk3 file, and don't worry, you won't have to create it, i will give you a downloadable example and you can just use that.


• Every mod or rcontool is in a .pk3 file which is basically a renamed .zip archive
• Your .pk3 file cannot start with a capital letter or m (like Rafimod.pk3 - cod will simply ignore the file - god knows why)
• You can't lick your elbow

3. Let's get started - Introduction

To make everything easier for both of us, i will provide you with an example file called "_mywindow.pk3". It contains everything you need to get started with menu scripting. And don't worry, i'll explain to you everything.

Step 1:
Download the example file mywindow.zip and put the containing "_mywindow.pk3" it into your Call of Duty "Main" folder.

Step 2:
Start Call of Duty. Then, in the main screen, you will notice a new menu item called "Open Window" (Second from top). This will open our rcontool! Click on it to see what happens, you will see a window popping up. Now close Call of Duty, clean your desk, turn off all distractions and get ready to proceed with step 3!

Step 3:
Head over to your Call of Duty "Main" folder and open our "_mywindow.pk3" with an archiver tool such as WinRAR (or winzip, 7zip et centera).

You will see two things: A folder named "ui_mp" and a file named "default_mp.cfg".
The "ui_mp" folder contains all our rcontool's files and the "default_mp.cfg" file is just an essential part of every pk3, so we will just ignore this file and only focus on the "ui_mp" folder.

Step 4:
Open the "ui_mp" folder. You will see 4 things:

• A folder named "scriptmenus" - this contains ALL "pages" of our rcontool (in this case only one)
• ingame.txt - this is a text file where you include/specify your menu files so call of duty knows they exist when you launch the application
• main.menu - this is a copy of the main screen of call of duty (this contains the "Open Window" button so we can open our rcontool from the main menu)
• menudef.h - this contains some definitions - we can just ignore this for now

That's pretty simple, isn't it?

Let's count the facts again:
• The ui_mp/scriptmenus/ folder contains our rcontool's pages, right now we only have "window.gsc" which is our rcontool's main page.
• The ui_mp/ingame.txt file is loading all menu files so call of duty can register them. In this case only "window.gsc"
• The main.gsc is just a copy of the original call of duty main screen and it is only needed to open the rcontool

Note: If you still don't fully understand it - don't worry. I didn't even know as much this when i started. I had to dig through the things to understand them. You will get used to everything very soon.

3. My first window!

Step 1:
We will now proceed to editing the actual ".menu" files in our "scriptmenus" folder. Head over to "ui_mp/scriptmenus/" and open "window.menu" with a proper text editor.
Please, for your own good, download a real text editor such as Notepad++ before continuing. Editing code with the default notepad on windows is just horrible as it has no syntax highlighting and no proper code editing capabilities (and the fact that it just sucks is enough).

Step 2:
Once you opened the "window.menu" file, you will see a jungle of structured code, full with menuDef {} and itemDef {}, let's first explain them.

itemDef's are the elements you see, this can be a button, a text, a rectangle, a selectbox etc..
menuDef's are only defined once per page, and that on the very top, they are basically the canvas and are holding the itemDef's, e.g. if you add a 20 px left margin to the menuDef, all itemDef's WITHIN this menuDef will inherit its properties and move with it, so let's say menuDef is the parent and the itemdef's are its children.

Step 3:

Do you remember when you placed the "_mywindow.pk3" into your "Main" folder and started Call of Duty?
You have seen a window, and the window had the following things in it:

â—˜ A biiiiiig gray rectangle (the window surface/background itself)
â—˜ A light gray title bar on top with the title "My Window"
â—˜ A text on the body of the window
â—˜ A red [X] button on the top right corner to close the window

That is 4 individual elements, now guess how many itemDef's we would need to build that? Exactly, 4! And if you look at the source code in "window.menu" you will see that we have exactly 4 itemDef's, which are named:

â—˜ dialog_container
â—˜ dialog_titlebar
â—˜ dialog_content
â—˜ dialog_close

So what's the thing with these itemDef's and how do i work with them?

Let's first explain how an itemDef is structured. Every itemDef has properties and values which describe what the itemDef should do.

Let's take one itemDef as example and look at it, we will take the dialog container as example now.
		name			dialog_container
		rect			0 0 280 260
		border		1
		bordercolor	0 0 0 1
		forecolor		1 1 1 1
		backcolor		.1 .1 .1 1
		visible		1

This tells us that it is an itemDef with the name "dialog_container", it has 0px distance from left, 0px distance from top, has a width of 280 and a height of 260. It is a filled window with the background color gray, it has a black border outline, a white forecolor (not necessary here), it is visible and it is a decoration (as it is just a box, and not something we can interact with, such as a button).

If you would replace WINDOW_STYLE_FILLED with WINDOW_STYLE_GRADIENT, you would get a nice gray gradient.

As you can see, every itmeDef has several declarations which consist of a property (left) and a value (right).


Wait wait wait wait.... But how does it work to open the window?

If you open "ui_mp/scriptmenus/window.menu" and look at the menuDef {} on the top, you will see that it has the name "window". Based on this identifier, i can call it from EVERYWHERE, right now we are calling it in the call of duty main menu which has the button "Open Window".

Let's open the call of duty main menu file by opening "ui_mp/main.menu" with our text editor to see how the "Open Window" button works.
Scroll down to somewhere around line 168. You will see an itemDef with the text "Open Window" - this is the button that opens the window!

It has an action { } command, which contains the command open window;, and this action command is triggered when you click on the "Open Window" button.

So this is how it works, pretty simple... You can call the "window" page from literally everywhere you want, and not only from the call of duty main screen.

What's next?

I want you to experiment around a bit, play with the "_mywindow.pk3" i gave you and change some values in it, learn how everything is behaving. Play around with the "rect" values and other things.

This is really the only way you can learn and get used to it: By Doing.

In the next part of the tutorial you will learn how to add buttons, labels, backgrounds and much more. This is it for tutorial part 1, i hope you have learned something, and i hope that you will also check out the second part when it's available!

EDIT: Click here to proceed to part 2

Also, the following sites contain a lot of useful information about scripting:

Part 2 is still in work, so stay tuned and check the site regularly to see when it comes!

Click here to proceed to part 2

Questions? Corrections? Tell me what you think in the comments below!

Tutorial Details

Created: 3 years ago by ^THiNK#ALIEN

Views: 3867 Views

Keywords: Rcontool, modding, menu, itemdef, menudef, rcon,

Share this Knowledge with your friends!

Direct Link:


Been waiting for it for 2 days :D finally can use some of these codes, thanks!
Commented by SpeCt>.>  (Aug 31st, 2014 01:21 AM)

Omg, is there anything you don't know, ...
Commented by Z o H a 1 B  (Aug 31st, 2014 04:57 AM)

He doesnt know how to use his.... nvm.
Commented by Laura  (Aug 31st, 2014 02:24 PM)

Teach him laura...
Commented by the.megabyte  (Sep 02nd, 2014 04:22 PM)

Everyone is waiting for the next part! :D
(Maybe I am one of them, I still know many things about menu modding but I will surely learn something more)
Commented by `^tlegends.Iremos*  (Sep 25th, 2014 05:05 PM)

but where must I save the File "window" and the File "Open Window" ?
Commented by Booner  (Jan 29th, 2017 11:21 AM)

Please sign in or create an account to post a comment.