ID:273668
 
I already know byond cant execute two things at the exact same time but is there any way for me to make it where there is a slight delay and it checks if both buttons are pressed and stops the old proc like if I press A it check if I'm Holding S and since I pressed a "first" it doesn't say i pressed both buttons but it spawns for 1 tick before saying i only pressed 1 button and in hat tie i would have the same code on S but S would say I've pressed A so it would say I pressed both and set a variable and this variable would stop the single A from executing.

Any one to pretty much do that I tried it jsut like I said it and its not really working
No offense, but people might understand what your asking a bit better if you explained it in more than one sentence.
In response to SadKat Gaming
OK then since it seems there is a bit of a problem let me do this again......

I'm trying to make a game where you can press two buttons. Like street fighter. So I need a way to simulate pressing two buttons. Getting two buttons to be ready is easy.

The problem is getting it to where the first button press stops. Thisd is so you dont do A AND A+S.

I already know byond can't press two buttons at the same time but is there a way to make commands go in a certain order.

For example if I press a Macro It would check if I have the other button pressed and if I do it would do the double command.

Thats the easy part the problem is obviously I pressed two buttons. What BYOND is doing is sort of like this

"A was Pressed" .... "S is not being pressed" "Do normal action"

then in the next tick it does

"S was pressed" ... "A is being pressed" "Do Combo Action"


what i want to try to do is make the smallest amount of delay i can use and have a check like this.


// on A Press

A = 1
if(S == 1)
usr << "A + S"
usr.TwoButtons = 1
else
spawn(1)
if(usr.TwoButtons == 0)
usr << "A

In response to Inferno L Flames
You could create a list for your mob, and have it store your actions within the list.

mob
var
list/actions = list()


When the macro is pressed, add it to the list and call a procedure to run the actions. If that procedure is already running, then stop. Otherwise, it can keep going. You might also want to set a cap on specific actions being run (for example, if you have up to 3-action combos, you might want to set the cap at 3). For example,

mob
var
tmp/proc_running
max_actions = 3
verb
A()
if(length(src.actions)<=max_actions)
src.actions.Add("A")
src.actionsProc()
B()
if(length(src.actions)<=max_actions)
src.actions.Add("B")
src.actionsProc()
proc
actionsProc()
if(src.proc_running) return
src.proc_running = 1
while(length(src.actions)>0)
src.ExecuteAction(src.actions[1])
src.actions.Remove(src.actions[1])
sleep(1)
src.proc_running = 0


Of course, that's a really rough sketchup, but basically you would allow the list to continually expand until it hits the max_actions. Then, the while() loop would go until it runs out of actions to do. Naturally, you can change any of the numbers here. I'm considering the notion that my src.action[1] section won't work, but from the DM reference, I don't see why that should really be an issue.
In response to CauTi0N
That not exactly what I'm trying to do that would just make it Do A and then do B right after.

I need it to be able to check if you've pressed both buttons within like a tick so it can cancel the first action and then do the combine action. The problem is getting DM to execute specific commands in a specific order. I have a idea/question. Would separating it into its own proc cause the ticks to get separated. for example

mob
verb
A()
A = 1
usr.ActionCheck("A")



mob
verb
B()
B = 1
usr.ActionCheck("B")




mob
proc/ActionCheck(var/Action)
spawn(0.75)//thats my tick lag that should work right
if(Combo == 1)
return
if(Action == "A")
if(B == 1)
usr << A + B
usr.Combo = 1


Something like that if you get what I mean
In response to Inferno L Flames
That would make it do any combination, and with a sleep. I think you missed the sleep.
In response to CauTi0N
Ok I managed to figure it out. I have another How to but should I make another topic or put it here.

I might as well put it here. Its about making it so something doesn't start until 2 people have all their files loaded.

Cause I have the option to turn off music in my game and obviously a player with music off is gonna load faster than with music on. But I don't want the match to start till bot players are ready obviously.
In response to Inferno L Flames
I would start a new topic. I don't know the answer to the question, and from the look of this original topic, if I were an outsider to the topic I'd assume it's already finished.

The only system I can think of would have to be from manual input, but there's gotta be a way the computer can check on it's own.
Simple, you just use the instant setting for your verbs. Setting instant to true will let you use both keys in the same tick, and it will allow you to check them.
Essentially you're half wrong; you can execute two verbs in the same exact tick. Of course nothing can happen at the same exact time.
If you check the DM Reference for "instant setting (verb)" it even says it could be used to handling combo attacks better.