Scripts
hehe.
Nice to see you guys using in-game documentation. :D


Anyone who wants to read (or contribute to) CubeScript tutorials may do so here:
http://des-bukz.co.cc/forum/index.php?board=7.0

The tutorials just started being written, so keep in mind it's a work in progress.
Thanks given by:
I am trying to make a script that will load a different crosshair and size for different weapons.
Here is what I have so far:
Code:
//crosshairs
if (= curweapon 0) [crosshairsize 50; loadcrosshair c_2.png 0] //knife
if (= curweapon 1) [crosshairsize 25; loadcrosshair b_5.png 1] //pistol
if (= curweapon 2) [crosshairsize 20; loadcrosshair d_2.png 2] //shotgun
if (= curweapon 3) [crosshairsize 20; loadcrosshair d_3.png 3] //subgun
if (= curweapon 5) [crosshairsize 20; loadcrosshair d_4.png 5] //assaultrifle
if (= curweapon 6) [crosshairsize 50; loadcrosshair a_2.png 6] //grenades

I'm not sure why, but it isn't working.
Any help would be greatly appreciated!
Thanks given by:
I bet it's only working for your current primary right? Try taking out the if statements and simply adding:

Code:
//crosshairs
crosshairsize 50; loadcrosshair c_2.png 0 //knife
crosshairsize 25; loadcrosshair b_5.png 1 //pistol
crosshairsize 20; loadcrosshair d_2.png 2 //shotgun
crosshairsize 20; loadcrosshair d_3.png 3 //subgun
crosshairsize 20; loadcrosshair d_4.png 5 //assaultrifle
crosshairsize 50; loadcrosshair a_2.png 6 //grenades

To your autoexec. The problem was, the if statements would only evaluate as true (1) if you are currently holding (curweapon) those weapons when you start AC. And since you can't hold all of your weapons at once at game launch, it just won't work. This however should (although I do not know if the different crosshair sizes for each will work or not, or if it will just change the size for all of them each time and finally end up at size 50 - not 100% sure though), HTH. :)
Thanks given by:
Actually my script didn't work for any of it, i would just see the c_2.png crosshair at size 50 for everything. The same happens when i run your script.

Is this because saved.cfg is used after autoexec.cfg and the saved crosshair is loaded from the saved.cfg?
Thanks given by:
Weird...

Try:

Code:
//crosshairs
loadcrosshair c_2.png 0 //knife
loadcrosshair b_5.png 1 //pistol
loadcrosshair d_2.png 2 //shotgun
loadcrosshair d_3.png 3 //subgun
loadcrosshair d_4.png 5 //assaultrifle
loadcrosshair a_2.png 6 //grenades

Does this at least give you different crosshairs?

Edit: V-Man has come to save the day. :)
Thanks given by:
[EDIT: incoherent babbling removed]

Hm, just realized you're trying to do something that I'm not trying to do. XD Sorry Bukz, you da man
Thanks given by:
(19 Jul 10, 04:58PM)Bukz Wrote: Does this at least give you different crosshairs?

It does not :(

@ V-Man: That script works for the size of the primary, but does not switch sizes when i go to knife or pistol or nades. And I still see the c_2.png crosshair.

Edit: So does this mean that what I'm trying to do is impossible?
Thanks given by:
Try adding ""s around the images filename like:

Code:
loadcrosshair "c_2.png" 0 //knife
loadcrosshair "b_5.png" 1 //pistol
loadcrosshair "d_2.png" 2 //shotgun

I've never tried using loadcrosshair to have multiple crosshairs - I just use a simple:

Code:
(loadcrosshair "z_9.png" <0)

In my autoexec and forgot about it - the <0 loads it for every weapon. Hope this may help though. :) gl
Thanks given by:
the "" doesn't help...
Thanks for trying tho, :|
Thanks given by:
You could try adding ()s around the entire thing like in my example - but if the ""s didn't help I doubt it will either. :P

Sorry man I have no idea why it is not working for you. Of course according to the reference it is possible - maybe theres a bug that no one has found yet?

Anyways I hope you get it working, if you do please post your solution here so the rest of us can figure out what we were noobin' :P

gl :)
Thanks given by:
I'm equally befuddled. I can see how you're wanting to use the "loadcrosshairs" command with its second argument to specify a weapon for it.
After fiddling with this command for a while (about four months ago XD), I convinced myself that something must have been left out in the source code for the second argument.
Still, the first argument works fine, so we'll want to use that in some clever way.
You'll need to encase your script into an alias which is executed along with whatever you're using to select your next weapon.
Code:
alias crosshairload [
if (= (curweapon) 0) [crosshairsize 50; loadcrosshair o.png] [] //knife
if (= (curweapon) 1) [crosshairsize 25; loadcrosshair default.png] [] //pistol
if (= (curweapon) 2) [crosshairsize 20; loadcrosshair o.png] [] //shotgun
if (= (curweapon) 3) [crosshairsize 20; loadcrosshair red_dot.png] [] //subgun
if (= (curweapon) 5) [crosshairsize 20; loadcrosshair red_dot.png] [] //assault rifle
if (= (curweapon) 6) [crosshairsize 50; loadcrosshair o.png] [] //grenades
]
(Note that I put parentheses around "curweapon". ;-)
Then make keybinds that select your weapons.
Code:
bind "1" [primary; crosshairload]
bind "2" [secondary; crosshairload]
bind "3" [knife; crosshairload]
bind "4" [grenades; crosshairload]

