Scripts
Noob mistake oops. And I'm surprised V-Man didn't catch it.
Thanks given by:
Actually I assumed he'd found a way to manage the alias "curname" in such a way that the game wouldn't have to (that's right, it's a simple alias that you can manually change, but which the game changes automatically). I was going to test it tomorrow. Did you test it?
Thanks given by:
I test it, it works fine, but writing 2 parameteres (2nd with"") is a little bit annoying. Maybe it'll be better only change name to '@' or '*' for example, and all sentence in same parameter.
Something like this:
alias me2 [
    oldname = $curname
    name "*"
    me $arg1
    name $oldname
]
Use: /me2 "All sentence here"
It will display -> * All sentence here
Thanks given by:
[Image: anyconnect.png]
A script for even more convenient connecting from server browser. It will ask you for password if required and it will tell you what kind of password is needed, whether you are banned, blacklisted or both! You will get unknown alias errors until you try the script, no way to fix that without implementing 1.1.0.2-only features.
Download
Edit: There has been one report of a crash on first-run from Medusa. Let me know if there are any more, include your OS.
Thanks given by:
Only problem about that Gib, is if the deban pass is something like GFA4251FADF :(
Thanks given by:
Meh, it's mostly for match servers but it wouldn't be too hard to make auto-password connect from master server.
Thanks given by:
I was making a server browser wrapper that does much of that, but can't move it forward until connectadmin functions again...
Thanks given by:
(16 Sep 10, 08:30AM)VallDiGna Wrote: I test it, it works fine, but writing 2 parameteres (2nd with"") is a little bit annoying. Maybe it'll be better only change name to '@' or '*' for example, and all sentence in same parameter.
Something like this:
Use: /me2 "All sentence here"
It will display -> * All sentence here


alias me2 [

    alias s (at $arg1 1)
    alias n $curname
    
    name (at $arg1 0)
    
    loop i (- (listlen $arg1) 2) [s = (concat $s (at $arg1 (+ $i 2)))]
    
    me $s
    name $n
]
This is the one I used to teach myke a lesson :)

But it was still annoying, having to put quotes or square brackets before and after the entire message.
I tried making it work directly with arguments, kind of like in "say". After loads of experimenting, this is what I came up with:
alias me2 [

    alias s $arg2
    alias n $curname
    alias arbit ""
    
    name $arg1
    
    loop i (- $numargs 2) [arbit = (concatword "$arg" (+ $i 3)); s = (concat $s (arbit))]
    
    me $s
    name $n
]
The problem with this is that all commands that don't need arguments and appear in your message will be executed. If you type something like "I need to quit jerking off while pissing", AC will shut down because the command "quit" will be carried out.
Thanks given by:
SPAMMER!
Thanks given by:
thank
Thanks given by:
With a modification, I can get scrolling zoom functionality with the script made by stef and modified by Kirin.
alias adjustsens [
scopefov 40
scopesensscale = (divf $scopefov $fov)
]
alias altaction_5 [ alias oldfog $fog;fog 1024
adjustsens; domodifier 1; zoom 1;
onrelease [ zoom 0; adjustsens; fog $oldfog ]
]
alias delta_game_1 [
  if (= $arg1 1) [
    if (> $scopefov 5) [scopefov (- $scopefov 5) ]
  ][
    if (< $scopefov 60) [scopefov (+ $scopefov 5) ]
  ];
  sensitivity (divf (*f (*f $oldsens $scopesensscale) $scopefov) 40)
]

However, I get two error messages.
cannot redefine builtin scopesensscale with an alias
unknown command: scopesens
unknown command: scopesens
when I press the mouse button, and
cannot redefine builtin scopesensscale with an alias
again when I release it. There aren't any additional repeats or error messages when I scroll.

