Jump to content

Recommended Posts

Posted (edited)

EDIT / REPOST

medic kicked me out of his thread lol

 

so 3 days with no reply in the posts old location, lets start a new thread.

 

 

 

i'd like to hear some ideas for turning off a continuous-action script that uses the "wait" command to separate instances of a repeated action.

 

an example of such a script would be one that tosses out medpacks or ammo boxes while you go to the kitchen for a refreshing beverage, that you can turn off when you get back. think superAFK script.

 

 

it might work something like this:

 

you press a key

-- /kill, switch to field op or medic, execute a cfg just does this:

----- select weaponbank, +attack

----- wait however long

----- execute script again

the script keeps on executing itself until you press another key ( or the same key a second time ), i.e. you can walk to the kitchen for a delightful snack while your avatar sits there handing out supplies in the spawn ( looking like a total nub and probably blocking the doorway ).. and then turn it off when you come back.

 

 

 

interesting problem?

 

i would like to hear ideas, plz.

 

 

 

 

the problem is that you can't execute any commands during a "wait" (!)

 

 

 

 

 

 

 

 

so here is an idea that doesn't exactly work.

(i know there is tweaking to be done to this but i threw it together quickly as an example =p)

 

this script DOESN'T WORK:

 

in autoexec.cfg ( or wherever action scripts are stored ) these two functions:


/////////////////////////////////////////////////////////////////
// Handout on
//	switches to weaponbank 6 and tosses ammo, health etc
//		continuously until handout off is executed	
//binds		f
/////////////////////////////////////////////////////////////////
set handouttoggle "set handouton exec handout.cfg"

unbind f
bind f "vstr handouttoggle; exec handout.cfg"
/////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////////
// Handout off
//	turns off handout on function
//binds		g
/////////////////////////////////////////////////////////////////
set handoutoff "set handouton echo ^3OFF"

unbind g
bind g "vstr handoutoff"
/////////////////////////////////////////////////////////////////

 

 

and a separate .cfg called "handout.cfg"


weaponbank 6

wait 16

+attack
-attack
+attack
-attack
+attack
-attack
+attack
-attack
+attack
-attack

wait 152

vstr handouton

 

the idea here is to use a proxy vstr as an on/off switch by redefining it.

the string of + / - attacks is to give time for the user to react and press the off switch during an action instead of during a "wait"

wait for 2 sec. ( at 76 fps ) for bar to recharge.

 

be prepared to ctrl-alt-del yourself out of the game if you want to try debugging this lol

Edited by Connection
Posted

first of all you don't need to use wait if you just do +attack you will be dropping pack until you do -attack ;)

 

but if you wish to do a loop I suggest trying to do something like this

 

//do the dropping and call reculsion
set startDropPacks "echo ON;weaponbank 6;wait 16;+attack;-attack;+attack;-attack;+attack;-attack;+attack;-attack;+attack;-attack;wait 152;vstr continueDropPacks"
//call the first one
set continueDropPacks "echo LOOP;vstr startDropPacks "


bind f  "vstr startDropPacks"
//just break the script that recalls the first on
bind g "set continueDropPacks echo OFF"

Posted

I know what you are talking about, I've written "wait" scripts and gotten stuck in loops that I could not get out of without exiting the game. Once I tried writing one that went to prone, waited half a second, then activated weapalt (for the mg-42), along with tightening up my pitch and changing my field of view. End result: my character goes down and back up over and over. Some commands work well with wait scripts, other commands get looped.

 

If you have a programmable mouse or keyboard (like a Nostromo gamepad) you could write a simple macro that performs an action until u come back from getting your beer or your potty break. Then you hit one key and it stops. Very easy. Not sure if it's legit but if you are handing out medpacks I don't think anyone will care.

 

@Caldas - I will try out your code it looks useful thx.

Posted

I stuck Caldas' script in my autoexec.cfg (after a couple minor changes):

 

//do the dropping and call reculsion

bind e "vstr startDropPacks"

set startDropPacks "echo ON; weaponbank 6; wait 16;+attack;-attack;+attack;-attack;+attack;-attack;+attack;-attack;+attack;-attack;wait 152; vstr continueDropPacks"

set continueDropPacks "echo LOOP; vstr startDropPacks "bind e "vstr startDropPacks""

//just break the script that recalls the first onbind g "set continueDropPacks echo OFF"

 

 

It didn't work. Just switched to medpacks but did not throw them. The wait 16 might not be long enough. Also I was not sure if there were too many quotation marks in the second set statement.

 

Nice try though...

Posted

AFK whoring nice, dont let me catch ya B)

 

That script doesn't work anyway lol. Not worth the trouble to debug. Just to go to spec.

  • Administrators
Posted

first of all you don't need to use wait if you just do +attack you will be dropping pack until you do -attack ;)

 

but if you wish to do a loop I suggest trying to do something like this

 

//do the dropping and call reculsion
set startDropPacks "echo ON;weaponbank 6;wait 16;+attack;-attack;+attack;-attack;+attack;-attack;+attack;-attack;+attack;-attack;wait 152;vstr continueDropPacks"
//call the first one
set continueDropPacks "echo LOOP;vstr startDropPacks "


