Scripts
(06 Sep 10, 11:32PM)Bukz Wrote: Copy/paste-able, fixed Auto-Sorry upon TK script available below:
http://pastebin.com/raw.php?i=Cki53zgf
It works good, but when you team-kill someone with flag it doesn't works. That's strange i know, but try it.
Edit: When you kill a teammate who has the flag

Thanks given by:
Probably because the two lines reporting a fragged teammate and the teammate dropping the flag show up at the same time, beating the loop of the script (sleep function in the script).

@Kirin: Can you craft trigonometric functions in CubeScript? :D
Thanks given by:
cube script is not going to have trigonometric functions, that's the reason autoscopesens parameter got hardcoded else it could easily have been a script.

//Mouse wheel Zoom Script by Kirin.
if (checkalias dscopefov) [] [ //firststart message
dscopefov = $scopefov;
echo (c 0) Zoom Script by (c X) Kirin (c 0) successfully injected!
]
autoscopesens 1
scopefov $dscopefov
alias delta_game_zoomwh [-= scopefov (* 10 $arg1)]
alias altaction_5 [ domodifier zoomwh; scopefov $dscopefov; setscope 1; onrelease [ setscope 0 ] ]

autoscopesens handles sensitivity related problems, scopefov variable represents the zoom. :) it's easy isnt it?

well i find it a very practical parameter, and also i think that it should be default for newcomers, and it's recommendable for everyone which never got truly used to sniper, it' useless for those who already mastered 2 sensitivitys, but it helps those who only handle one...
Thanks given by:
Kirin Wrote:cube script is not going to have trigonometric functions
:,(
Thanks given by:
//Zoom Script made by Kirin
dscopefov = 50 // scopefov you like as default.
autoscopesens 1; scopefov $dscopefov;
alias delta_game_zoomwh [-= scopefov (* 10 $arg1)]; zooming = 0
togglezoom = [
zooming = (! $zooming)
setscope $zooming
if $zooming [modifier = zoomwh; scopefov $dscopefov;] [modifier = 0;]
]
alias altaction_5 [ togglezoom ] // Toggleable-scope style
// alias altaction_5 [zooming = 0; togglezoom; onrelease [togglezoom]] // hold-right-click-2-zoom style
this is the toggleable zoom script requested by lwc
Thanks given by:
Thanks!
Thanks given by:
is there a way of determining whether the red (/) sign is up instead of your crosshair or not? Codewise I mean, obviously you can just look but I want my script to do something when the sign is up
Thanks given by:
No way at the moment SplatZ.
Thanks given by:
Unless all you want is to have a specific image displayed in place of your crosshairs.
Thanks given by:
bind "MOUSE1" [attack; suicide]



and , can some one help me :D?
i made script " echo " 3Kell on:" 1 (timestring) "
it shows up when i start ac
so ,i wanna make like /thetime and then it shows timestring
Thanks given by:
(29 Oct 10, 07:06AM)snake_eye Wrote: bind "MOUSE1" [attack; suicide]

bind "MOUSE1" [attack; sleep 100 [me "is the best , bye..."]; sleep 2000 [suicide]]

Thanks given by:
I got bored, so i started to write a binary decoder, i thought it would be usefull and end the multiple "ifs"...
well i havent used it yet, anyway...
//// binary script by =SA=macm ////

// example of usage:
// /echo (bin 0 1 1 0)  Output= 6
// /x = (bin 1 0 0 1 0 0 0 1); echo $x  Output= 145

//this is an alternative addon, it will "add2alias" but not with the ";"
add2alias_ = [
if (strcmp "" (getalias $arg1)) [
$arg1 = $arg2] [
$arg1 = (concat (getalias $arg1) $arg2)
]
]


alias execbinlist [alias binlist [0 1]; muln = 1; loop i 20 [muln = (* $muln 2); add2alias_ binlist $muln]]

alias bin [
curnumargs = $numargs;
execbinlist; fbin; 1bin]

alias fbin [
s = 0;
read_;
alias 1bin [];
add2alias_ 1bin "(+m";
loop i (+ $curnumargs 1) [if (= $i 0) [] [ z = (- $curnumargs $s); s = (+ $s 1);
add2alias_ 1bin (concatword "(* " (at $binlist $z) " $arg" $i ")")
]];
add2alias_ 1bin ")"
]


alias read_ [
+m = [];
loop k (+ $curnumargs 1) [if (= $k 0) [] [
+m = (concatword "(+ " $+m " $arg" $k ")") ]]
]
Thanks given by:
It say a random message when you disconnect:

//    End message script

alias random_msg [
me (at $msg_list (rnd (listlen $msg_list)))
]
msg_list = ["will come back , he just needs more coffee. :P" "Ragequits!" "AHRRHH!!!!" "Rocks , never forget it." "Is the best" "is better than you!" "will kick your ass ... when he'll reconnect! :P" "say Bye! :)" "stop own noobs ... bye. ;)" "will disconnect in 0,5s." ]

//    Add this in menu_multiplayer
menuitem " Disconnect"    [ random_msg ; sleep 500 ; disconnect ]
Thanks given by:
@macm:
:D
Amazing!
Soon someone is going to make a compiler in Cubescript! XD
Thanks given by:
woot , got it finally :)

