Community Forum

Create Input Box

Forum Overview >> Scripting

CategoryScripting
Created25.05.2016 04:09


Mike Kurowski (Unknown) 25.05.2016 04:15
I have a script mod that my wife and I have created for Farming Simulator (video link- https://youtu.be/kx9n4nfu9GI). It works exactly as we have structured it- tasks are read from a config XML file, we can check mark completed tasks, and we can change the letterhead.

Our issue is we would like to create a simple "input box" where the player can input each task and it appears on the page. I have scoured quite a few threads and documentation. While I have a method we use in another game engine we develop games in, this method does not work for Farming Simulator.

Could someone point us to where to look for creating a simple input box that Farming Simulator will use? I just need to know if such a thing can be done and a rough example. I can code the rest as I will need to take the input and have it saved to the config file. I just cannot seem to locate anything on this particular item.

Regards,

Mike [aka BlackFox]

Emil Drefers (Unknown) 25.05.2016 06:48
Hi,

as I see it right now you would have to code the "input box" yourself.

You've probably seen the keyEvent() function somewhere?
With that you could build up the "input string".


Cheers,
Emil

Mike Kurowski (Unknown) 25.05.2016 16:20
Hello Emil,

Thank you for your time. I have been looking at this script of ours for a while trying to figure out where exactly to start for coding an input box. I will try again using your suggestion.

Regards,

Mike

Fabio Celsa (fcelsa) 26.05.2016 08:19
Hi Mike,

do you think this piece of code (from DeckerMMIV's VeGS) is interesting for you ?

if self.isModifying then
-- and in editing-mode, so rename group-name
VehicleGroupsSwitcher.groupIdxToRename = self.prevAction[1]
g_gui:showGui("ChatDialog")
g_chatDialog.textElement:setText(VehicleGroupsSwitcher.groupNames[VehicleGroupsSwitcher.groupIdxToRename])
else
...



Mike Kurowski (Unknown) 28.05.2016 06:47
Hi Fabio,

I was in contact with Decker_MMIV about his method. While I can mimic his method to do the same, the problem is his config file that VeGS creates is structured different than mine. My script allows the player to edit the config file by A) pressing ESC and tabbing to file location; B) open file and edit fields, save file; C) return to game and the script updates the entries by reloading the config file. Since I have defined specific "tags" in the XML config, it would not be easy to change Decker's methods to suit ours.

All I was hoping for was a way (or method) to provide a way to type a string and have it written to the file and the script reloads that and updates according. Since I have structured our taskLog to where it is at, I think the only way to try is to create a "virtual keyboard" where I can define preset choices and allow the user to select choice and have it recorded to the taskLog. Similar idea to how we can select seed on seeders or how some fertilizer spreaders allow users to specify width.

In a perfect world, a method to "type a string" and save to file would have been perfect, but it seems that is no easy task in this game.

Thanks for your idea though. It is appreciated.

Regards,

Mike

Mike Kurowski (Unknown) 29.05.2016 14:38
Hello Emil,

Just want to thank you for giving my wife and I something to think about with your post earlier. We managed to rewrite our script and have the ability to have our taskLog update in game. The nice thing too is that our script is backwards compatible, meaning we have it in our FS13 and FS11 as well as FS15.

https://youtu.be/35pY3810Ktw

Thank you again for your time. We appreciate it.

Regards,

Mike

Emil Drefers (Unknown) 30.05.2016 07:35
Hi,

you are very welcome!

I guess that your mod might make some MP teams very happy.

Well, you could still try to get some manually inserted tasks.
Did you try to use the keyEvent() function?
It should give you the ability to react on key strokes.
With that you can simply add the strokes to a string and do what ever you want to do with it :)

Cheers,
Emil




Fabio Celsa (fcelsa) 30.05.2016 15:26
Hi Mike,

you have another option to see how the things are made:
courseplay source, I think.
Take a look at the end of inputCourseNameDialogue.lua

Your mod idea is great, Bravo!
if I can be useful in some way, I'll be happy

Bye,
Fabio.



Mike Kurowski (Unknown) 01.06.2016 02:05
Hi Fabio,

That is true, and we did look at that. However, our latest method now allows us to have the taskLog we made in not only FS15, but FS13 and FS11.

Thanks


Note: Log in to post. Create a new account here.