Other scripts that select various weapons will need to have that alias piggy-back them, too. For example, the "universaldelta" alias which is bound to the mouse scroll wheel by default is controlled by alias delta_game_0 (in scripts.cfg), and should be changed thus:
Code:
alias delta_game_0 [ if (= $arg1 1) [ shiftweapon 1 ] [ shiftweapon -1 ] ] // original
alias delta_game_0 [ if (= $arg1 1) [ shiftweapon 1; crosshairload ] [ shiftweapon -1; crosshairload ] ]
I may have rushed this conclusion -- hence its bulky nature and high probability of errors. Let me know how it works. :D

EDIT: If anyone reads this who knows the proper way to get the second argument for "loadcrosshairs" to behave the way in-game docs describe it, I'd be very eager to learn it. ^_^
Thanks given by:
Thank you so much v-man! I had to add a sleep 300 to the MOUSE4 and MOUSE5 binds, otherwise it would have the crosshair of the previous weapon on the weapon your on now. Also i binded mouse1 to attack; crosshairload just in case there was a glitch with the sleeping.

Now it works perfectly, :D Thanks!
Thanks given by:
V-Man FTW! :D
Thanks given by:
:D You're welcome. Please do not hesitate to ask other questions.
Thanks given by:
Asking questions is one of the only ways to learn.
Thanks given by:
I annoyed R4, Bukz, V-Man, GenD etc with total noob questions to just become a script kiddie and learn the "basics" of CubeScript. I <3 them for letting me be annoying.
Thanks given by:
I <3 people on the IRC, GenD was one of them, Gibstick was one, and I'm sure V-Man was on there, as I added to one of his scripts.
Thanks given by:
To save your breath you can just say "A bunch of DES Noobs and Gibstick". I <3 you too.
Thanks given by:
*cough* #CubeScript on gamesurge *cough*
Thanks given by:
(20 Jul 10, 05:37AM)Ronald_Reagan Wrote: Asking questions is one of the only ways to learn.

First off, that makes perfectly no sense and secondly using your brains is _the_ way to learn. Getting told the answer straight away doesn't make you understand the problem, since you haven't figured it yourself. ;)
Thanks given by:
(20 Jul 10, 03:17PM)Mr.Floppy Wrote: using your brains is _the_ way to learn.

I don't think you ever went to school.
:D
Thanks given by:
(20 Jul 10, 03:17PM)Mr.Floppy Wrote:
(20 Jul 10, 05:37AM)Ronald_Reagan Wrote: Asking questions is one of the only ways to learn.

First off, that makes perfectly no sense and secondly using your brains is _the_ way to learn. Getting told the answer straight away doesn't make you understand the problem, since you haven't figured it yourself. ;)

How would you ever motivate yourself to learn cubescript without saying "I wonder how to do this?", your brain is implied in the process, because with out your brain you wouldn't be able to do anything (notice I'm not religious?).
I'm not going to continue responding on this topic here, to keep to the topic of scripts, PM me if you continue to disagree.
Thanks given by:
Viper

just taskkill the process in a batch file or perhaps from within the ac batch file, or however you do the same in terminal in 'mac-land'

taskkill /?
Thanks given by:
Ok, Here is a script for ya, it was originally DES|V-Mans rave script, but I added on to the music feature. It is now much easier to use. Rave with music.
This was my learning experence, my question was "How could I make the music function easier to use?". I learned how to use menus, basic functions and the music script.
Thanks given by:
:D
GG

Now implement the change I made for Drakas:
Code:
alias raveloop [
(scalelights 99 1337);
(fov (+ (rnd 45) 75));
(sleep $lightscalerate [raveloop])]
But then, that's more to enhance the vertigo script. XD
Thanks given by:
(21 Jul 10, 01:23AM)DES|V-Man Wrote: :D
GG

Now implement the change I made for Drakas:
Code:
alias raveloop [
(scalelights 99 1337);
(fov (+ (rnd 45) 75));
(sleep $lightscalerate [raveloop])]
But then, that's more to enhance the vertigo script. XD
I think you would need to replace $lightscalerate with the correct value for that to work.

Just sayin.
Totally going to play 1v1 with all of these scripts on though.
Thanks given by:
Does anyone have the script wich takes screen stats after every game? It was in old forum
Thanks given by:
Screenshots?
Thanks given by:
(21 Jul 10, 10:37AM)DrauL Wrote: Screenshots?
Yes
Thanks given by:
I dont know who wrote it but here ya go :)

Code:
//screenshot @ end of game
start_intermission = [
  sleep 20 [ screenshot ]  //sleep because you might get a black screen otherwise
]
Thanks given by: