Scripts
Ty man, is the math behind it all good? (i.e. will it return proper (accurate) values?) :D
Thanks given by:
i think yes :) (the math is good, but i think you should try it anyway)
Thanks given by:
I made a script! First one that really does something.
I basically looked at a bunch of scripts that you guys made, dissected them, and made my own.
bind BACKSLASH [say "You'll never take me alive!"; onrelease [suicide] ]
Press and hold BACKSLASH and you'll say You'll never take ma alive, then you release backslash, you suicide. . .as you probably already figured. . .

bind "J" [say is (at $randomis (rnd 6))]
randomis = ["angry" "happy" "a villain" "sad" "confuddled" "perplexed" "king of the world" "picking flowers" "shooting people" "a master sniper!" "teabagging the enemy" "saying random stuff!" "blank. . ." "feeling lucky" "bored" ]
also one that generates one of 15 messages when you press J
Thanks given by:
Try changing:

bind "J" [say is (at $randomis (rnd 6))]

to

bind "J" [me is (at $randomis (rnd 6))]

I think the me command will have a better effect for what you're going after there. :)

Oh also, since you have more than 6 elements in the "randomis" alias/list, you should either use listlen or count out exactly how many elements there are so you actually have a chance of seeing them all:

bind "J" [me is (at $randomis (rnd (listlen $randomis)))]

HTH :)
Thanks given by:
(05 Mar 11, 03:01PM)Bukz Wrote: Try changing:

bind "J" [say is (at $randomis (rnd 6))]

to

bind "J" [me is (at $randomis (rnd 6))]

I think the me command will have a better effect for what you're going after there. :)

Oh also, since you have more than 6 elements in the "randomis" alias/list, you should either use listlen or count out exactly how many elements there are so you actually have a chance of seeing them all:

bind "J" [me is (at $randomis (rnd (listlen $randomis)))]

HTH :)

Oh, I did count them all and list them out. . .dangit, I must've copied my first version. Sorry, lemme update Xd
Thanks given by:
Mikey, it is very nice and refreshing to see someone to learn CS by their own accord, taking examples and such. Although these scripts may be simple, good job! Bukzy reminded me of the other way to improve your scripting, having people give you input ;)
Thanks given by:
:D thanks.
I finished my version of the "yell stuff when you frag someone" script that Bukz gave me. It yells one of 15(?) things when you frag them, one of 3 when you headshot, one of three when you gib, one of three when you knife, and it says "AUGHHH!" when you die.
alias spammed_message  
      alias check_kd [
  
          loop ckd 5 [
  
              if_conline_has "you fragged" but_not "teammate" [
  
                  say (at $randomfrag (rnd 6))
                  randomfrag = ["EAT LEAD!" "TAKE THAT!" "Come on, is that all you got?" "My grandma can play better than that!" "OH! Watch me now!" "Oh Snap! There it is!" ] ;
  
                          
              ] []
  
          ]
  
          if (alive) [alias spammed_message 0] [if $spammed_message [] [alias spammed_message 1; say AUGHHH!!]]
  
      ]
  
      add2conloop [check_kd]



add2conloop [if_conline_has $curname and_also "noob" [if (strstr (at $conline 0) $curname) [] [say stfu! :P]] []]

alias headshot [

loop ckd 5 [

if_conline_has "you headshot" but_not "teammate" [
                  
                  say (at $randomhs (rnd 4))
                  randomhs = ["Headshot!" "POW! Right in the kisser!" "That's skill right there." "Not fast enough mate!"] ]
                  
                  ] []
                  ]
                 add2conloop [headshot]

alias boom [
loop ckd 5 [
  if_conline_has "you gibbed" but_not "teammate" [
                  
                  say (at $randomgib (rnd 3))
                  randomgib = ["Naded!" "Sky high!" "Smells like bar-b-que"] ]

] []
]
add2conloop [boom]


alias slashy [

loop ckd 5 [

if_conline_has "you slashed" but_not "teammate" [
               say (at $randomslash (rnd 3))
               randomslash = ["Taste steel!" "Slashy-Slashy" "Un-guard!"] ]
               ] []
               ]
               add2conloop [slashy]

accepting cc. . .
Thanks given by:
I finally got around to adding to the binds for changing weapons with the number keys... if anyone actually uses that, anyway.

//Multiple Crosshair script by Lantry
//allows you to have a different Xhair for each weapon! Fun!
//please choose your cursors in the lines below

