Sauerworld Forum

Chain Gun Sensitivity

Alu

  • *
  • 43
  • +2/-0
Chain Gun Sensitivity
« on: August 04, 2015, 03:47:39 AM »
The first time I try to make a script
nothing worked xD

I do not know any programming language.
I only know do poor pseudocode

the idea is

chaingun shot = lower sensitivity

in any different situation = Sensitivity returns to normal

---------

I have no idea how to make the cycle because I do not know ask things such as "if chaingun is shooting" "If any key is pressed or not"

I think it's easy to write if you know that (the syntax)

any help?

(sorry for the bad English)

Ardelico

  • ***
  • 113
  • +15/-0
  • imasheep
Re: Chain Gun Sensitivity
« Reply #1 on: August 04, 2015, 10:19:04 PM »
Here is what I managed to come up with, copy paste it into autoexec.

Autoexec.cfg is located:
Windows: documents/my games/sauerbraten/autoexec.cfg

I do not know location on Mac and Linux.

http://pastebin.com/1zZ3Jyuh

You will have to do some modifications, put your sensitivity values where the capital letters say.




If you want to learn cubescript, I learned simply by reading it and figuring it out through trial and error.  I wouldn't recommend this method since I am meh with CS.

For more in depth, take a look at Hirato's Cubescript Tutorial which is here:
https://github.com/Hirato/lamiae/wiki/CubeScript

« Last Edit: August 04, 2015, 10:26:22 PM by Ardelico »

Alu

  • *
  • 43
  • +2/-0
Re: Chain Gun Sensitivity
« Reply #2 on: August 05, 2015, 03:50:43 AM »
It does not work well
dont know how to fix him

-----------------
sensitivityscale 10
defaultsensitivity = 93
chaingunsensitivity = [chaingunsensitivity1; chaingunsensitivity2;]
chaingunsensitivity1 = [sleep 100 [if (= (getweapon) 2) [slowattacksens]] chaingunsensitivity1]

chaingunsensitivity2 = [sleep 99 [if (!= (getweapon) 2) [sensitivity $defaultsensitivity]] chaingunsensitivity2]
 

bind "MOUSE1" [attack; chaingunsensitivity]


 
slowattacksens = [if (i dont know ) =player1attacking or attack=1/idontknow) [sensitivity 40] [sensitivity $defaultsensitivity]; onrelease [sensitivity $defaultsensitivity]] 


--------------------------
why "[ if (!= (get weapon) 2)"    "!"?

and why "sheep"?

Ardelico

  • ***
  • 113
  • +15/-0
  • imasheep
Re: Chain Gun Sensitivity
« Reply #3 on: August 05, 2015, 02:44:42 PM »
It works perfectly fine; though it may not be the best.

You are using it incorrectly, you are not supposed to bind 'chaingunsensitivity'.

Copy paste the script to autoexec, that is all you have to do :p

The script is an infinite loop, it will always be running unless you /clearsleep.  If the script isn't running, type /chaingunsensitivity

When you have it bound to mouse1, every time you click, it executes the command again, since it is an infinite loop, you're more just running way more loops than needed (1).


Sensitivity 10?? default sensitivity 93???

My sensitivity isn't even past 1! You must have an extremely low DPI mouse

P.S. by copy paste I literally mean select it and copy paste :p.  (maybe you did.. but judging by the script in your post it looks as if you manually typed it, correct me if I'm wrong)


Quote
why "[ if (!= (get weapon) 2)"    "!"?

and why "sheep"?

[ if (!= (getweapon) 2) is another way of saying "if weapon is not equal to 2 (chaingun).
sheep?  there is no sheep in the script?  it is sleep.

Sleep = delay time before event.

Example: /sleep 2000 [say "test"]
sleep 2000 is 2000 milliseconds, therefore 2 seconds time.  Client will wait 2 seconds, before saying test.


Quote
slowattacksens = [if (i dont know ) =player1attacking or attack=1/idontknow) [sensitivity 40] [sensitivity $defaultsensitivity]; onrelease [sensitivity $defaultsensitivity]]
This line is useless.  Use the script how I wrote it, modify only the capital letters, and it will work. 
« Last Edit: August 05, 2015, 05:02:53 PM by Ardelico »

Alu

  • *
  • 43
  • +2/-0
Re: Chain Gun Sensitivity
« Reply #4 on: August 05, 2015, 05:30:44 PM »
I copy and paste
but I moved on a single line, with the [] and () on a single line seems more understandable for me
the script works but not the way I expected
the idea is that the sensitivity down only and only when the machine gun shoot
In any other situation the sensitivity should return to normal.

Ardelico

  • ***
  • 113
  • +15/-0
  • imasheep
Re: Chain Gun Sensitivity
« Reply #5 on: August 05, 2015, 05:58:56 PM »
Oh, that's what you meant.

The script should only mod sensitivity when attacking with chaingun now.

http://pastebin.com/1zZ3Jyuh

EDIT: if you want custom sensitivity for each weapon, I just finished a script for it.

http://quadropolis.us/node/4235
« Last Edit: August 05, 2015, 07:08:34 PM by Ardelico »

Alu

  • *
  • 43
  • +2/-0
Re: Chain Gun Sensitivity
« Reply #6 on: August 05, 2015, 08:12:00 PM »
it worked
thx

Alu

  • *
  • 43
  • +2/-0
Re: Chain Gun Sensitivity
« Reply #7 on: August 05, 2015, 09:49:55 PM »
ummm the script in quadropolis work but the chaingun alone script no, i dont know why

but I think it's irrelevant, the script in quadrapolis is beautiful works perfect

thx, gj

Ardelico

  • ***
  • 113
  • +15/-0
  • imasheep
Re: Chain Gun Sensitivity
« Reply #8 on: August 05, 2015, 10:55:15 PM »
Thanks.

The chaingun script alone does not work because the weapon sensitivity script over-writes the mouse1 bind.

Or vice versa, whichever is last in the autoexec.


Edit: I updated the script on quad, it was missing the default sensitivity field.
« Last Edit: August 06, 2015, 05:19:52 AM by Ardelico »

Acuerta

  • *****
  • 70
  • +7/-0
Re: Chain Gun Sensitivity
« Reply #9 on: August 06, 2015, 04:35:22 AM »
Could you upload the original version for chaingun again? The one without cgattacking?

Ardelico

  • ***
  • 113
  • +15/-0
  • imasheep
Re: Chain Gun Sensitivity
« Reply #10 on: August 06, 2015, 05:14:28 AM »

Alu

  • *
  • 43
  • +2/-0
Re: Chain Gun Sensitivity
« Reply #11 on: September 19, 2015, 08:15:53 PM »

9.3 = normal sens
8.7 = chaingun sens

if just want to have it for the machine gun (when triggered)

-------------------------------------------

bind mouse1 [attack; wepattacking = 1; onrelease [wepattacking = 0; sensitivity 9.3;]]
wepattacking = 0

chaingunsensitivity = [
   sleep 1 [
      if (&& (= $wepattacking 1) (= (getweapon) 2)) [
      sensitivity 8.7
      ]
   ] chaingunsensitivity
]
chaingunsensitivity