http://wiki.wolfire.com/api.php?action=feedcontributions&user=Aaorris&feedformat=atomWolfire Games Wiki - User contributions [en]2024-03-28T16:01:10ZUser contributionsMediaWiki 1.30.0http://wiki.wolfire.com/index.php?title=Mod_Mod_Tutorial&diff=3905Mod Mod Tutorial2012-04-09T23:22:58Z<p>Aaorris: Created page with "<!--PRIVATE // Only displayed on this page, not transcluded on pages that use this template--> <noinclude> <!--Categories--> Category: Modding <!--Constants--> <!--Content-->..."</p>
<hr />
<div><!--PRIVATE // Only displayed on this page, not transcluded on pages that use this template--><br />
<noinclude><br />
<!--Categories--> [[Category: Modding]]<br />
<!--Constants--><br />
<!--Content--><br />
</noinclude><br />
<br />
<!--INCLUDED // Not displayed on this page, only transcluded on pages that use this template--><br />
<includeonly><br />
<!--Categories--> <br />
<!--Constants--><br />
<!--Content--> <br />
Your INCLUDED content should start here<br />
</includeonly><br />
<br />
PUBLIC<br />
<!--Categories --> <br />
<!--Constants--> <br />
<!--Content--><br />
This page gives a detailed overview of installing, using, and creating mods for AAorris' Mod mod.<br />
<br />
==Overview of the mod mod?==<br />
<br />
==Installing==<br />
Download the mod mod from my page at:<br />
[[http://forums.wolfire.com/viewtopic.php?f=16&t=14974 | My forum thread]]<br />
and replace the necissary scripts, as well as putting the mods folder in Data/Custom/.<br />
==Using==<br />
The mods will all be deactivated by default, unless hard-coded otherwise. Press M in game and use the mod panel to activate them as you choose.<br />
To change the default settings for a mod, go to the mod_level.as file, and set active=false; to active=true;.<br />
==creating mods==<br />
Creating mods using the existing code is not hard at all. It helps to set up a good workspace for changing scripts. My setup looks a little like this.<br />
<br />
The mod is split into the character, level, and UI components. The character component changes the game and does all the heavy lifting, the level code supplies information on the mod, like its description, author, instructions, and if it is activated or not. The UI component is written in html and is in the Data/UI/mods folder. It gives the user buttons and such to change the mod parameters.<br />
===player code===<br />
The player code is written as a class.<br />
Its structure is that of a C++ class:<br />
<pre><br />
class ClassName {<br />
int variable;<br />
ClassName() {<br />
variable = 1;<br />
}<br />
};<br />
ClassName classname = ClassName();<br />
</pre><br />
The last line creates a global instance of the class for the rest of the script to interact with.<br />
===level code===<br />
Similarly, the level code is written in a class. It also creates an info class as one of its variables to track information common to all mods.<br />
===UI markup===<br />
The markup...<br />
===Updating mod mod files===<br />
Sorry, I'll continue this later!</div>Aaorrishttp://wiki.wolfire.com/index.php?title=Scripting&diff=3901Scripting2012-04-06T02:04:04Z<p>Aaorris: </p>
<hr />
<div>Overgrowth uses [http://en.wikipedia.org/wiki/AngelScript AngelScript] as its core '''scripting''' language. The [http://www.angelcode.com/angelscript/sdk/docs/manual/index.html AngelScript Manual] is the best place to start learning. <br />
<br />
== Checking for User Input: ==<br />
You can check for keypresses by using the '''boolean''' check function '''GetInputDown()''':<br />
<br />
Syntax examples:<br />
{| class="wikitable" border="1"<br />
|-<br />
|GetInputDown("a")<br />
|returns true if the 'a' key is being pressed, returns false if not<br />
|-<br />
|GetInputDown("attack")<br />
|returns true if the left mouse button is being pressed, returns false if not<br />
|-<br />
|GetInputDown("move_left")<br />
|returns true if the "left key" is being pressed, returns false if not (by default this key is defined in the config.txt to be the 'a' key) <br />
|}<br />
<br />
<br />
The following controls are designed to be relative to the player's preferences and are given a binding in the [[config.txt|config.txt]] file.<br />
<br />
'''Config.txt Dependent References'''<br />
{| class="wikitable" border="1"<br />
|-<br />
! Predefined Term<br />
! Default binding in Config.txt<br />
! Scripting Reference Name<br />
|-<br />
| Left Key<br />
| a<br />
| move_left<br />
|-<br />
| Right Key<br />
| d<br />
| move_right<br />
|-<br />
| Up Key<br />
| w<br />
| move_up<br />
|-<br />
| Down Key<br />
| s<br />
| move_down<br />
|-<br />
| Crouch Key<br />
| left shift<br />
| crouch<br />
|-<br />
| Jump Key<br />
| space<br />
| jump<br />
|}<br />
<br />
<br />
'''Mouse Input'''<br />
{| class="wikitable" border="1"<br />
|-<br />
! Mouse Button<br />
! Scripting Reference Name<br />
|-<br />
| Left Mouse Button<br />
| attack<br />
|-<br />
| Right Mouse Button<br />
| grab<br />
|}<br />
<br />
<br />
'''Generic Key References'''<br />
<br />
Here is a complete list of scripting tags for key presses:<br />
<br />
<pre><br />
backspace<br />
tab<br />
clear<br />
return<br />
pause<br />
esc<br />
space<br />
!<br />
"<br />
#<br />
$<br />
&<br />
'<br />
(<br />
)<br />
*<br />
+<br />
,<br />
-<br />
.<br />
/<br />
0<br />
1<br />
2<br />
3<br />
4<br />
5<br />
6<br />
7<br />
8<br />
9<br />
:<br />
;<br />
<<br />
=<br />
><br />
?<br />
@<br />
[<br />
\<br />
]<br />
^<br />
_<br />
`<br />
a<br />
b<br />
c<br />
d<br />
e<br />
f<br />
g<br />
h<br />
i<br />
j<br />
k<br />
l<br />
m<br />
n<br />
o<br />
p<br />
q<br />
r<br />
s<br />
t<br />
u<br />
v<br />
w<br />
x<br />
y<br />
z<br />
delete<br />
keypad0<br />
keypad1<br />
keypad2<br />
keypad3<br />
keypad4<br />
keypad5<br />
keypad6<br />
keypad7<br />
keypad8<br />
keypad9<br />
keypad.<br />
keypad/<br />
keypad*<br />
keypad-<br />
keypad+<br />
keypadenter<br />
keypad=<br />
up<br />
down<br />
right<br />
left<br />
insert<br />
home<br />
end<br />
pageup<br />
pagedown<br />
f1<br />
f2<br />
f3<br />
f4<br />
f5<br />
f6<br />
f7<br />
f8<br />
f9<br />
f10<br />
f11<br />
f12<br />
f13<br />
f14<br />
f15<br />
numlock<br />
capslock<br />
scrollock<br />
rshift<br />
lshift<br />
rctrl<br />
lctrl<br />
ralt<br />
lalt<br />
rmeta<br />
lmeta<br />
lsuper<br />
rsuper<br />
mode<br />
compose<br />
help<br />
print<br />
sysreq<br />
break<br />
menu<br />
power<br />
euro</pre><br />
<br />
[[Category:Overgrowth]]<br />
<br />
== Writing classes and functions in your own script: ==<br />
Scripts can be written outside of the game code, and interact with it using objects and function calls. These do not need to be written as classes and could be simple functions. A simple class might look like this: <br />
<pre><br />
class Example {<br />
int example_variable; //variables cannot be initialized here<br />
<br />
Example() {<br />
example_variable = 1;<br />
print_var();<br />
}<br />
<br />
void print_var() {<br />
Print(example_variable);<br />
}<br />
};<br />
//Initialize a class that the game can use<br />
Example ex1 = Example();<br />
ex1.example_variable = 2;<br />
ex1.print_var();<br />
</pre><br />
This script could be included in any of those in Data/Scripts, by writing<br />
#include "path_to_script.as", where path_to_script would just be your script name if it were in the scripts folder.<br />
<br />
It can then be used to create new classes, or use ones defined in your script.<br />
<br />
Writing you scripts separate from the game files makes your code easier to develop and update!</div>Aaorrishttp://wiki.wolfire.com/index.php?title=Scripting&diff=3900Scripting2012-04-06T02:03:13Z<p>Aaorris: </p>
<hr />
<div>Overgrowth uses [http://en.wikipedia.org/wiki/AngelScript AngelScript] as its core '''scripting''' language. The [http://www.angelcode.com/angelscript/sdk/docs/manual/index.html AngelScript Manual] is the best place to start learning. <br />
<br />
== Checking for User Input: ==<br />
You can check for keypresses by using the '''boolean''' check function '''GetInputDown()''':<br />
<br />
Syntax examples:<br />
{| class="wikitable" border="1"<br />
|-<br />
|GetInputDown("a")<br />
|returns true if the 'a' key is being pressed, returns false if not<br />
|-<br />
|GetInputDown("attack")<br />
|returns true if the left mouse button is being pressed, returns false if not<br />
|-<br />
|GetInputDown("move_left")<br />
|returns true if the "left key" is being pressed, returns false if not (by default this key is defined in the config.txt to be the 'a' key) <br />
|}<br />
<br />
<br />
The following controls are designed to be relative to the player's preferences and are given a binding in the [[config.txt|config.txt]] file.<br />
<br />
'''Config.txt Dependent References'''<br />
{| class="wikitable" border="1"<br />
|-<br />
! Predefined Term<br />
! Default binding in Config.txt<br />
! Scripting Reference Name<br />
|-<br />
| Left Key<br />
| a<br />
| move_left<br />
|-<br />
| Right Key<br />
| d<br />
| move_right<br />
|-<br />
| Up Key<br />
| w<br />
| move_up<br />
|-<br />
| Down Key<br />
| s<br />
| move_down<br />
|-<br />
| Crouch Key<br />
| left shift<br />
| crouch<br />
|-<br />
| Jump Key<br />
| space<br />
| jump<br />
|}<br />
<br />
<br />
'''Mouse Input'''<br />
{| class="wikitable" border="1"<br />
|-<br />
! Mouse Button<br />
! Scripting Reference Name<br />
|-<br />
| Left Mouse Button<br />
| attack<br />
|-<br />
| Right Mouse Button<br />
| grab<br />
|}<br />
<br />
<br />
'''Generic Key References'''<br />
<br />
Here is a complete list of scripting tags for key presses:<br />
<br />
<pre><br />
backspace<br />
tab<br />
clear<br />
return<br />
pause<br />
esc<br />
space<br />
!<br />
"<br />
#<br />
$<br />
&<br />
'<br />
(<br />
)<br />
*<br />
+<br />
,<br />
-<br />
.<br />
/<br />
0<br />
1<br />
2<br />
3<br />
4<br />
5<br />
6<br />
7<br />
8<br />
9<br />
:<br />
;<br />
<<br />
=<br />
><br />
?<br />
@<br />
[<br />
\<br />
]<br />
^<br />
_<br />
`<br />
a<br />
b<br />
c<br />
d<br />
e<br />
f<br />
g<br />
h<br />
i<br />
j<br />
k<br />
l<br />
m<br />
n<br />
o<br />
p<br />
q<br />
r<br />
s<br />
t<br />
u<br />
v<br />
w<br />
x<br />
y<br />
z<br />
delete<br />
keypad0<br />
keypad1<br />
keypad2<br />
keypad3<br />
keypad4<br />
keypad5<br />
keypad6<br />
keypad7<br />
keypad8<br />
keypad9<br />
keypad.<br />
keypad/<br />
keypad*<br />
keypad-<br />
keypad+<br />
keypadenter<br />
keypad=<br />
up<br />
down<br />
right<br />
left<br />
insert<br />
home<br />
end<br />
pageup<br />
pagedown<br />
f1<br />
f2<br />
f3<br />
f4<br />
f5<br />
f6<br />
f7<br />
f8<br />
f9<br />
f10<br />
f11<br />
f12<br />
f13<br />
f14<br />
f15<br />
numlock<br />
capslock<br />
scrollock<br />
rshift<br />
lshift<br />
rctrl<br />
lctrl<br />
ralt<br />
lalt<br />
rmeta<br />
lmeta<br />
lsuper<br />
rsuper<br />
mode<br />
compose<br />
help<br />
print<br />
sysreq<br />
break<br />
menu<br />
power<br />
euro</pre><br />
<br />
[[Category:Overgrowth]]<br />
<br />
Scripts can be written outside of the game code, and interact with it using objects and function calls. These do not need to be written as classes and could be simple functions. A simple class might look like this: <br />
<pre><br />
class Example {<br />
int example_variable; //variables cannot be initialized here<br />
<br />
Example() {<br />
example_variable = 1;<br />
print_var();<br />
}<br />
<br />
void print_var() {<br />
Print(example_variable);<br />
}<br />
};<br />
//Initialize a class that the game can use<br />
Example ex1 = Example();<br />
ex1.example_variable = 2;<br />
ex1.print_var();<br />
</pre><br />
This script could be included in any of those in Data/Scripts, by writing<br />
#include "path_to_script.as", where path_to_script would just be your script name if it were in the scripts folder.<br />
<br />
It can then be used to create new classes, or use ones defined in your script.<br />
<br />
Writing you scripts separate from the game files makes your code easier to develop and update!</div>Aaorris