Urban Terror Forums: [SCRIPT] Walk 180º degree - Urban Terror Forums

Jump to content

 Login | Register 
Advertisement
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[SCRIPT] Walk 180º degree Rate Topic: -----

#1 User is offline   Xcl4m4t10n Icon

  • Account: xcl4m4t10n
  • Joined: 21-July 12
  • Posts: 62

Posted 27 September 2013 - 04:21 PM

Sup!

So i make this little bind:

bind MOUSE4 "cl_yawspeed 22500; +left; wait 2; -left; cl_yawspeed 140"


To turn away 180º. But when i push MOUSE4 while walk it only turns 90º. So i make it

//WALK
	bind CTRL +vstr walk_on walk_off
	set walk_on "+speed;unbind MOUSE4;bind MOUSE4 cl_yawspeed45000; +left; wait 2; -left; cl_yawspeed 140"
	set walk_off "-speed;unbind MOUSE4"


But it is, obviously, bad declarated. Any help? Thanks!

#2 User is offline   Iye Icon

  •   head moderator   
    Co-Chief Community Moderator
  • Account: iye
  • Country:
  • Joined: 07-June 11
  • Posts: 1,054

Posted 28 September 2013 - 01:19 AM

The problem is pretty simple.(imo...)

-- not real code --
set cmd "vstr something; bind KEY echo test; echo test2";
-- end of unreal code --

will only bind "echo test" to KEY. "echo test2" will be execed the moment you do vstr cmd

so what you would need is

bind CTRL "+vstr walk_on walk_off"; //note that bindings should also be included in quotation marks
set walk_on "+speed;bind MOUSE4 vstr turn"; //moved all the stuff to be bound to MOUSE4 in a own cmd, so you can rebind this all at runtime
set nothing ""; //yes. nothing. better to start lines / cmds with a vstr nothing than a +/- action, because the action might not work then
set walk_off "vstr nothing; unbind MOUSE4"; //i dont think you need the -speed here.
set turn "vstr nothing; cl_yawspeed 22500; +left; wait 2; -left; cl_yawspeed 140";


Anyway, always check your line ending and make sure that you dont use ; in a comment, because that works as an excape sequence

Next big thing is the wait 'time'. (in combination with cl_yawspeed.)
I use a cl_yawspeed of 56000 and a wait of 1. works perfectly for me (at 126 fps)
If you have no problems with the bind directly bound to MOUSE4 your wait time isn't a problem.
Otherwise you will have to try out, since wait N; //waits N frames
Increasing yawspeed will allow you to lower the wait value (faster input, since you cant do anything but look while WAIT)
But this will also decrease precision, so you don't do an exact 180 deg turn.


Still one question remains.....
why do you do that thing with a while keypressed on CTRL?
i mean just telling from the code you dont use any other binds on MOUSE4 (because you unbind it)
that script with +vstr is fun but not very reliable.


Hope this helps,
Iye

This post has been edited by Iye: 28 September 2013 - 01:20 AM

Sorry for my bad spelling - I am still asleep. :)

|=| Iye's UrT Addon |=| Firefox Personas |=| Maps |=|
http://www.mediafire...vk3a602hcfg.jpg

#3 User is offline   Xcl4m4t10n Icon

  • Account: xcl4m4t10n
  • Joined: 21-July 12
  • Posts: 62

Posted 28 September 2013 - 04:10 PM

Thank you so much for the help! I was having an issue. I was able to make turn without walk button. Also i can turn with walk button pushed. But when i release the walk button i was unable to make the turn in "normal mode", only in "walk mode". So i was digging code and i make it:

//TURN
	bind MOUSE4   "vstr turn"
	set turn      "cl_yawspeed 22500; +left; wait 2; -left; cl_yawspeed 140"
		
	bind CTRL     "+vstr walk_on walk_off"
	set walk_on   "+speed;bind MOUSE4 vstr turn_walk"
	set turn_walk "cl_yawspeed 45000; +left; wait 2; -left; cl_yawspeed 140"
	set walk_off  "-speed;bind MOUSE4 vstr turn"


As you can see it's a two steps script. Can you (or anybody) improve it? I think it have some leftover code but i can't see it. Thank you again!

This post has been edited by 3xcl4m4t10n: 28 September 2013 - 04:12 PM


#4 User is offline   Iye Icon

  •   head moderator   
    Co-Chief Community Moderator
  • Account: iye
  • Country:
  • Joined: 07-June 11
  • Posts: 1,054

Posted 28 September 2013 - 07:42 PM

This is probably the shorts possible solution.

Have fun with your script :)

Some Links you might like to check out:


Taggedzis UrT Oasis

Iye's UrT Addon (some code for some features (warning might cause a buffer overflow :) )

This post has been edited by Iye: 28 September 2013 - 07:44 PM

Sorry for my bad spelling - I am still asleep. :)

|=| Iye's UrT Addon |=| Firefox Personas |=| Maps |=|
http://www.mediafire...vk3a602hcfg.jpg

#5 User is offline   Xcl4m4t10n Icon

  • Account: xcl4m4t10n
  • Joined: 21-July 12
  • Posts: 62

Posted 29 September 2013 - 01:10 AM

I know Oasis but thank you for the another link ^^. Also i forgot to mention that i added -speed because when i push ctrl, it not deactivate +speed.

bullet_loaderAdvertisement

#6 User is offline   Iye Icon

  •   head moderator   
    Co-Chief Community Moderator
  • Account: iye
  • Country:
  • Joined: 07-June 11
  • Posts: 1,054

Posted 29 September 2013 - 10:45 PM

Yeah. thats a common 'problem'.

 bind KEY "+ACTION"; // this will turn on +action while the key is pressed, and deactivate it (-action) if the key is released

 
bind KEY "+ACTION; vstr anything"; //here the +action will not be turned off after KEY is release.
//this doesnt only apply to [i]vstr[/i] but to any case that a +/- action isn't the only thing bound to a key



bind KEY "vstr SomeCvar";
set SomeCvar "+ACTION"; //pretty useless thing, but same here as for Example 2.



possible 'workarounds' are +vstr or toggles:

bind KEY "vstr toggle1";
set toggle1 "+ACTION;bind KEY vstr toggle2";
set toggle2 "-ACTION;bind KEY vstr toggle1";


Toggles are a dangerous thing though. they are not meant for a While Keypressed action, but for a key turning something on and off (like nvgs....)
Sorry for my bad spelling - I am still asleep. :)

|=| Iye's UrT Addon |=| Firefox Personas |=| Maps |=|
http://www.mediafire...vk3a602hcfg.jpg

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users

Sponsored link
https://www.urbanterror.info/members/donate/


Copyright © 1999-2024 Frozensand Games Limited  |  All rights reserved  |  Urban Terror™ and FrozenSand™ are trademarks of Frozensand Games Limited

Frozensand Games is a Limited company registered in England and Wales. Company Reg No: 10343942