alias thetime [echo " The Time is:" (timestring) ]

im newbie in cubescript :D(just trying to learn it)

Thanks given by:
To add to the Cubescript math functions, here is a script that rounds a number. Use (roundf 5.5234234), just like an operator; rounds to the nearest integer.
roundf = [
if (>= (+f ($arg1) 0.5) (+ ($arg1) 1.0)) [
(+ ($arg1) 1)] [
(+ ($arg1) 0)]
]
One question: GD always told me to use concat, but I see some scripts that use this syntax.
echo $onething $secondthing "a string here" "and another string here"
Which is comparable to
cout << onething << anotherthing << "string here";
The latter is perfectly fine but what about Cubescript?

Goes well with V-Man's exponent script (posted already, somewhere).
//Exponent script "exp 5 2" = 5^2
alias powerloop [
    (alias product (*f $base $product));
    (alias power (+f $power 1));
    (if (<f $power $pow) [powerloop] [result $product])]

alias exp [
(alias product 1);
(alias power 0);
(alias base $arg1);
(alias pow $arg2);
(powerloop base pow)]
Thanks given by:
(30 Oct 10, 07:02AM)DES|V-Man Wrote: @macm:
:D
Amazing!
Soon someone is going to make a compiler in Cubescript! XD

lolwut
It's just a binary-to-decimal converter.
Thanks given by:
If you knew CubeScript, you would realize that it would take quite a bit of knowledge to pull off.
Thanks given by:
Damn, the exponent script doesn't work with negative numbers. Anyone want to fix?
Thanks given by:
Breeze Wrote:lolwut
It's just a binary-to-decimal converter.
And AssaultCube is just a first-person shooter.

Gibstick Wrote:what about Cubescript?
It is optimal to use concat for grouping strings into a single alias if you later intend to display the contents of that alias in an echo.
The command "echo", itself, does not actually require its next argument(s) to be grouped. All of its proceeding arguments, until the close of a bracket like ] or ), or until a semicolon on the same bracket level of the echo command, is used. I believe a hard return also implies the end of an echo command.
examples:
echo All these separate arguments are being treated as a list of strings to be echoed.
alias add2wordlist [alias wordlist (concat $wordlist $arg1)]
alias wordlist [A collection of some useful words]
echo echo is a useful command; but this part will be ignored.
echo [semicolons are also useful; to echo them, brackets or quotes must be used.]
echo $wordlist "would be nice to have" [on a rainy day]; echo [YA RLY]
echo (concat [This] [will] [also] [produce] [the] [same] [result.])
The reasons for using "concat" are wide and varied. Having the strings represented as a sequence, as above, allows for dealing with each one individually as a separate list element. When using "concat", the words are grouped together with a space between them, and you can deal with the group of words as a group.
Note that "concat" can also take an indiscriminate number of arguments without needing explicit punctuation.



Gibstick Wrote:the exponent script doesn't work with negative numbers.
:O
:/
it can't calculate negative exponents. The base can be negative and it calculates the product just fine. Still... I'll look into having negative exponents.
Thanks given by:
I've just woken up and I can't think of the Cubescript for it now, but mathwise you could multiply the negative exponent by -1, calculate with that, then divide 1 by the result. Because
2^(-3) = 1 ÷ (2^3).

Edit: I've got it!
//Exponent script "exp 5 2" = 5^2
alias powerloop [
    (alias product (*f $base $product));
    (alias power (+f $power 1));
    (if (<f $power $pow) [powerloop] [result $product])]