bind f  "vstr startDropPacks"
//just break the script that recalls the first on
bind g "set continueDropPacks echo OFF"

 

If you use that then you can't shoot during script is executed.

I never understood why not to just press you left mouse key, rather then using +/- attack?

 

Their is other way to keep throwing packs using scripts. Press key, you start throwing packs and press key again you stop throwing packs. If someone needs that to feed team mortar to help your team let me know.

Posted

you are right.. It doesnt work :P.. I wrong that script in the forum editor just from head.. now I tried it and seen it doesnt work.. I mean it seemed that the game just got stuck in a loop and could not be broken..

 

I guess Ill get back to the old method of opening the console and typing \+attack ;)

Posted

Hit "P" to start throwing medic or ammo packs, hit P again to stop

 

unbind P
set pack_off "weaponbank 6; wait 5; +attack; set pack_t vstr pack_on"
set pack_on "-attack; wait 5; weaponbank 3; set pack_t vstr pack_off"
vstr pack_off
bind P "vstr pack_t"

Posted

I tried Medic's code in his post above and it worked. Good job.

 

 

unbind P

set pack_off "weaponbank 6; wait 5; +attack; set pack_t vstr pack_on"

set pack_on "-attack; wait 5; weaponbank 3; set pack_t vstr pack_off"

vstr pack_off

bind P "vstr pack_t"

 

 

I thought it would need a statement like

 

set pack_t "vstr pack_off"

 

but it works just fine as is.

 

Thanks Medic.

Posted

well thanks for pointing out the +attack doesn't end until you do -attack.

 

i knew that tho..

 

what i am really after is a way to turn off a script written like the examples ^

 

like what if you want to just jump up and down every 3 seconds. setting +moveup and letting it go until you do -moveup wouldn't work the same way; you just jump once. maybe that is a better example for a 'target script'

 

thanks again for the script medic, but it's not what this thread is for.. i am not looking for a simple handout pack script, or title of thread would be "i need a script to hand out ammo" -- thread is "how to turn off recursive scripting"

 

@ caldas --

 

your script fails for i think the same reason as the one i posted.. i think what is happening is a time-to-execute issue, like the stack is still full of +attack/-attack by the time the cfg or vstr is called again, so they just keep piling up. i wrote it as a separate cfg to be called hoping it would take longer than to execute a vstr, to give time for the +attack/-attack to catch up to the "execute cfg" line... i guess i could make the wait period longer, but that just exacerbates the problem of not being able to do anything during 'wait'

 

it's like it takes ET 2ms to read all the +attack/-attack lines but takes 10s to actually execute them. by that time the cfg has re-executed 10 times and even if you did turn it off, you have to wait for 5 minutes to see that it was turned off.

 

thanks for taking an interest..

 

@dare -- like i mention to medic, this thread wasn't really started for just making a throw ammo script. although to answer your question of why to make script instead of just pressing the mouse button, it's so you could go take a dump and not get kick for AFK lol.

OK OK actually it's not. i have other scripts in mind if i could solve problem of turning off a recursive script. don't worry tho m8 it's me ||||||||||||| ( sorry dunno what happened to my old login?? ); you know i won't make some kind of hack. i will just do some idiotic script that only i think is funny =D ... although a solution to this problem would make it possible to make a sort of limited mortar script, admin abuse, or constant arty spam script, or something evil to crash servers, it's not what i have in mind ultimately. . promise.

Posted

OK, we get it.

 

You said you wanted something that throws medpacks while you go get a beverage, and you said you wanted to use the "wait" command. Medics's script works fine for what you initially described, and it uses the wait command, just like you wanted.

 

I don't think we want a bunch of afk mortars getting sprees while they are in the bathroom.

Posted

Medics's script works fine for what you initially described, and it uses the wait command, just like you wanted.

 

 

no, i said:

 

i'd like to hear some ideas for turning off a continuous-action script that uses the "wait" command to separate instances of a repeated action.

 

an example of such a script would be one that tosses out medpacks

 

medic's script is nothing like what i am asking about. that's a trivial solution. i want a way to turn off a recursive script.

 

but don't worry about mortar spam lol i don't even play FA servers.. too much lag with 50 ppl on a map =\

Posted

no, i said:

 

 

 

medic's script is nothing like what i am asking about. that's a trivial solution. i want a way to turn off a recursive script.

 

but don't worry about mortar spam lol i don't even play FA servers.. too much lag with 50 ppl on a map =\

 

Well, perhaps we've misunderstood what you need. I don't know how to interrupt a wait command. I would just use a programmable mouse or gamepad, this is very easy for the built-in macro writers on them.

  • Administrators
Posted

 

OK OK actually it's not. i have other scripts in mind if i could solve problem of turning off a recursive script. don't worry tho m8 it's me ||||||||||||| ( sorry dunno what happened to my old login?? );

 

Prove me you are Mr. Barcode and I will merge your accounts. Your old account is still on forums.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.