Jump to content

ZT EMU API


Goosifer

Recommended Posts

Very interesting! I hope you're able to make a good tool out of this. :studsmatta:

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

New semester new updates.

 

State of EMU API:

- Coded custom keybinding support. Modders will be able to code new hotkeys for things. Support for single keys, double key presses, triple.

- Lua scripting support currently in progress. Only thing holding up release.

- CTRL + J brings up a command console. Enter commands to do things to Zoo Tycoon you couldn't do before.

 

Current commands:

- addtobudget: enter a custom value for more zoo money

- pause: pause the game from the command console

- play: resume game after pausing

- minimapsize: change the size of the minimap for greater control of your map positioning. Examples:

mapview1.jpg

mapview2.jpg

mapview3.jpg

- statsmon: get your zoo stats for the full 12 months not just last 6

 

There are additional commands just for show but their functionality is already in the game.

 

First mod using EMU is on the way:

- Goosifer's Money Cheat. Press CTRL + M for $1,000,000 at a time. No breaking fences. Thank you to Jay for testing!

- Will be released on first release of EMU.

 

A tiny teaser (won't see this in first release):

rotatingfoodstands1.gif.bd17fe482cb257de0f227c06de19d4f0.gif

 

Still lots of testing to do and a few kinks to this but you're seeing a stand rotated after placement.

 

Sorry it's taken a while. EMU was meant to release over the summer but I became addicted to coding Zooberry and making normal ZT1 mods like all the cool kids were doing. 😎

  • Love 2
Link to comment
Share on other sites

Savannahjan

Looking good!  I love the minimap concept.  So, when this is completed, where do we 'install' it?   Us old farts will need a long, patient, kindergarten level tutorial.  :post-8-0-19938100-1501430326:

  • Haha 1
Link to comment
Share on other sites

For EMU itself it just drops into the Zoo Tycoon directory as if it were a lang .dll. It's also a .dll. EMU on its own isn't very interesting but regular users might like the commands it comes with as described above.

 

For mods that rely on EMU, there will be a new folder you would need to create called '/scripts' inside of the Zoo Tycoon directory. My cheat mod for example would drop into this folder.

 

I'll make a detailed guide on release but it will all just be drag and drop!

  • Thanks 2
Link to comment
Share on other sites

13 hours ago, Savannahjan said:

Looking good!  I love the minimap concept.  So, when this is completed, where do we 'install' it?   Us old farts will need a long, patient, kindergarten level tutorial.  :post-8-0-19938100-1501430326:

 

Worse it really needs to be in Pukkanese I have still no clue what this is all about :bloos1:

Link to comment
Share on other sites

6 hours ago, pukkie said:

 

Worse it really needs to be in Pukkanese I have still no clue what this is all about :bloos1:


EMU gives modders new tools to make new kinds of mods or downloads they couldn’t do before. I’m making that cheat mod described above for example. Creating new shortcuts for the game is currently not possible, let alone inserting more money on-the-fly. (Not through configuration anyway)
 

For regular users EMU also has a few tools you can summon ingame to make changes to the game as you play. For example: give yourself unlimited money. 
 

This is Jay’s idea but if I can figure out where the ini settings are stored in memory, it would be cool if you could update them without backing out of the game to edit the ini settings file. These are the kinds of things this project is interested in. 

  • Like 1
  • Love 1
Link to comment
Share on other sites

I'm going to start publicizing my releases--the API is in a place now where people can play around with it and I could always use the feedback if anyone is willing to test.

 

As always: special thanks to Jay for his invaluable help testing, his concerns, and you honestly can't beat his programming experience. Special thanks to @finnethen and @Gymnasiast -- being able to trade notes with others working on similar projects has been incredible.

 

EMU v1.0.0-alpha.2

 

This release is just for those interested with playing around with the command console. Notice it's currently in alpha. The full v1.0.0 will be released once Lua scripting support is fully implemented-it's currently in-progress.

Full releases will be published at ZooTek, Github, and ZooBerry. Alpha releases only on Github. If this is all confusing to you: no worries. On full release I'll publish a few tutorials explaining how this all works including a proof of concept mod some people might enjoy.

 

  • Like 3
Link to comment
Share on other sites

I'll see if I can release EMU v1.0.0-alpha.3 by Sunday this weekend. Depends on how the scripting support is coming along. If I'm efficient maybe I can get v1.0.0 out sooner than later. I've got Lua scripts running inside of EMU (and therefore Zoo Tycoon), the only barrier now is exporting my C++ functions to be usable in Lua--still working out the kinks.

 

This is already old but here's a hypothetical script running on EMU:
 

-- custom function!: hello world!
function hello_world()
    io.write("Hello from another function!\n")
end

-- custom function!: extra challenging!
function guest_thirsty_me_sad ()
    if (NumThirstyGuests > 15)
        AddToBudget(-500000)
    end
end

-- runs in perpetuity
function emu_run ()
    guest_thirsty_me_sad()
    hello_world()
end

-- only runs once
function emu_graze ()

end

 

Translation: add a rule that says: if more than 15 guests are thirsty, penalize me -$500,000! This is something you'd write if you wanted to code a mod that adds some challenges. The API is only capable of simple rules for now.

 

The idea is that a modder using EMU will want to write all of their (executable logic) inside of emu_run if they expect their logic to update frequently. emu_run executes on the EMU main loop. A modder will code inside of emu_graze if they only want their code to run once at the beginning of a zoo load.

 

I'm not sure how many programmers frequent these boards, so if you are one and have any ideas, critiques, insults, please throw them my way!

 

The source code is available here: https://github.com/openztcc/EMU

Link to comment
Share on other sites

EMU v1.0.0-alpha.3

This release adds Lua scripting support to Zoo Tycoon 1.

New Features

  • exit command will now hide the command console window
  • The command console is running even when 'closed'. This allows scripters to log messages to console.
  • Lua scripting support has been added. 25 EMU API functions are accessible through scripts.
    • See the wiki for early Lua scripting documentation. More coming as full release gets closer.

Limitations to Consider

  • With command console changes, closing the console with the window 'X' will still force close the game. exit no longer frees the console thread. A possible fix in a coming update.
  • The command console does not exist until first called by CTRL + J. This prevents Lua scripts from displaying messages to console unless it has been opened at least once. This will change.

Bug Fixe(s)

  • pause command now pauses the game through UI. Note: it doesn't activate the 'play/pause' button yet but otherwise works.
  • EMU now only runs when zoo is loaded. Previously could access unallocated resources. Was not ideal.

Download:

https://github.com/openztcc/EMU/releases/tag/v1.0.0-alpha.3

 

(Still confused? No worries! Videos and documentation will be available on full release.)

Link to comment
Share on other sites

  • 1 month later...

EMU v1.0.0-alpha.4

New Features

  • Can now load multiple .emu scripts (Lua) from a /scripts folder inside of the Zoo Tycoon 1 root directory.
  • Scripts can now be named anything.
  • Better error logging. Most error logging created from the binary res-EMU.dll will be logged in a file called out.txt inside of the Zoo Tycoon 1 directory.

Targets For Next Release

  • Address possible issues with race conditions
  • Improve error logging
  • Improve script handling

Limitations to Consider

  • Possible issues with race conditions as suggested above.
  • Scripts have problems using the EMU console and will force it to exit if you have logging printing to the terminal in your scripts.

If you wish to try this release out, the binary release bundle below includes a /scripts folder with two sample .emu scripts. Both test for a budget condition and subtract money if true. I tried to make these easy tests with quick visual cues.

 

Download here: https://github.com/openztcc/EMU/releases/tag/v1.0.0-alpha.4

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
×
×
  • Create New...