alias exp [
(alias product 1);
(alias power 0);
(alias base $arg1);
if (<f $arg2 0) [alias pow (*f $arg2 -1); negexp = 1] [alias pow $arg2; negexp = 0];
if (!= $negexp 1) [powerloop base pow] [(divf 1 (powerloop base pow;))]
]
Thanks given by:
:D Great job, Gibbeh!

Also... I forgot to spam links to the tutorial in support of my statements regarding concat and echo.
Thanks given by:
Quote:[21:56:09] <DES|GeneralDisarray> anyhow it's cos the loop is controlled by the exponent
[21:56:22] <DES|GeneralDisarray> if exp is negative, it'll end on first iteration
GD doesn't post on forums often, because there are too many helpless noobs.
Thanks given by:
Eh? I just don't feel like posting on forums much (there's a forum I visit regularly but posted on it maybe twice in the last 4 years), partly because I prefer realtime chat (ie IRC).

Also it's good to let everyone have a go at questions and problems - including those who ask ;) - so that the community grows as much as possible rather than having a few agony aunts. Ever seen someone reaching the "resident guru" status and letting it get to their head, opinionating liberally without restraint, sense or taste? \:D

Apologies for being off topic but wanted to correct Gibstick's well-meant comment :) To get back on track, here's most of my autoexec.cfg (minus the admin stuff, as most folks have that anyway):

// search for players straight from the console prompt, press F3 then type (partial) name
// may complain about $cmdbuf on the first run but harmless

bind F3 [ inputcommand $cmdbuf [ joinservermenu; searchnickname $cmdbuf ] "?" ]

//////////////////
// cleanup helper
// clears specified aliases on exit, keeps autoexec.cfg tidy and private (eg no admin passwords)
// use anywhere after the definition, any number of times

alias ClearOnExit [
    loop i (listlen $arg1) [
        tmp = ( concat (at $arg1 $i) = [""] )
        addOnQuit $tmp
    ]
]

ClearOnExit [ i tmp ClearOnExit ]
ClearOnExit [ s r len ] // add some default AC bits

///////////////////////////////////
// pooling all args into an alias
// uncomment & use this as a test template, may need to tweak starting arg offsets

// arg_test = [
//   echo arg count: $numargs
//      allargs = $arg2; loop i (- $numargs 2) [ allargs = (concat $allargs (getalias (concatword arg (+ $i 3) ) ) ) ]
//      echo $allargs
// ]
// ClearOnExit    [ arg_test allargs ]

///////////////////////////////
// no nades when mousewheeling
alias nn_weapon_up [ if (= (curweapon) (currentprimary)) [weapon (0)] [shiftweapon 1] ]
alias nn_weapon_dn [ if (= (curweapon) (0)) [weapon (currentprimary)] [shiftweapon -1] ]

alias delta_game_0 [ if (= $arg1 1) [nn_weapon_up] [nn_weapon_dn] ]

ClearOnExit [ nn_weapon_up nn_weapon_dn delta_game_0 ]

////////////////////////////////////////////////////////////////
// captures a screenshot into the "screenshots/bans/" subfolder

alias banscreenshot [
  if ($screenshottype) [ ss_extension = ".jpg" ] [ ss_extension = ".bmp" ]
    banssfilename = (concatword (at (timestamp) 0) . (at (timestamp) 1) . (at (timestamp) 2) - (at (timestamp) 3) . (at (timestamp) 4) . (at (timestamp) 5) - (curmap 1) )
    screenshot ( concatword screenshots/bans/ ($banssfilename) $ss_extension )
]

ClearOnExit [ banscreenshot banssfilename ss_extension ]
Thanks given by:
:D <3
Wanted to notify any interested scripters of some tools I hammered out last night:

Check2Add - provides a shortcut for the sane usage of add2alias, as well as keybinds (add2bind)

FindBind - A tool that functions like a reverse form of the command "keybind" -- that is, it searches through all keys and checks each keybind for a given string. Returns a list of keys that contain the string in a keybind. Also has tools to handle the result.

Enjoy! ^_^
Thanks given by:
arghhhhhhhhhhhh damnit! akimbo isnt working! :'(
Thanks given by:
Since they're important enough...

