Page 1 of 2

start a script using keyboard

Posted: Wed Dec 19, 2012 7:06 am
by Pandafox
hi all,

I wonder if it is possible (in game) to start a function script by pressing a key on the keyboard...
For exemple, I would like to start the function "shout" by pressing R key... is it possible ?

Re: start a script using keyboard

Posted: Wed Dec 19, 2012 7:44 am
by Asteroth
Wooooow,(imagine a baby elephant staring at you saying wow) Woooooww, wooow.

That would blow my mind.

Re: start a script using keyboard

Posted: Wed Dec 19, 2012 8:01 am
by Pandafox
Asteroth wrote:Wooooow,(imagine a baby elephant staring at you saying wow) Woooooww, wooow.

That would blow my mind.
:shock: :?: :?: :?:
sorry, I really don't understand your sentence..... is it something about the question ??

Re: start a script using keyboard

Posted: Wed Dec 19, 2012 8:57 am
by Asteroth
sorry, I really don't understand your sentence..... is it something about the question ??
No, no. I'm quite insane.
Sorry doing that really would be impressive to me. All of the weirdness is because I'm weird. As for the question, some coders here might be able to handle that but I am sure it would be hard.

Re: start a script using keyboard

Posted: Wed Dec 19, 2012 9:08 am
by Pandafox
You seems to be a strange person... :D

My english is not perfect then sometimes I can't understand jokes, images things or things like that...
It makes me a little confused sometimes :roll:

About my question, it could be very interesting to do. I am thinking about a "shout" function to scare monsters (same as DM). It could be useful to make some "monsters pressure plates" puzzles.

Re: start a script using keyboard

Posted: Wed Dec 19, 2012 9:55 am
by Asteroth
I think komag is the most likely one to figure this out (though obviously there are many talented people here). Despite my lack of scripting knowledge I have taken a look since I did make myself involved here. So far nothing.

Re: start a script using keyboard

Posted: Wed Dec 19, 2012 10:37 am
by montagneyaya
With the onDrawGui create a "shout" button, and deal monster's scare with timer to move it away from the party

Re: start a script using keyboard

Posted: Wed Dec 19, 2012 10:42 am
by Asteroth
Aaagh! New systems for me to figure out! It burns!

Re: start a script using keyboard

Posted: Wed Dec 19, 2012 3:34 pm
by JohnWordsworth
I don't think it would be wise to hook actions into a keyboard command specifically (some users might be playing with only the mouse - especially if LoG goes to iPad one day!). But using OnDrawGui from the 1.3.6 Beta version would be a pretty cool solution. You could easily add a button to the corner the screen say to shout.

Hacking up Petri's original DrawGui script while I'm at work makes me think something like the following would work.

Code: Select all

cloneObject{
   name = "party",
   baseObject = "party",
   onDrawGui = function(g)
      -- draw transparent background
      g.color(30,30,30,150)
      g.drawRect(30, 30, 120, 60)

      -- draw button with text
      g.color(128, 128, 128)
      g.drawRect(40, 40, 100, 40)
      g.color(255, 255, 255)
      g.drawText("Shout!", 50, 30)

      -- button logic
      if g.button("button1", 40, 40, 100, 40) then
         your_script:shout();
      end
   end,
}

Re: start a script using keyboard

Posted: Wed Dec 19, 2012 3:54 pm
by Pandafox
I can't get the 1.3.6 yet because I bought my game on GOG...
But your idea seems to be brillant ;)