command for typing text in the command bar via script

Avantar
31 Oct 2014, 13:44I know I saw it on the forums in more than one occasion, but I am struggling to find it.
What I want to do:
I am not going to have a command bar in my game, but I would like to mimic as if I would type in the command prompt: 'put this into that'
I know there is a command for it like: Command: put this into that - just not sure where to look and I cannot remember.
Any help will be appreciated.
What I want to do:
I am not going to have a command bar in my game, but I would like to mimic as if I would type in the command prompt: 'put this into that'
I know there is a command for it like: Command: put this into that - just not sure where to look and I cannot remember.
Any help will be appreciated.

Avantar
31 Oct 2014, 14:18I think I found it:
Haven't tested yet, but I think it is HandleCommand
Haven't tested yet, but I think it is HandleCommand
The Pixie
31 Oct 2014, 14:19If that is it I miss understood you. I wrote this while you were posting, so...
Use this to stop the player being able to type in the command bar, but keep it visible:
JS.eval("txtCommand.readOnly=true;")
Use this to change the text:
JS.eval("txtCommand.value='Some text';")
Use this to stop the player being able to type in the command bar, but keep it visible:
JS.eval("txtCommand.readOnly=true;")
Use this to change the text:
JS.eval("txtCommand.value='Some text';")

Avantar
31 Oct 2014, 14:32I am not sure that I am correct and my first test failed. But in essence, here is what I am trying to do:
I want to type : put sword in chest (and then hit the enter key on the keyboard to execute that command) - Only you are not typing the command but it is executed via a verb, function or command.
I was pretty much hoping for something like: HandleCommnad ("put sword in chest") type of thing.
Reason - My game does not have a command bar and all of a sudden I have the need to put things in a container.
I want to type : put sword in chest (and then hit the enter key on the keyboard to execute that command) - Only you are not typing the command but it is executed via a verb, function or command.
I was pretty much hoping for something like: HandleCommnad ("put sword in chest") type of thing.
Reason - My game does not have a command bar and all of a sudden I have the need to put things in a container.
The Pixie
31 Oct 2014, 15:22I did misunderstand. All you need to do is (you might what to output some text too):
sword.parent = chest
sword.parent = chest

Avantar
31 Oct 2014, 16:34Sure I can script it, but I want Quest to handle it as it handles the put command already.
If I would to type: "put sword in chest" and there are multiple chests, it would list the chests with links you can click on to choose which one you would like to put it in as well as other default text when there is no chest or if the chest is closed and so forth.
So I would want it to handle the input command exactly the same as if I would have typed it in.
In essence I need to put the text into the command bar and press enter automatically via script.
I have seen it done before - for the life of me I can not remember where.
I do thank you for your feedback and assistance.
If I would to type: "put sword in chest" and there are multiple chests, it would list the chests with links you can click on to choose which one you would like to put it in as well as other default text when there is no chest or if the chest is closed and so forth.
So I would want it to handle the input command exactly the same as if I would have typed it in.
In essence I need to put the text into the command bar and press enter automatically via script.
I have seen it done before - for the life of me I can not remember where.

I do thank you for your feedback and assistance.
The Pixie
31 Oct 2014, 17:30I do not get why yiu want to, but this should do it (you were pretty much there, you just need a second parameter, and null will do):
HandleCommand("put sword in chest", null)
HandleCommand("put sword in chest", null)

Avantar
31 Oct 2014, 17:56I am forever grateful. Thanks! 


Avantar
01 Nov 2014, 06:30The Pixie wrote:I do not get why yiu want to, but this should do it (you were pretty much there, you just need a second parameter, and nul
The major reason is that limited chests does not adhere to the limit when using MoveObject or using this.parent = chest. If you are not using 'put', you can cram unlimited items in a limited container.
The Pixie
01 Nov 2014, 16:41You could try this:
if (ListCount(GetDirectChildren(chest)) < chest.maxobjects) {
sword.parent = chest
}
else {
msg("The sword will not fit in the chest")
}

Avantar
03 Nov 2014, 06:27Thank you Pixie. 
I suppose the last problem not mentioned is laziness. lol
There will need to be a for loop as well to select the correct chest or backpack.
There are a few other things in between as well - Will also need to determine if the container is closed or open.
HandleCommand just handles most of it.
But I guess you might just have convinced me to do it correctly.

I suppose the last problem not mentioned is laziness. lol
There will need to be a for loop as well to select the correct chest or backpack.
There are a few other things in between as well - Will also need to determine if the container is closed or open.
HandleCommand just handles most of it.
But I guess you might just have convinced me to do it correctly.