alias arxhair [default.png] //Assault Rifle cursor goes here (6)
alias smgxhair [default.png] //SMG cursor goes here (4)
//alias sniperxhair [default.png] //sniper cursor goes... wait a second... (5)
alias shotgunxhair [default.png] //Shotgun cursor goes here (3)
alias riflexhair [default.png] //Carbine cursor goes here (2)
alias knifexhair [default.png] //knife cursor goes here (0)
alias nadexhair [default.png] //grenade cursor goes here (8)
alias pistolxhair [default.png] // pistol cursor goes here (1)
alias akimboxhair [default.png] //akimbo cursor goes here (9)

alias changexhair [
sleep 300 [if (= (curweapon) 6) [ loadcrosshair $arxhair ]
if (= (curweapon) 4) [ loadcrosshair $smgxhair ]
if (= (curweapon) 3) [ loadcrosshair $shotgunxhair ]
if (= (curweapon) 2) [ loadcrosshair $riflexhair ]
if (= (curweapon) 1) [ loadcrosshair $pistolxhair ]
if (= (curweapon) 0) [ loadcrosshair $knifexhair ]
if (= (curweapon) 8) [ loadcrosshair $nadexhair ]
if (= (curweapon) 9) [ loadcrosshair $akimboxhair ] ]
]

bind MOUSE4 [ universaldelta  1; changexhair ]
bind MOUSE5 [ universaldelta  -1; changexhair ]
bind "1" [ if $editing [ domodifier 5 ] [ primary; changexhair ] ]
bind "2" [ if $editing [ domodifier 7 ] [ secondary; changexhair ] ]
bind "3" [ if $editing [ domodifier 8 ] [ grenades; changexhair ] ]
bind "4" [ if $editing [ domodifier 9 ] [ melee; changexhair ] ]

A couple of questions i have:
1) is there a way to tell when the akimbo has been picked up? currently the code only works if you pick up the akimbo (and auto switch), then switch to a different weapon and back.
2) isn't there a way to add a new command to a bind, instead of rebinding the whole thing?
Thanks given by:
The accuracy dump script, outputs accuracy for each bullet firing weapon + knife, as well as shots landed/shots fired. Since curaccuracy requires you to be connected to a server to work properly, so will this script.

/accuracy_dump

...while connected to a server will output all the stats to the upper left hand corner of the screen (console).

It requires this (curaccuracy) script to work!

http://pastebin.com/YqgY1pq4

Example output:

Quote:Mar 05 20:37:01 Knife: 33.33333
Mar 05 20:37:01 1/3
Mar 05 20:37:01
Mar 05 20:37:01 Pistol: 0.0
Mar 05 20:37:01 0/0
Mar 05 20:37:01
Mar 05 20:37:01 Carbine: 0.0
Mar 05 20:37:01 0/0
Mar 05 20:37:01
Mar 05 20:37:01 Shotgun: 0.0
Mar 05 20:37:01 0/0
Mar 05 20:37:01
Mar 05 20:37:01 SMG: 25.0
Mar 05 20:37:01 2/8
Mar 05 20:37:01
Mar 05 20:37:01 Sniper: 0.0
Mar 05 20:37:01 0/0
Mar 05 20:37:01
Mar 05 20:37:01 AR: 0.0
Mar 05 20:37:01 0/0
Mar 05 20:37:01
Mar 05 20:37:01 Akimbo: 42.85714
Mar 05 20:37:01 3/7
Thanks given by:
// Multiple Xhairs - by VenteX

xhair_6 = "default.png" // AR
xhair_4 = "default.png" // SMG
xhair_5 = "default.png" // Sniper
xhair_3 = "default.png" // Shotgun
xhair_2 = "default.png" // Carbine
xhair_0 = "default.png" // Knife
xhair_8 = "default.png" // Nades
xhair_1 = "default.png" // Pistol
xhair_9 = "default.png" // Akimbo

alias xhairloop [ if (= (prevweapon) (curweapon)) [] [ changexhair ]; sleep 1 [ prevweapon = (curweapon) ]; sleep 2 [ xhairloop ] ]
alias changexhair [ loadcrosshair (getalias (concatword "xhair_" (curweapon))) ]
prevweapon = (curweapon); xhairloop // Start the loop!

Written on a Nintendo DSi from memory, so it's untested and I have no idea if it works, but here you go Lantry!

EDIT: Please work, oh please...
Thanks given by:
something isn't working with yours in this line:
alias changexhair [ loadcrosshair (concatword "xhair_" (curweapon)) ]
I'm not familiar with the workings of concatword, and i couldn't figure it out with a little tinkering, so someone else will have to figure it out. here is one I made, that works fine for me:
//Multiple Crosshair Script by Lantry + VenteX
//please enter your crosshair choices in the lines below

