home home

downloads files

forum forum

docs docs

wiki wiki

faq faq

Cube & Cube 2 FORUM


Trying to script a three-level zoom

by Muki on 08/17/2007 05:41, 30 messages, last message: 08/21/2007 06:02, 12146 views, last view: 04/23/2024 14:35

Im trying to script a zoom feature to my MOUSE 3, which clicks through three levels of zoom.

Standard/Zoom 1: fov 120; hudgun 1; crosshairsize 25; sensitivity 3

Zoom 2: hudgun 0; fov 60; crosshairsize 20; sensitivity 2;

Zoom 3: hudgun 0; fov 10; crosshairsize 20; sensitivity 1;

I also want to add a sound each time the button is clicked...

Sorry Im such a noob at this, but hey, the more I learn the better my stuff will get, and maybe Ill start taking scripting up as a hobby ;)

   Board Index    Go to next 20 messagesGo to last 20 messages

#1: almost done already

by MeatROme on 08/17/2007 06:14

czoomlevel = 0
standard_zoom = [fov 120; hudgun 1; crosshairsize 25; sensitivity 3]
standard_zoom
delta_game_99 = [

czoomlevel = (+ $czoomlevel $arg1)
if (= $czoomlevel -1) [czoomlevel = 0]
if (= $czoomlevel 3) [czoomlevel = 2]
if (= $czoomlevel 0) [
// standard
standard_zoom
] [
if (= $czoomlevel 1) [
// level 1
fov 60; hudgun 0; crosshairsize 20; sensitivity 2;
] [
// level 2
fov 10; hudgun 0; crosshairsize 20; sensitivity 1;
]
]
]
bind LALT [ domodifier 99 ]
// HTH :)

reply to this message

#2: Re: almost done already

by dfdsfdfdsafconorkirkasfdsjfadsfkj on 08/17/2007 06:20, refers to #1

MeatROme: You should *totally* Quadropolate that.

reply to this message

#3: Re: almost done already

by MeatROme on 08/17/2007 06:25, refers to #1

actually ... change the first two ifs to the following for more stability:
if (< $czoomlevel 0) [czoomlevel = 0]
if (> $czoomlevel 2) [czoomlevel = 2]

reply to this message

#4: Re: quadropolate

by MeatROme on 08/17/2007 06:32, refers to #2

better still - wikified :)
http://cube.wikispaces.com/3-step-zoom

reply to this message

#5: ..

by Muki Hyena on 08/17/2007 06:43

Great script.. very close to what I wanted.. however, I was looking for more of a zoom you can click through and it'll take you to the next level, then back to the beginning, if you know what I'm saying.

Thanks, dude, and like sorry for upvoting myself at Quadropolis LOL

reply to this message

#6: Re: ..

by MeatROme on 08/17/2007 06:59, refers to #5

well then just change the ifs to the following:
if (< $czoomlevel 0) [czoomlevel = 2]
if (> $czoomlevel 2) [czoomlevel = 0]

CubeScript is so wonderful :)
Let's all give Aardappel a big hand for it!
*wild-clapping-ensues*

reply to this message

#7: ..

by Muki Hyena on 08/17/2007 07:05

Sweet, great improvement, definently.

Any way I can bind this to zoom every time I click middle mouse rather than having to scroll? The scrolling's a bit annoying.

Something similar to this script:

bind MOUSE2
[hudgun 0; fov 60; crosshairsize 15; sensitivity 2;

onrelease [fov 120; hudgun 1; crosshairsize 20; sensitivity 3]]

But without the onrelease, so it's like "Click, zoom, click, zoom, click, normalzoom."

Again, thanks.

reply to this message

#8: Re: ..

by Muki Hyena on 08/17/2007 07:41, refers to #7

Actually nevermind, I figured it out on my own, turned out to be really simple :D

bind MOUSE3 [ zoom0 ]
zoom0 = [ fov 120; hudgun 1; crosshairsize 25; sensitivity 3; bind MOUSE3 [ zoom1 ] ]
zoom1 = [ fov 60; hudgun 0; crosshairsize 20; sensitivity 2; bind MOUSE3 [ zoom2 ] ]
zoom2 = [ fov 10; hudgun 0; crosshairsize 20; sensitivity 1; bind MOUSE3 [ zoom0 ] ]

Thanks for the help; I'll post this to Quadropolis and give you a bit of credit for the help ;)

reply to this message

#9: Re: ..

by MeatROme on 08/17/2007 10:52, refers to #8

See, CubeScript is great :)
Nice to see you've got into it a bit already!
The rebinding is not exactly the way I'd have gone ...
... actually I'd have only renamed delta_game_99 to do_my_zooming, changed the czoomlevel recalculation to +1 everytime (replace that for the $arg1) and then bound any key you like to do_my_zooming. ... but yeah, you can go this way ... in coding/scripting there are always several ways to skin your cat!

Happy Scripting!

reply to this message

#10: Re: ..

by demosthenes on 08/17/2007 11:30, refers to #8

I prefer this:

bind mouse3 [zoomit]

alias zoomit [if (= fov 120) [fov 60; sensitivity 2] [if (= fov 60) [fov 10; sensitivity 10] [fov 120; sensitivity 3] ]

Really, it makes little difference.

reply to this message

#11: Re: yet another variant

by MeatROme on 08/17/2007 12:56, refers to #10

$fov

reply to this message

#12: ..

by SanHolo on 08/17/2007 15:34

Clicking through zoom-levels? Boy, my zoom only works while I hold down mouse2. And nevertheless, sometimes just letting go of mouse2 is too slow to avoid damage.

I love the speed of sauerbraten. =D

reply to this message

#13: Re: ..

by Muki on 08/17/2007 19:55, refers to #12

Really though, it's more for large maps like Urban-C, SkyCastle, and Thor that I use this script on. It works okay in Face-Capture as well...

I wish the rifle had more range though.

reply to this message

#14: ..

by makkE on 08/17/2007 19:58

The rifle´s range is infinite.

reply to this message

#15: Re: ..

by SheeEttin on 08/17/2007 23:32, refers to #14

Isn't everything's? (Well, edge of map aside...)

reply to this message

#16: ..

by Muki Hyena on 08/18/2007 08:46

Try shooting someone in the back spawn of Face Classic from the top of the opposite tower... it won't hit. The rifle doesn't have infinite range.

reply to this message

#17: Re: ..

by demosthenes on 08/18/2007 09:20, refers to #16

All the ranges are limited. I've tested it and had rockets explode just far enough from my face to keep from taking damage.

It's pretty silly sometimes; rockets explode in mid-air, rifle round hit invisible walls, etc. Makes for some very difficult long-range battles. Awfully hard to kill each other that way.

reply to this message

#18: ..

by makkE on 08/18/2007 09:24

Demosthenes: That´s a driver issue you got there.

But yes, I tried, the rifle´s range is limited it seems. Never would have thought.

reply to this message

#19: Re: ..

by noerrorsfound! on 08/18/2007 09:47, refers to #18

This is easily noticeable when trying to snipe people on face-capture. :)

reply to this message

#20: ..

by makkE on 08/18/2007 09:48

I don´t play capture, or oversized maps like village or wcdc for that matter.

reply to this message

   Board Index    Go to next 20 messagesGo to last 20 messages


Unvalidated accounts can only reply to the 'Permanent Threads' section!


content by Aardappel & eihrul © 2001-2024
website by SleepwalkR © 2001-2024
53732087 visitors requested 71500478 pages
page created in 0.021 seconds using 10 queries
hosted by Boost Digital