Key input?
Moderator: Core Staff
Key input?
Is it possible to press keys in a certain order to say open a door? For example, would it be possible to create a script so that if you press "a, b, c, d" a door opens?
It's a long-shot, but I hope someone knows how to do it...
It's a long-shot, but I hope someone knows how to do it...


-
- CJ Worshipper
- Posts: 312
- Joined: December 19th, 2005, 10:58 pm
- Location: ^^^ boom... HEADSHOT?
check it on http://www.modsonline.com

"It's so funny of how I think my life is supposed to be devoid of any sort of heartache or drama or anguish or pain. It's sad but I think that I make a value of my days by the times I wake up and feel somewhat normal, but what I really need to do is get out of this fucking house and get laid."
-
- Core Staff
- Posts: 13315
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
You can only detect input for 3 keys.
UseButtonPressed();
MeleeButtonPressed();
AttackButtonPressed();
you can use these together for eaxmple..
if(self isTouching(trigger) && self useButtonPressed() && self meleeButtonPressed())
Open door.
Basically the script says...
if the user is touching the trigger and they press their use button and their melee button, then the door will open.
Very complicated but it works
(Do not listen to hambones, never go to modsonline, that way I have no use here
)
UseButtonPressed();
MeleeButtonPressed();
AttackButtonPressed();
you can use these together for eaxmple..
if(self isTouching(trigger) && self useButtonPressed() && self meleeButtonPressed())
Open door.
Basically the script says...
if the user is touching the trigger and they press their use button and their melee button, then the door will open.
Very complicated but it works

(Do not listen to hambones, never go to modsonline, that way I have no use here


Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
Ah k, will try it out after I have created all of my hurt triggers.
Do you just know all of this information or do you search for it? lol
I knew there wasn't a chance in hell of me finding it on modsonlineDrofder2004 wrote:(Do not listen to hambones, never go to modsonline, that way I have no use here)



[
Code: Select all
main()
{
thread secretdoor();
}
secretdoor()
{
secretdoor = getent ("secretdoor","targetname");
trigger = getent ("secretdoortrig","targetname");
while(1)
{
trigger waittill ("trigger");
if(self isTouching(trigger) && self useButtonPressed() && self meleeButtonPressed())
{
secretdoor moveZ (112,1,0.5,0.5);
secretdoor waittill ("movedone");
wait(2);
secretdoor moveZ (-112,1,0.5,0.5);
secretdoor waittill ("movedone");
wait 0.5;
}
else
{
wait 0.5;
}
}
}



-
- Core Staff
- Posts: 13315
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Ok, you cannot just put that code anywhere
It needs adapted.
First off, what sort of trigger is it? [Multiple/Hurt/Use]
Also you have not said what "self" is. Self does not directly relate to a player, it can be a trigger if you wanted it to
This may or may not work (I am unsure what the error means)
The thing with the code is, I do not think it will work with 2 people both trying to use the trigger, as the trigger is waiting for 1 person to trigger it and only that 1 person can also open the door.
This is a second idea for it.
Again, this is all semi off the top of my head, so it may not work. Trial and error 

First off, what sort of trigger is it? [Multiple/Hurt/Use]
Also you have not said what "self" is. Self does not directly relate to a player, it can be a trigger if you wanted it to

This may or may not work (I am unsure what the error means)
Code: Select all
main()
{
thread secretdoor();
}
secretdoor()
{
secretdoor = getent ("secretdoor","targetname");
trigger = getent ("secretdoortrig","targetname");
while(1)
{
trigger waittill ("trigger",player);
if(player isTouching(trigger) && player useButtonPressed() && player meleeButtonPressed())
{
secretdoor moveZ (112,1,0.5,0.5);
secretdoor waittill ("movedone");
wait(2);
secretdoor moveZ (-112,1,0.5,0.5);
secretdoor waittill ("movedone");
wait 0.5;
}
else
{
wait 0.5;
}
}
}
This is a second idea for it.
Code: Select all
main()
{
thread secretdoor();
}
secretdoor()
{
players = getEntArray("player", "classname");
for(i=0; i<players.size; i++)
players[i] thread door_think();
}
door_think()
{
secretdoor = getent ("secretdoor","targetname");
trigger = getent ("secretdoortrig","targetname");
while(1)
{
trigger waittill ("trigger",self);
if(self isTouching(trigger) && self useButtonPressed() && self meleeButtonPressed())
{
secretdoor moveZ (112,1,0.5,0.5);
secretdoor waittill ("movedone");
wait(2);
secretdoor moveZ (-112,1,0.5,0.5);
secretdoor waittill ("movedone");
wait 0.5;
}
else
{
wait 0.5;
}
}
}


Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
-
- Core Staff
- Posts: 13315
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
-
- Core Staff
- Posts: 13315
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Give me 3 minutes on your new map and I will have found your secretsPedsdude wrote:It's funny how the most complicated scripting bits are actually secret bits that only I plan to uselmao


Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
Who is online
Users browsing this forum: No registered users and 3 guests