Any advice on how to make those go away (or fix the problem that creates them, if it's important to?)

P.S. I'm still hoping for a script to remove everything but chat from the console, which would address making the error messages "go away"

EDIT: Because someone else and I on IRC the other day couldn't figure out where on Earth the command "scopesens" was coming from, it's in scripts.cfg- check lines 163-182 for the curious.
Thanks given by:
Quote:P.S. I'm still hoping for a script to remove everything but chat from the console, which would address making the error messages "go away"

You have no idea do you? If you make everything go the hell away except chat, "to not see the error messages", you would have no idea what would be wrong when you got a non-working script.

Thanks given by:
Can someone make me a script where its like quickknife except it pulls out your pistol. Like I press e and it would pull out my pistol and shoot and then when i let go of e it would go back to my primary weapon. It may be blacklistible/illegal not sure. Thanks.
Thanks given by:
@bballn45:
The code does not allow both of those actions to be performed on the same keypress, no matter how sophisticated the underlying script may be. I recommend getting comfortable with multi-click methods.



Announcing my first script for 1.1.0.3, the SB Wrapper!
http://www.akimbo.in/files/index.php?act=view&id=627
Allows admins easier connection in the face of adversity.

Yes, it's much like an update, but seeing that "connectadmin" didn't function properly in earlier releases of 1.1, I actually re-wrote it from scratch today. Hooray for "connectadmin"!
Thanks given by:
V-Man, you need to give me (and all others) a debriefing of new idents!
Is there on_death?
Thanks given by:
ok i didnt get a word you just said :p(ya i over exaggerated so don't want words being pointed out that i should know). i will get used to that scroll thing. just thought it would be easiar with smg.
Thanks given by:
(12 Oct 10, 03:46AM)|BC|Wolf Wrote:
Quote:P.S. I'm still hoping for a script to remove everything but chat from the console, which would address making the error messages "go away"

You have no idea do you? If you make everything go the hell away except chat, "to not see the error messages", you would have no idea what would be wrong when you got a non-working script.

Lolwut? You do realize that all AC output is logged to stdout don't you? I only need it not displayed ingame.
Thanks given by:
lol
/consize 0
Thanks given by:
Finished. Sorry, my formatting isn't hierarchical like stef and Kirin's is. But anyway, functional zoom-scroll script without any errors.

alias adjustsens [ scopefov 40 ]
alias altaction_5 [ alias oldfog $fog; fog 1024; adjustsens; domodifier 1; setscope 1; onrelease [ setscope 0; adjustsens; fog $oldfog ] ]
alias delta_game_1 [ if (= $arg1 1) [ if (> $scopefov 5) [scopefov (- $scopefov 5) ] ] [ if (< $scopefov 60) [scopefov (+ $scopefov 5) ] ]; sensitivity (divf (*f (*f $oldsens $scopesensscale) $scopefov) 40) ]
Thanks given by:
Is it possible to add cross hairs to the sniper rifle (not in scope mode)?
Thanks given by:
(14 Oct 10, 02:41AM)Instinx Wrote: Is it possible to add cross hairs to the sniper rifle (not in scope mode)?

No. That would be cheating.
Thanks given by:
(12 Oct 10, 05:55AM)Ronald_Reagan Wrote: V-Man, you need to give me (and all others) a debriefing of new idents!
Is there on_death?
No on_death yet, but there seem to be plans for it later.
Feel free to use this provisional update for docs.cfg I slapped together with my simple observations. Just copy and paste it to the end of your existing docs.cfg file.
Here is the other bunch of custom docs.cfg in case anyone is interested.
Other new idents may yet exist. If you find ones I didn't document yet, please let us all know.
docident [pstat_score] [Generates a list of score stats.];
docargument [C] [client number];
docexample [echo (pstat_score 3)] [Outputs a list of score stats for client number 3.];
docremark [stat lists: flags, frags, deaths, points, team, name.];

docident [pstat_weap] [Generates a list of weapon stats.];
docargument [C] [client number];
docexample [echo (pstat_weap 3)] [Outputs a list of weapon stats for client number 3.];
docremark [stat lists: knife attacks, knife damage, pistol shots, pistol damage, carbine shots, carbine damage, shotgun shots, shotgun damage, SMG shots, SMG damage, sniper shots, sniper damage, AR shots, AR damage, Combat pistol shots, Combat pistol damage, nades thrown, nade damage, akimbo shots, akimbo damage.];

docident [clockdisplay] [Displays game time on the top-center of the HUD.]
docargument [N] [0 .. 2] [0 = not displayed; 1 = displays time remaining; 2 = displays time spent];
docexample [clockdisplay 1];
docremark [Displays time pertaining to current game only.];

docident [current_version] [Compares a supplied argument with the current version.];
docargument [S] [string, should be $version to perform the intended function.]
docexample [current_version $version] [nothing happens if you are using the correct version.];
docexample [current_version $fov] [A message appears in the console encouraging you to update your client.];

docident [+=] [Increases an alias or variable by a specified amount.];
docargument [A] [The alias or variable name];
docargument [N] [The amount to increase it by];
docexample [+= fov 10] [Increases FOV by 10];

docident [-=] [Decreases an alias or variable by a specified amount.];
docargument [A] [The alias name];
docargument [N] [The amount to decrease it by];
docexample [-= fov 10] [Decreases FOV by 10];

docident [*=] [Sets an alias or variable to a multiplied amount.];
docargument [A] [The alias or variable name];
docargument [N] [The amount to multiply its current value by];
docexample [*= maxhistory 3] [Sets maxhistory to triple its previous value.];

docident [+=f] [Increases an alias or variable by a specified (floating-decimal) amount.];
docargument [A] [The alias or variable name];
docargument [N] [The amount to increase it by];
docexample [+=f sensitivity 1.5] [Increases mouse sensitivity by 1.5];

docident [-=f] [Decreases an alias or variable by a specified (floating-decimal) amount.];
docargument [A] [The alias or variable name];
docargument [N] [The amount to decrease it by];
docexample [-=f sensitivity 1.5] [Decreases mouse sensitivity by 1.5];

docident [*=f] [Sets an alias or variable to a multiplied (floating-decimal) amount.];
docargument [A] [The alias or variable name];
docargument [N] [The amount to multiply its current value by];
docexample [gamespeed *=f 1.5] [Changes gamespeed to 1.5 times its previous value.];

docident [gametimecurrent] [Contains the value of the "curmillis" variable from the source code.];

docident [gametimemaximum] [Is set by the source code to 900000.];

docident [lastgametimeupdate] [Contains the value of the "lastmillis" variable from the source code.];
The last three I'm a little puzzled about, if anyone wants to shed some light on them.

I haven't gone through to see if any idents have been removed...

And yeah, I know += and -= existed in earlier versions, but they've basically been restructured in the Deep Magic, so I figured a reappearance here was appropriate.
Thanks given by:
I would use the zoom but I don't have the folder no more ????? Oh well, All is good! Byee
Thanks given by:
//Mouse wheel Zoom Script by Kirin.
if (checkalias dscopefov) [] [
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 ] ]
here's a zoom script that uses modern scripting features as well as a correct sensitivity scaling. (autoscopesens parameter)
Thanks given by:
For times when one one of your hands is "busy":

bind CAPSLOCK [alias mind 4; bind MOUSE3 "jump"; bind MOUSE2 "forward"; domodifier 1; onrelease [ bind MOUSE2 [ if $editing [ showmenu editing ] [ altaction ] ]; bind MOUSE3 "weapon" ]

alias delta_game_1 [
    
    alias mind (- $mind $arg1)    
    
    if (= (mod $mind 4) 1) [
        bind MOUSE2 "backward"; echo (c 3) "BACKWARD"] [
    if (= (mod $mind 4) 2) [
        bind MOUSE2 "shiftweapon 1"; echo (c 3) "WEAPON" ] [
    if (= (mod $mind 4) 3) [
        bind MOUSE2 "crouch"; echo (c 3) "CROUCH" ] [

        bind MOUSE2 "forward"; echo (c 3) "FORWARD" ] ] ] ]
]

Toggle Capslock to use it. Scroll mousewheel to switch between forward/backward/weapon switch/couch. Hold/Click right mouse button to perform that action.

I've found it helps when I don't want to dirty my keyboard when eating, among other things ;)
Thanks given by:
Nice one Breeze.

