Author Topic: Spacebar  (Read 3235 times)

0 Members and 1 Guest are viewing this topic.

Offline Doan Sephim

Spacebar
« on: April 23, 2007, 12:27:44 AM »
I want to use the spacebar in a certain room to preform a function other than bring up the keyboard prompt with the retyped last phrase.
I can set it up to do something else easily enough:
Code: [Select]
(if (==(send pEvent:type)evKEYBOARD)
      (if(==(send pEvent:message)KEY_SPACE)
            (RoomScript:changeState(4))
      )
)
But of course the problem is it preforms BOTH the changeState as well as the retype function. I'm not quite sure how to disable the retype function. I will not need it for the room at all...but I will want to bring it back after I leave that room.

Any ideas?


Artificial Intelligence Competition

Offline Doan Sephim

Re: Spacebar
« Reply #1 on: April 28, 2007, 11:45:10 AM »
Alright, I figured I would set a global variable in my main Script. Something like
Code: [Select]
    gArcadeStyle = 0and then at the beginning of rooms in which it is more arcade oriented i could set it to 1 (TRUE) and when I leave those rooms set it back to 0 (FALSE)...pretty darned simple idea, of course.

But the tricky part comes in in finding where the retype code is made to associate with me pressing the space bar. I've searched all the scripts for the relevant code, but to no success. I am not, however, a very educated scripter, so it is possible it slipped right through my fingers...

So does anyone know where this code would be so I can make it inactive when gArcadeStyle is 1 (TRUE)...cuz I can't find it!

Offline Eigen

Re: Spacebar
« Reply #2 on: April 28, 2007, 11:51:55 AM »
In User.sc under  (method (handleEvent pEvent)   of   (class User of Obj

Code: [Select]
       (if(canInput and not(send pEvent:claimed))
(if( (== (send pEvent:message) echo) or (<= $20 (send pEvent:message)) and (<= (send pEvent:message) 255))
(if( (self:getInput(pEvent)) and Parse(@inputStr pEvent))
(send pEvent:type(evSAID))
    (self:said(pEvent))
)
                )
            )

But if you disable it, it's also disabled from the menu. But that's not a biggy.
Artificial Intelligence Competition

Offline Doan Sephim

Re: Spacebar
« Reply #3 on: April 28, 2007, 12:14:19 PM »
Unbelievable! How did I miss that?? Thank!


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.036 seconds with 24 queries.