alias arxhair [default.png] //Assault Rifle cursor goes here (6)
alias smgxhair [default.png] //SMG cursor goes here (4)
alias shotgunxhair [default.png] //Shotgun cursor goes here (3)
alias riflexhair [default.png] //Carbine cursor goes here (2)
alias knifexhair [default.png] //knife cursor goes here (0)
alias nadexhair [default.png] //grenade cursor goes here (8)
alias pistolxhair [default.png] // pistol cursor goes here (1)
alias akimboxhair [default.png] //akimbo cursor goes here (9)

alias changexhair [
if (= (curweapon) 6) [ loadcrosshair $arxhair ]
if (= (curweapon) 4) [ loadcrosshair $smgxhair ]
if (= (curweapon) 3) [ loadcrosshair $shotgunxhair ]
if (= (curweapon) 2) [ loadcrosshair $riflexhair ]
if (= (curweapon) 1) [ loadcrosshair $pistolxhair ]
if (= (curweapon) 0) [ loadcrosshair $knifexhair ]
if (= (curweapon) 8) [ loadcrosshair $nadexhair ]
if (= (curweapon) 9) [ loadcrosshair $akimboxhair ]
sleep 0 [ changexhair ]
]

remember to change the crosshair values, or else it wont do anything

EDIT: this just stopped working for me for some reason. If someone could try it out and tell me what happens/ what is wrong, i would be most grateful.
Thanks given by:
(06 Mar 11, 12:22AM)Lantry Wrote: A couple of questions i have:
1) is there a way to tell when the akimbo has been picked up? currently the code only works if you pick up the akimbo (and auto switch), then switch to a different weapon and back.
2) isn't there a way to add a new command to a bind, instead of rebinding the whole thing?

1)
if (|| (magcontent 9) (magreserve 9)) [echo I can haz a Kimbo!] [echo No akimbo for me]

2) using tools.cfg:
add2bind
add2eachbind
ifbind
Those three can be used to add to a keybind in various ways. Read the documentation for details. :D
Thanks given by:
I thought this would be helpful.

//Auto map-saving by Zen
recursive enableautosave 600000 [savemap; echo "Auto-Saved Map"]
bind INSERT [enableautosave]

You have to do a normal "/savemap mapname" first. Then hit Insert, and the map will be saved. Every 10 minutes after that, it will save again.
Thanks given by:
^: Only problem with that is, that you have to quit again before doing something else in AC.
Thanks given by:
Don't use recursive, do it the old fashioned way and add a check before it loops itself!
asmable = ""
if (checkalias asminterval_) [] [ asminterval_ = 60000 ]
asminterval = [ asminterval_ = $arg1 ]
autosavemap = [ if (= $arg1 1) [ asmable = 1; savemap; sleep $asminterval_ [ if $asmable [ autosavemap ] ] ] [ asmable = 0 ] ]
Bind to whatever.
Use /asminterval to set the automapsave interval. Use /autosavemap 1 to save/enable the script, use /autosavemap 0 to disable. Never tested :P
Thanks given by:
LOL @ everyone doing work Bukz already did months ago
http://forum.cubers.net/thread-38-post-2...l#pid24591
Thanks given by:
There should be a page on the wiki with a list of scripts, which link to a page containing the script. Unless there is one already O.o?
to the best of my knowledge, this thread is the only place where scripts are really being collected into one place, and it's not a very good way to do it.
Thanks given by:
We're currently trying to build a CubeScripts wiki.
WIP
Thanks given by:
Ok, this one lets you sing like Justin Bieber...BUT here is the coolest part! You...suicide right after singing a couple lines of his song. Now it does require admin or else you get the "Dont f*cking spam" message...altho if you want to avoid that you can shorten the script so you dont sing as much....Oh and inorder to work it, when you are in game type "/sing x" where "x"= the seconds you want to sing! i.e "/sing 3" then it will look like this"
(yourname) will sing in: 3
(yourname) will sing in: 2
(yourname) will sing in: 1
(yourname) will sing in: 0
(yourname) Baby, Baby, Baby OHHHHHH
(yourname) Like Baby Baby Baby NOOOOO
(yourname) Thought you'd always be mine
(yourname) MINE
(yourname) suicided


alias sing [
     alias j (+ $arg1 1);
     alias s $j;
     loop u $j [sleep (* $u 1000) [alias s (- $s 1); me "is going to sing in: " $s ] ];
     sleep (* 1000 $arg1) [ say "Baby, Baby, Baby OHHHHHH"; sleep 500 ];
     sleep (* 2000 $arg1) [ say "Like Baby Baby Baby NOOOOO"; sleep 500 ];
     sleep (* 3000 $arg1) [ say "Thought you'd always be mine"; sleep 500 ];   sleep (* 4000 $arg1)  [ say "MINE"; suicide ]
]
//By |FOX|Thrawn (most the credit :P) and JB|JustinBieber (the rest the credit)

**this is an edited version that (in my opinion) is better and much more enjoyable :)

alias sing [
     alias j (+ $arg1 1);
     alias s $j;
     loop u $j [sleep (* $u 1000) [alias s (- $s 1); me "is going to sing in: " $s ] ];
     sleep (+ (* 1000 $arg1) 0) [ say "Baby, Baby, Baby OHHHHHH" ];
     sleep (+ (* 1000 $arg1) 2000) [ say "Like Baby Baby Baby NOOOOO" ];
     sleep (+ (* 1000 $arg1) 4000) [ say "Thought you'd always be mine" ];
     sleep (+ (* 1000 $arg1) 7000)  [ say "MINE"; suicide ]
]
//By |FOX|Thrawn (most the credit :P) and JB|JustinBieber (the rest the credit)

Thanks given by:
That...
I'd sit through that once. XD
Thanks given by:
http://pastebin.com/raw.php?i=m9aMvMaE

v-man or whomever,
This is the "smoothzoom" script. I'm having a problem where, occasionally, the fov will get set to 75 even when it is supposed to zoom out. After talking with Gibstick, he recommended that I check out timestamps. I am hopeless when it comes to these things right now and aim to get better. I was wondering what advice I could ascertain from you gents if any. Thanks,
Thanks given by:
Timestamps, as in checking to see if the current command being executed after a sleep actually belongs. Since you can't cancel a script, any sleep will still be running if you zoomin then out quickly. If the sequence is not completed, the sleep will still be running and the sleep will awake (couldn't find better word) in the middle of something important. Use timestamps like GD did with the vote recall/cancel script. I'll draw a timeline to explain it:

This is normal behaviour:
sleep 1

>time>>>>>>>>>>>>>>>>>>>
|----------------------------------------------------------|

some alias ("+" = 1, "-" = 0), which is only supposed to execute at the end of the sleep if it is "0"
|++++++++++++++++|----------------------------|

but when the sequence isn't allowed to execute fully

sleep
>time>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|----------------------------------------------------------|

some alias ("+" = 1, "-" = 0), which is only supposed to execute at the end of the sleep if it is "0"
|++++++(break)-----------------(start over)++++++| oh noes I'm not executed

Vote recall script:
// Reset the aliases just in case
cancelallvotes = [ votingno = 0; votingyes = 0; votetimestamp = 0]
cancelallvotes

vote_exec1 = [ vote 1; echo " 0You voted yes"; cancelallvotes ]
vote_exec2 = [ vote 2; echo " 3You voted no"; cancelallvotes ]

// $arg1 = millis
delayed_vote = [
    // only bother if we're actually due
    if (= ($votetimestamp) ($arg1) ) [
        if (= ($votingyes) 1) [ vote_exec1 ]
        if (= ($votingno) 1) [ vote_exec2 ]
    ] [
        echo "All this wait for nothing..."
    ]
]

delayed_vote_start = [ votetimestamp = (millis); sleep 5000 [ delayed_vote votetimestamp ] ]

delayvote1 = [
    if (= ($votingyes) 1) [
        // voting yes when already have voted yes, do it immediately
        vote_exec1
    ] [
        if (= ($votingno) 1) [
            // changed mind, cancel
            echo " 6You cancelled your F2"; cancelallvotes
        ] [
            // normal/first vote
            echo "Voting YES in five seconds!"; votingyes = 1; delayed_vote_start
        ]
    ]
]

delayvote2 = [
    if (= ($votingno) 1) [
        // voting no when already have voted no, do it immediately
        vote_exec2
    ] [
        if (= ($votingyes) 1) [
            // changed mind, cancel
            echo " 6You cancelled your F1"; cancelallvotes
        ] [
            // normal/first vote
            echo "Voting NO in five seconds!"; votingno = 1; delayed_vote_start
        ]
    ]
]
bind "F1" [delayvote1]
bind "F2" [delayvote2]
Thanks given by:
Yeh, I noticed that problem myself and was trying to think of the best way to fix it.
For now I use this:
alias resetsmooth [
stoploop smoothzoom
fov 110
sleep (+ $zoomingin $zoomingout) [pop smoothzoom]]
Edit the fov modification in there to your normally preferred zoomed-out FOV setting.
Stick that alias in some keybind.

I'll update smoothzoom with a proper fix once I get a chance to really look at it.