check2add.cfg:
// check2add.cfg -- a sane way to generically standardize check-based alias addition by DES|V-Man
alias addcheck [if (strstr $arg1 $arg2) [] [add2alias $arg1 $arg2]]
alias add2bind [if (strstr (keybind $arg1) $arg2) [] [bind $arg1 (concat (keybind $arg1) ";" $arg2)]]

// Some commonly-used native aliases that do not get emptied
alias addcheck_msa [addcheck mapstartalways $arg1]
alias addcheck_si [addcheck start_intermission $arg1]
alias addcheck_onquit [addcheck onQuit $arg1]
alias addcheck_sb [addcheck sbconnect $arg1]

// A way to not only add aliases to be cleared OnQuit, but to also conveniently be able to see which aliases originate from specific scripts
alias addlistonquit [alias_list = $arg1; loop i (+ (listlen $alias_list ) 1) [addOnQuit (concat "delalias" (at $alias_list $i))]]
// example: at the end of any script, list each new alias you've introduced in a containing alias:
// alias newscript_aliases [newalias newalias1 newalias2 newalias3 newalias4 newalias5]
// addlistonquit $newscript_aliases
// They will be cleared on quitting the game, if users prefer to keep saved.cfg clear.

findbind.cfg:
// findbind.cfg -- A method of back-searching for key commands, phrases, or aliases in keybinds -- by DES|V-Man
// includes bindcheck -- A method of ascertaining whether a key contains given commands, phrases, or aliases -- also by DES|V-Man
// Requires check2add.cfg.
alias bindcheck [if (strstr (keybind $arg1) $arg2) [result 1] [result 0]]

alias findbind [
alias bindloopresult []
alias fblc 0
alias itemtofind $arg1
findbind_loop
result $bindloopresult]

alias findbind_loop [
loop i 144 [if (bindcheck (at $keylist $i) $itemtofind) [alias bindloopresult (concat $bindloopresult (at $keylist $i))] []]]

alias keylist [ MOUSE1 MOUSE2 MOUSE3 MOUSE4 MOUSE5 MOUSE6 MOUSE7 MOUSE8 BACKSPACE TAB CLEAR RETURN PAUSE ESCAPE SPACE EXCLAIM QUOTEDBL HASH DOLLAR AMPERSAND QUOTE LEFTPAREN RIGHTPAREN ASTERISK PLUS COMMA MINUS PERIOD SLASH 0 1 2 3 4 5 6 7 8 9 COLON SEMICOLON LESS EQUALS GREATER QUESTION AT LEFTBRACKET BACKSLASH RIGHTBRACKET CARET UNDERSCORE BACKQUOTE A B C D E F G H I J K L M N O P Q R S T U V W X Y Z DELETE KP0 KP1 KP2 KP3 KP4 KP5 KP6 KP7 KP8 KP9 KP_PERIOD KP_DIVIDE KP_MULTIPLY KP_MINUS KP_PLUS KP_ENTER KP_EQUALS UP DOWN RIGHT LEFT INSERT HOME END PAGEUP PAGEDOWN F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15 NUMLOCK CAPSLOCK SCROLLOCK RSHIFT LSHIFT RCTRL LCTRL RALT LALT RMETA LMETA LSUPER RSUPER MODE COMPOSE HELP PRINT SYSREQ BREAK MENU SZ UE OE AE ] // (listlen $keylist) = 144

// Method for dealing with multiple results in findbind
alias numbinds [listlen (findbind $arg1)] // number of keys having the designated term in their binds

alias add2eachbind [ // add2bind every key that has the designated term
alias addition $arg2
if (findbind $arg1) [
loop i (numbinds $itemtofind) [add2bind (at (findbind $itemtofind) $i) $addition]]]
// Example:
// add2eachbind reload [echo "reloading..."]
Thanks given by:
would be possible to use different models of weapons for each team/playermodel?(like cube2), and different weapons stats for each team? add more weapons?(like rocket launcher, hmg)
I played Dday, one thing I liked about the game were the weapons, weapons from both teams were similar, however, had different skins/models(bar vs stg,thompson vs mp40..), something like it would be interesting to AC : )
Thanks given by:
Not with cubescript (as this thread is mostly relating to).
But you could with some C++ knowledge.
Thanks given by:
(03 Nov 10, 05:08AM)Ronald_Reagan Wrote: But you could with some C++ knowledge.

Don't encourage him to change weapon stats ;)
That only leads to more cheaters.

Thanks given by: