About Store Forum Documentation Contact



Post Reply 
[Code]Two button action
Author Message
Jben Offline
Member

Post: #1
[Code]Two button action
Hello smile

I have a question (just being silly) I would use both the keyboard to activate an action. How encode?

Quote:if(Kb.bp(KB_LSHIFT)-Ms.bp(0))if(........)

Thank you for your help! Sorry for my English, I use GoogleTrad
11-03-2014 09:24 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Houge Offline
Member

Post: #2
RE: [Code]Two button action
Kb.bp is bool.

Maybe try

Code:
if(Kb.bp(KB_LSHIFT) && Ms.bp(0))

But in this case buttons should be pressed at the same time.
11-03-2014 09:34 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Jben Offline
Member

Post: #3
RE: [Code]Two button action
Thank you for your reply Houge smile

I thought about it but no reaction with the key in games

Keep the Shift key pressed and left click on the mouse to set the action..
11-03-2014 09:41 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Houge Offline
Member

Post: #4
RE: [Code]Two button action
No reaction because buttons should be pressed at the same time. If mouse button shall be pressed when shift is down then use

Code:
if(Kb.b(KB_LSHIFT) && Ms.bp(0))
11-03-2014 10:11 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Tottel Offline
Member

Post: #5
RE: [Code]Two button action
Like Houge said, if you want them at the same time, use:

Code:
if(Kb.b(KB_LSHIFT) && Ms.bp(0))

If you want both of them to work seperately, use:

Code:
if(Kb.b(KB_LSHIFT) || Ms.bp(0))

Simply put: && means AND, || means OR.


Also, don't use google translate. Try to translate it yourself, no matter how bad it may turn out to be. At least you'll learn. smile
Also, we don't mind.
11-03-2014 10:29 PM
Find all posts by this user Quote this message in a reply
Jben Offline
Member

Post: #6
RE: [Code]Two button action
Hello, it does not work, I already used "ms.b(0)"
How to detect the player press Shift?

Ex:
Quote: if(Ms.bp(0))if(...action1)
if(Ms.bp(1))if(...action2)
if(Ms.b(0) && Kb.b(KB_LCTRL))if (...action3)
if(Ms.b(1) && Kb.b(KB_LCTRL))if (...action4)
(Shift->Ctrl)
Thank for support smile

(I do not use Googletrad)
(This post was last modified: 11-04-2014 07:28 PM by Jben.)
11-04-2014 07:13 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Houge Offline
Member

Post: #7
RE: [Code]Two button action
b means you are holding button. bp means button press.
You need b with shift and bp with mouse button smile
11-04-2014 07:27 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Jben Offline
Member

Post: #8
RE: [Code]Two button action
I know but it does not work :/ but it works with ms (2) "wheel"...
(This post was last modified: 11-04-2014 07:45 PM by Jben.)
11-04-2014 07:41 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Tottel Offline
Member

Post: #9
RE: [Code]Two button action
Hey there,

I see that you are using 2 separate 'if' statements.
Could you show what is inside the if(...actionX)?

If you want to see until where the code runs, press f8 to open in visual studio.
Then find the file and place a BREAKPOINT just after the first if. To make it easier, change your code to this:

Code:
if(Ms.b(0) && Kb.b(KB_LCTRL))
{
    if (...action3) // Click on the margin on the LEFT of this line to put a breakpoint here
    {

    }
}

This does the same thing, but it puts the code on multiple lines, so you can now place a breakpoint:

If you click on the margin to the left of if(...action3), you will see a big red dot appear. This is called a breakpoint. If the program reaches this point in the code, it will pause the application. Now, run the program and press left mouse and LCTRL at the same time. If it pauses, you know that the key-press is working. The problem is then the action3 thingie.

EDIT: Quick tip, if you put a breakpoint on a line, it pauses the application BEFORE it executes that line.
(This post was last modified: 11-04-2014 07:55 PM by Tottel.)
11-04-2014 07:53 PM
Find all posts by this user Quote this message in a reply
Post Reply