Toggle mute with M key:
oldvol = 128 //If AC starts with soundvol 0 it will default to soundvol 128
alias mute [if (= $soundvol 0) [soundvol $oldvol; echo "AssaultCube unmuted"] [oldvol = $soundvol; soundvol 0; echo "AssaultCube muted"]]
bind M [ if $editing [ domodifier 6 ] [mute]]
If you want to permanently mute AC just use /audio 0 or else you will get unregistered sound errors if you start AC with soundvol 0.

Change volume with mousewheel, click mousewheel to see volume percentage (while holding down comma):
vol_echo_toggle = [vol_echo = 1; onrelease [vol_echo = 0]]
bind COMMA [ if $editing [ equalize 0 ] [ domodifier 20; vol_echo_toggle] ]
echovolumepercent = [unroundedvol = [*f (divf $soundvol 255) 100]; if (>= (+f (unroundedvol) 0.5) (+ (unroundedvol) 1.0)) [roundedvol = (+ (unroundedvol) 1)] [roundedvol = (+ (unroundedvol) 0)]; echo (concatword "Volume: " $roundedvol "%")]
bind MOUSE3 [weapon; echovolumepercent]
Thanks given by:
Do the pstat_* commands not work yet? They just generate a list of 0's.

EDIT: OMG, was the debug command always there? Wow.
I really need to read the docs.
Thanks given by:
I'd use += and -= but our poor friends over at 1.0.4 don't have those.
Thanks given by:
(14 Oct 10, 02:10AM)DEKiMA Wrote: Finished. Sorry, my formatting isn't hierarchical like stef and Kirin's is. But anyway, functional zoom-scroll script without any errors.

(16 Oct 10, 04:26PM)Kirin Wrote: here's a zoom script that uses modern scripting features as well as a correct sensitivity scaling. (autoscopesens parameter)

Does the former use a wrong sensitivity scaling?

Anyway, is there a way to combine these scripts with not forcing to hold the right click button? In the old 1.0.4 sniper code it was possible. That is, one right click to enter sniper mode, and another right click to exit it.

Thanks!
Thanks given by:
Does the former use a wrong sensitivity scaling?
yes! the former uses a linear scaling that would be right for a 2d plane, but this is a 3d game rendered on a 2d plane so it needs more math to compute such scaling the right way, the game automatically gives it with the command: autoscopesens 1

so it's better to use my script if u want to get used to one single sensitivity. (it's easier)


and for the math lovers :P ---->

- this is the RIGHT way:
scaledsens = sensitivity*tan(scopefov/2*RAD)/tan(fov/2*RAD)

- and this is the WRONG one: it's much simpler but wrong..
scaledsens = sensitivity*scopefov/fov

Thanks given by: