Nod Engine SDK => Scripting and Modifying => Topic started by: fenix507 on 2013-01-11, 23:19:33

Title: Possible to open console via script?
Post by: fenix507 on 2013-01-11, 23:19:33
Hey guys,

For a mod I'm working on, I'm interested in giving some disciplines and abilities greater flexibility by allowing the user to choose from a generated list of options.  Let's say the character script contains an array for different recipes learned.  When a character learns a recipe, each represented by an integer, that recipe is added to the array.  When the player casts the craft ability, what I would like to do is open the console, as by pressing the '~' key, while simultaneously showing the available recipes.  For example: if the array contains [1,2,7], casting the craft command would display:

1: Cobble Shoes
2: Make Macaroni
7: Craft Nuke

Then, the player enters a number in the console which is captured by the stcommand procedure and then the number entered is compared against the array to make sure the player actually has the recipe and then the script for the recipe is called (which checks if the necessary ingredients are in the player's inventory and performs the requisite roll) and the object created.

My trouble is that I can't find a way to activate the console from Redemption.  I don't think there is a keypress procedure or detector in java 1.18. Any way I can get that console open, from a java command or forcing a ~ keypress or any other redemption-compatible workaround?  Hope you guys can help.  Thanks for taking the time to read.

Practical applications: Crafting (as above but less silly), Chimerstry (casting level 1 shows you a list of illusions you can create and higher levels cast on the created illusion make it animate, collide, etc.), Vicissitude (choosing a bodypart or effect to create with different levels of the discipline), Bloodlines style conversation nodes (pick a response from the list, and use java to test if the requisite skills/disciplines are available to display the option.), travel system, etc.
Title: Re: Possible to open console via script?
Post by: Javokis on 2013-01-14, 12:52:22
Paine might be your man for figuring out Java's input codes as I don't mess with it much. Paine often hangs out at planet-vampire.net. The big issue with this idea is how "clients" in multiplayer would handle it. In that cause, I do recall Mordred making a "hack" script that can find text inputs in the "chat log." Clients can NEVER access console so byte intercepting the chat log might be a better bet if you intend to make this compatible with multiplayer. Note: Mordred has been incommunicoto for quite some time. You might have a better chance of making the recipes as ITEMS that must be equipped then the script can look for that instead. That way the player makes choices based on what recipe they equip. Trying to do Java input detection can at times be tenuous at best. Equipping ITEMS might be your best bet at pulling this off.

Best of luck to you.
Title: Re: Possible to open console via script?
Post by: fenix507 on 2013-01-15, 20:46:31
Thanks Javo.  I'd been thinking mostly about SP, but I'd like it to be MP-compatible as well.  Thanks for the heads up on that.
Title: Re: Possible to open console via script?
Post by: Paine on 2013-01-24, 11:17:11
This isn't possible via the game's java implementation as most of the java library is not included.
Morded's server-side mod for chat commands read the network data (via an external program) and wrote out a file which was picked up by the java code to act on. This should be fairly simple to replicate but wouldn't work for single player.