A tip to prevent it: Don't try to zoom in while you're zooming out. XD
Thanks given by:
Another useless script...

alias you [
  tmpname = $curname
  tmpmessage = $arg2
  if (> $numargs 2) [
    loop tmpnumargs (- $numargs 2) [
      tmpmessage = (concat $tmpmessage (getalias (concatword "arg" (+ $tmpnumargs 3)))) ] ]
  name $arg1
  me $tmpmessage
  name $tmpname ]

Fun stuff, no...?
Thanks given by:
Smooth Zoom update
You can get rid of that silly reset now. XD
I've also updated tools.cfg on Akimbo.
Many thanks to Billybob and the {BoB} clan for hosting my scripts and mods! :D
Billybob hosting V-Man
Thanks given by:
thanks v-man,
wonderful work
Thanks given by:
Hi everybody,
I need help on a script, it's my own version of the saystats script, I wanted to add a message that appears if you have full ammo (3 nades, full pistolclips and full primary ammo).

The problem is that the full ammo message doesn't appear. But I don't have error messages.

Here is what I have so far :

AdvWepStats = [
    weaponnames = ["Knife" "Pistol" "Carbine" "Shotgun" "Subgun" "Sniper Rifle" "Assault Rifle" "Grenades" "Akimbo"]
        primload = (magcontent (currentprimary))
        primleft = (magreserve (currentprimary))
        primtot = (+ $primload $primleft)
        secload = (magcontent 1)
        secleft = (magreserve 1)
        sectot = (+ $secload $secleft)
        akiload = (magcontent 9)
        akileft = (magreserve 9)
        akitot = (+ $akiload $akileft)
        nadesnbr = (magcontent 8)

    echo (concatword " 3" (at $weaponnames (currentprimary)) " 7: 3 " $primload " 4rounds loaded 7| 3 " $primleft " 4rounds left 7| 3 " $primtot " 4rounds total");
        if (= $akiload 0) [
    echo (concatword " 3Pistol 7: 3 " $secload " 4rounds loaded 7| 3 " $secleft " 4rounds left 7| 3 " $sectot " 4rounds total") [] ];
        if (> $akiload 0) [
    echo (concatword " 3Akimbo 7: 3 " $akiload " 4rounds loaded 7| 3 " $akileft " 4rounds left 7| 3 " $akitot " 4rounds total") [] ];
        if (> $nadesnbr 0) [
    echo (concatword " 3Grenades 7: 3 " $nadesnbr " ") [] ];

        if (= currentprimary 2) [        
            if (&& (= $nadesnbr 3) (= $sectot 80) (= $primtot 40) ) [
                echo " 3You're at full ammo" [] ]
                    [] ];

        if (= currentprimary 3) [
            if (&& (= $nadesnbr 3) (= $sectot 80) (= $primtot 28) ) [
                echo " 3You're at full ammo" [] ]
                    [] ];

        if (= currentprimary 4) [
            if (&& (= $nadesnbr 3) (= $sectot 80) (= $primtot 120) ) [
                echo " 3You're at full ammo" [] ]
                    [] ];

        if (= currentprimary 5) [
            if (&& (= $nadesnbr 3) (= $sectot 80) (= $primtot 20) ) [
                echo " 3You're at full ammo" [] ]
                    [] ];

        if (= currentprimary 6) [    
            if (&& (= $nadesnbr 3) (= $sectot 80) (= $primtot 80) ) [
                echo " 3You're at full ammo" [] ]
                    [] ]
]

If someone could help me, please.

By the way, I post my own scripts :

//Kick by nick script by BarricadeX75
knick = [
alias player_name (findcn $arg1);
kick $player_name
]

I also found a weird bug with AC's map editor.
Type /editbug while watching a demo :

editbug = [
edittoggle;
sleep 100 stopdemo
]

EDIT : More bug ! While in "editbug mode", watch another demo... You should be able to follow other players with your own player, but you won't be able to shoot.
Thanks given by:
Rave Party FTW!
Thanks given by:
Between the AR and grenades, there's a weapon number for the cpistol. So while the AR is 6, he weapon number of grenades is actually 8. You'll need to add some dummy thing there, just to take up a slot.
Thanks given by:
Thanks for the answer, Gibstick, but the problem isn't here. I think the problem is in my if(s) :
if (= currentprimary 2) [        
            if (&& (= $nadesnbr 3) (= $sectot 80) (= $primtot 40)) [
                echo " 3You're at full ammo" [] ]
                    [] ];
And more particularly with the "&&" sign. As I'm used to C and PHP, I don't know the correct use of it, I just read the reference. If you could help me again, please.
Thanks given by: