Skip to content

Commit

Permalink
Merge pull request #20 from Jimbly/v1.61
Browse files Browse the repository at this point in the history
Installed VeggieTales v1.61, moves all script assets into images subfolder.
  • Loading branch information
Vaevictusnet committed Apr 11, 2012
2 parents 50be53e + 6575c97 commit e0efcd5
Show file tree
Hide file tree
Showing 580 changed files with 3,605 additions and 3 deletions.
14 changes: 11 additions & 3 deletions .gitignore
@@ -1,3 +1,11 @@
/VeggieTales/settings.txt
/VeggieTales/stats.txt
/VeggieTales/history.txt
/VeggieTales/settings.txt
/VeggieTales/stats.txt
/VeggieTales/history.txt
/VeggieTales/data/*.bin
/VeggieTales/data/talescripts_version.txt
*.000
*.001
*.002
*.003
*.004
*.005
35 changes: 35 additions & 0 deletions VeggieTales/LICENSE.TXT
@@ -0,0 +1,35 @@
VeggieTales is distributed under the MIT License

Copyright (c) 2008-2012 Jimb Esser, Various Authors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.


Portions made with FMOD Sound System, copyright � Firelight Technologies Pty, Ltd., 1994-2009.

LUA Copyright (C) 1994-2008 Lua.org, PUC-Rio, see http://www.lua.org/license.html

Portions made with the Simple DirectMedia Layer library distributed under the terms of the GNU LGPL license:
http://www.gnu.org/copyleft/lesser.html

libPng Copyright (C) 1996-2008, various authors

zlib Copyright (C) 1995-2004 Jean-loup Gailly and Mark Adler

libGlov and libUtil (c) 2005-2012 Jimb Esser, various authors under the MIT license, http://www.opensource.org/licenses/mit-license.php
98 changes: 98 additions & 0 deletions VeggieTales/ScriptingReference.txt
@@ -0,0 +1,98 @@
This is documentation for editing scripts. For general usage and macro information, see [[Jimbly's Macros]]

This reference is now included in the VeggieTales installer under the file name
ScriptingReference.txt

== General Philosophy ==

Most of the existing macros and the macroing interface are all built around a
few primary goals:
* No keyboard interaction. While a macro is running, the user should be able to freely chat with their friends, navigate between guild tabs, etc.
* Image recognition over offsets. Where possible, read and scrape the screen to find the exact image we want to click on instead of hardcoding pixel offsets that might change based on resolution or other factors. The downside of this is that it is more susceptible to minor changes in ATITD causing the macros to work.
* Status and prompts. Friendly prompts about what values are desired are easy to add, and much better than telling someone to edit the script to handle the values they desire.

== API ==

The functions prefixed with "ls" (short for "LUA script", which makes more sense
in the C++ code, as opposed to the actual macros where *everything* is lua
script...) generally operate on the VeggieTales window, so lsGetWindowSize()
gets the width and height of the VeggieTales window.

The functions prefixed with "sr" (short for Screen Reader) generally operate on
the ATITD window, so srGetWindowSize() gets the width and height of the ATITD
window.

* Note that you *MUST* call srReadScreen to update the screen before calling srFindImageInRange etc.

== Function List ==
=== General ===
void lsSetCaptureWindow()
void lsSleep(int ms)
=== Sending Input ===
void srClickMouse(int x, int y, bool bRightClick)
void srClickMouseNoMove(int x, int y, bool bRightClick)
void srKeyEvent(const char *s)
void srLeftArrow()
void srRightArrow()
void srUpArrow()
void srDownArrow()
void srDrag(int x0, int y0, int x1, int y1, bool rightClick)
void srSetMousePos(int x, int y)
void srMouseDown(int x, int y, bool rightClick)
void srMouseUp(int x, int y, bool rightClick)
Vec2 srMousePos()
=== Screen Reading ===
Vec2 srGetWindowSize()
Vec2 srImageSize(const char *fn)
void srMakeImage(const char *name, int x, int y, int w, int h)
Vec2 srFindImage(const char *fn, int tol)
void srShowImageDebug(const char *fn, float x, float y, float z, float scale)
Vec2 srFindImageInRange(const char *fn, int x0, int y0, int w, int h, int tol)
void srReadScreen()
int srReadPixel(int x, int y)
int srReadPixelFromBuffer(int x, int y)
void srSaveLastReadScreen(const char *fn)
void lsShowScreengrab(const char *_color)
Vec2[] lsAnalyzePapyrus(int minsize, int maxsize, int debug, int relevant_radius)
Vec2[] lsAnalyzeSilt(int minsize, int maxsize, int debug, int relevant_radius)
=== User Interface ===
int lsScreenX
int lsScreenY
Vec2 lsGetWindowSize()
Vec2 lsMouseClick(int x, int y, int w, int h, int button)
void lsPrintln(const char *s)
bool lsShiftHeld()
bool lsAltHeld()
bool lsControlHeld()
void lsPlaySound(const char *sound)
int lsPrint(int x, int y, int z, float xsc, float ysc, const char *color, const char *str)
void lsFontShadow(int on)
int lsMessageBox(const char *title, const char *msg, int buttons)
int lsPrintWrapped(int x, int y, int z, int w, float xsc, float ysc, const char *color, const char *str)
void lsDisplaySystemSprite(int tile, int x, int y, int z, float w, float h, const char *color)
bool lsButtonText(int x, int y, int z, int w, const char *color, const char *txt)
bool lsCheckBox(int x, int y, int z, const char *color, const char *txt, bool value)
int lsDropdown(const char *key, int x, int y, int z, int w, int val)
void lsScrollAreaBegin(const char *key, int x, int y, int z, int w, int h)
void lsScrollAreaEnd(int h)
void lsSetCamera(float x0, float y0, float x1, float y1)
void lsDoFrame()
void lsTopmost(int value)
{bool done, selection} lsEditBox(const char *key, int x, int y, int z, int w, int h, float xsc, float ysc, const char *color, const char *def)
int lsGetTimer()

== Specific reference ==
=== void srKeyEvent(const char *s) ===

Sends a character or sequence of characters to the captured window. Example:
loadfile("luaScripts/screen_reader_common.inc")();
function doit()
askForWindow();
lsSleep(250); -- wait for shift release to make it to the window
srKeyEvent('username\tpassword');
lsSleep(250); -- wait a moment before submitting so we can see it work, that's more fun!
srKeyEvent('\n');
end
This will send the string "username" followed by a tab (\t) and then the string
"password" and then enter (\n).

135 changes: 135 additions & 0 deletions VeggieTales/ThistlesReference.txt
@@ -0,0 +1,135 @@

Below is the process I would recommend for starting to make thistles:

== Prerequisite: Understand the basics ==
Using the information on the [[Thistles]] page and related guides, you should:
# Understand Thistle types (e.g. A-B-C+F~N~P+T+) and Thistle requirements (e.g. A-C+N~P+)
# Be able to use ThistleSim.xls to simulate a recipe and see the results
# Generate a simple recipe (try to make anything other than A-B-C-F-N-P-T-) and run it by hand on a single [[Thistle Garden]]
# Understand what a "void" is (a rule that is not active for an in-game week (~2.5 real days)
# Be confused as to how anyone makes all of their complicated recipes by hand (optional)

In order to be most productive, I would also expect you to have access to:
# Multiple [[Silkworm Farm|Silkworm Farms]] (I am generally tracking 10-20, only a subset of these have requirements that can be made any given week), though this approach will work even if you have just 1 or 2.
# Around 20 [[Thistle Garden|Thistle Gardens]] (there are numerous public arrays of Thistle Gardens you can use, you shouldn't need to build these yourself).

== Install VeggieTales ==
Download and install VeggieTales from [[Jimbly's Macros]]. ''VeggieTales'' is my macroing program, with some other fun tools (like the Thistle Recipe Generator) built in as well. Currently this is on Windows only, but I can provide almost-portable source code for anyone who is interested in helping port it to Linux/MacOS, just [[User:Jimbly/Contact|ask]].

== Enter your requirements ==
Open up ''config_thistle.txt'' (in the VeggieTales installation directory), and you will find a list of desired requirements. You should remove the existing ones in there (they are probably whatever I was looking for when I last made a build), and replace them with your own. You can have blocks of requirements with different labels to make the output easier to read, e.g.:
desired "label:My farms"
desired A+B+C+F+
desired B-C+F+T~
desired "label:Guild farms"
desired C-F+N~T+

== Generate no-void recipe(s) ==

Near the top of thistle_config.txt there will be a bunch of lines indicating each of the rules and whether they are on or off. Change all of these to "1" to enable the rules. Then, launch ''VeggieTales'', and click ''Thistle Mode''. This will churn away for a while, and after 40 ticks will have written out a history.txt file containing any recipes found (with no voids, it will find recipes for most requirements).

Open history.txt, and scroll down to the bottom, and find a requirement you're looking for, there will be a line like:
Best for A+B+C+F+: 1000/17 (D)
The two numbers are how many actions (water in this case) must be done to run this recipe, one number being how many if it's run at night, the other during the day, with ''1000'' indicating it did not find a recipe. In this case, this recipe can only be run during the day (also indicated by the ''(D)'').

Search upwards in the file for the previous occurrence of your requirement, and it will be the best recipe it wrote out (it may have written multiple, and if there is one for each day and night, then search to find one which has an appropriate sun value).

== Reading the recipes ==

The first of what is in history.txt is a full history of every action that was done and the state at each tick, which is mostly useful only when debugging a broken recipe. Below that is a bunch of lines like:
0,0,1,0,33
0,0,0,0,33
0,0,0,2,99
0,0,1,0,99
These are the actual recipe. The can be copy and pasted directly into ThistleSim (the 41 lines and 5 columns for inputs), and also into a macro to run the recipe.


Note: If you are have problems copying the recipes into ThistleSim (ie it tries to put all the data into one cell), then try my web page for converting the commas into tabs. It will then paste correctly. Just paste the output into Line 3, Cell B of the master section. ~Cegaiel

Conversion page: [http://sharpnetwork.net/atitd/jimbly2sim.asp http://sharpnetwork.net/atitd/jimbly2sim.asp]

== Verify your recipe ==

Copy the recipe into ThistleSim and make sure the output is what you'd expect (note that ThistleSim might erroneously say the final result is a "-" when it's really a "~" if a value is in the range of 20.01-22). Leave ThistleSim open (on another monitor or another computer is best!) for comparison to what actually happens in game.

== Run a recipe via macro ==

Now you want to actually run your recipe on a thistle garden! If the recipe is cheap (only sun/water, which they should be if you've been following this tutorial so far), you may want to run it on multiple thistle gardens (though if something goes wrong and you need to abort them all, that can be annoying). I generally just run 1 or 2 thistle gardens when testing a new recipe.

Open luaScripts/thistle_custom.lua in any text editor. Near the top are a few values to change, specifically the number of gardens you have open, the current sun value on those gardens (if it's night, set it to 0, if it's daytime and the lid is open, set it to 99, if it's daytime and it's closed, set it to 33 - all gardens must be in the same state), and the instructions to run the recipe. Paste the recipe over the one that already exists in the macro.

To run the macro, you need to open and pin some number of thistle gardens, make sure they are either not overlapping, or overlapping such that you can still see the buttons to add H2O/Oxy/etc regardless of which window is in the front. The easiest is to just not have them overlapping if you do not understand (hopefully screenshots coming soon). Then, fire up ''VeggieTales'', choose ''LUA Scripts'', thistle_custom.lua, and enter the number of passes to run (start with just 1 if testing voids). As directed in the program, click on the ATITD window to put it in focus, and press Shift, and the macro will start running.

This macro (like all of mine) only use mouse clicks which means that while the macro is running, you can freely chat within ATITD by typing and using F9/F10 to switch between tabs.

== Determine voids ==
If someone else has already determined the voids for this week (see [http://sharpnetwork.net/atitd/calendar.asp http://sharpnetwork.net/atitd/calendar.asp]), you can simply jump ahead and enter the voids into the config file. Generally those who determine the thistle voids place the information in their info text. Try /info <b>Tribisha</b> or /info <b>Nissim</b> to see if we have the voids for this week.

When you are watching your recipe run, compare the results happening in-game with the results you see in ThistleSim. If you don't have two computers side-by-side, you may want to save screenshots every 8 ticks or so. If there is a tick in which the results differ, you need to determine which rule, when voided, would cause that result. The way I do this is to go down the list of rules, and try turning each one off and then back on. Generally, one of 3 things will happen:
# Nothing will change, or only later ticks will change - we gain no information about this rule
# One of the earlier ticks will change - we now know this rule ''must'' be active, flag it (I just put a comment in the column to the right of the rule), and you know you don't need to test it later
# The tick which differed will change to be what you see in-game - we now know this rule must be voided.
It's possible that no single rule will get the result you saw in-game, in which case it might be a pair of 2 rules voided, both active on the same tick, causing the result. By looking at what actual vitamins differ, and what rules cause/create them, you should be able to logic out what pair of rules it is, but this is less common.

Repeat this process until the results in ThistleSim look exactly like what happened in game.

If the results were identical, you have found all of the voids (or, at least, the ones which will affect your current recipe), move on to making them in bulk!

== Enter voids and generate recipe(s) again ==
Chances are, if you found a new void, your recipe did not make the thistles you were looking for. Enter the voids into config_thistle.txt (there should be a '''0''' next to each rule with is voided, '''1''' next to each which is active, just like in ThistleSim), and generate recipes again.

== Run recipe in bulk via macro ==

Now, you have a recipe that works, and you've run it in a macro on a couple gardens, you want to run it on lots of gardens at once!

First, open and pin a bunch of garden windows. The macro window_opener.lua will help with this. Turn ON the ATITD Option ''Right Click opens menu as pinned'' under Options | Interface before running this macro. Then if you have a grid of thistle gardens, in just seconds it can open pinned menus for every one of them.

Next, arrange them to make the macro happy. The macro window_arranger.lua will help with this, though you can also do it by hand. For thistle_custom.lua, you will need to edit window_arranger.lua to use dy = 190, and num_high = somewhere between 3 and 5 depending on your resolution. Changing the line ''if nil then'' to ''if 1 then'' should take care of this.

'''''[optional]''''' The other option is to use a new macro I'm actively testing, thistle_new.lua, which can handle many more gardens, but is more susceptible to lag issues (I can run around 32 thistle gardens simultaneously reasonably reliably). For this macro, the window positions are much more finicky, so you must arrange them with window_arranger.lua (just need to edit num_high to an appropriate number for your screen, 33 high should fit at 1920x1200). Only one row of cascaded windows is currently supported, so close any extra windows that didn't get lined up in the one cascaded row.

Now, edit thistle_custom.lua again to make sure it has the right number of gardens, and has the current state of the sun for all of your gardens, and then run it to your hearts content!

== Profit ==
(but not too much, help out your neighbors as well, please)

== Unsticking farms with "expensive" recipes ==




== Convert Chest contents into Stock format==
I have added a webpage that will let you copy (Utilty menu - Copy contents to clipboard) your chest contents and convert them into the format needed for the stock section in config_thistles.txt . Note the stock is optional. But all recipes generated in history.txt will display any thistles you may have in stock already (that match the recipe). This is handy when you have many different thistles. Manually replacing or editing by hand gets tedious. ~Cegaiel


Conversion page: [http://sharpnetwork.net/atitd/jimblychest2stock.asp http://sharpnetwork.net/atitd/jimblychest2stock.asp]



Example clipboard contents of chest:

<pre>
25 Thistle:A+B+C-F-N-P-T-
5 Thistle:A+B+C~F+N-P-T~
30 Thistle:A+B-C+F~N+P-T+
20 Thistle:A+B~C~F+N-P-T~
5 Thistle:A-B+C+F-N+P-T-
65 Thistle:A-B+C+F-N-P-T-
20 Thistle:A-B+C-F+N-P-T-
5 Thistle:A-B+C-F+N-P-T~
230 Thistle:A-B+C-F+N~P-T-
</pre>

Converted format, ready to paste into config_thistles.txt:

<pre>
Stock "25 A+B+C-F-N-P-T-"
Stock "5 A+B+C~F+N-P-T~"
Stock "30 A+B-C+F~N+P-T+"
Stock "20 A+B~C~F+N-P-T~"
Stock "5 A-B+C+F-N+P-T-"
Stock "65 A-B+C+F-N-P-T-"
Stock "20 A-B+C-F+N-P-T-"
Stock "5 A-B+C-F+N-P-T~"
Stock "230 A-B+C-F+N~P-T-"
</pre>
Binary file modified VeggieTales/Uninstall.exe
Binary file not shown.
Binary file modified VeggieTales/VeggieTales.exe
Binary file not shown.

0 comments on commit e0efcd5

Please sign in to comment.