start a script using keyboard

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
Pandafox
Posts: 268
Joined: Wed Apr 11, 2012 11:25 pm
Location: France
Contact:

start a script using keyboard

Post 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 ?
User avatar
Asteroth
Posts: 471
Joined: Wed Oct 24, 2012 10:41 am
Location: Eastern U.S.

Re: start a script using keyboard

Post by Asteroth »

Wooooow,(imagine a baby elephant staring at you saying wow) Woooooww, wooow.

That would blow my mind.
I am the God of darkness and corruption.
viewtopic.php?f=14&t=4250
User avatar
Pandafox
Posts: 268
Joined: Wed Apr 11, 2012 11:25 pm
Location: France
Contact:

Re: start a script using keyboard

Post 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 ??
User avatar
Asteroth
Posts: 471
Joined: Wed Oct 24, 2012 10:41 am
Location: Eastern U.S.

Re: start a script using keyboard

Post 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.
I am the God of darkness and corruption.
viewtopic.php?f=14&t=4250
User avatar
Pandafox
Posts: 268
Joined: Wed Apr 11, 2012 11:25 pm
Location: France
Contact:

Re: start a script using keyboard

Post 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.
User avatar
Asteroth
Posts: 471
Joined: Wed Oct 24, 2012 10:41 am
Location: Eastern U.S.

Re: start a script using keyboard

Post 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.
I am the God of darkness and corruption.
viewtopic.php?f=14&t=4250
User avatar
montagneyaya
Posts: 103
Joined: Tue May 01, 2012 11:08 pm

Re: start a script using keyboard

Post by montagneyaya »

With the onDrawGui create a "shout" button, and deal monster's scare with timer to move it away from the party
User avatar
Asteroth
Posts: 471
Joined: Wed Oct 24, 2012 10:41 am
Location: Eastern U.S.

Re: start a script using keyboard

Post by Asteroth »

Aaagh! New systems for me to figure out! It burns!
I am the God of darkness and corruption.
viewtopic.php?f=14&t=4250
User avatar
JohnWordsworth
Posts: 1397
Joined: Fri Sep 14, 2012 4:19 pm
Location: Devon, United Kingdom
Contact:

Re: start a script using keyboard

Post 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,
}
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
User avatar
Pandafox
Posts: 268
Joined: Wed Apr 11, 2012 11:25 pm
Location: France
Contact:

Re: start a script using keyboard

Post 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 ;)
Post Reply