AC 1.1.1.0 scripts (currently SVN)
#1
Only post scripts for SVN (aka the next version of AssaultCube) here.

I'll start it off with a map specific settings script, which can easily be modified to work with specific modes also (this script should actually work in 1104 :p):

[cubescript]// Map specific settings for AC 1.1.1.0 (currently SVN+) by Bukz

// When a map is loaded, cubescript checks if alias map_MAPNAMEHERE_settings exists, if it does, it is automatically executed.
// Therefore, to apply map specific settings automatically, all you have to do is make an alias for each map that you want
// different settings for, see the examples below.

// don't edit these next few lines

applyMapSettings = [
if (checkalias (format map_%1_settings (curmap 1))) [
((format map_%1_settings (curmap 1)))
]
]

if (! (checkalias mapstartalways)) [ mapstartalways = "" ]
if (! (strstr $mapstartalways applyMapSettings)) [
add2alias mapstartalways applyMapSettings
]

// edit below

// Add maps below, use map_MAPNAMEHERE_settings for alias names, uncomment the echos to verify that the settings are being applied
// map_ac_complex_settings = [
// echo applying ac_complex settings
// nextprimary 5
// ]

// map_ac_stellar_settings = [
// echo applying ac_stellar settings
// nextprimary 4
// ]

// map_ac_arid_settings = [
// echo applying ac_arid settings
// nextprimary 2
// maxroll 20
// fov 120
// echo more stuff can be added
// echo like this
// ][/cubescript]
Thanks given by:
#2
I'll repost this for anyone who hasn't seen it or just forgot about it.

http://forum.cubers.net/thread-4310.html
Thanks given by:
#3
[cubescript]

// like a boos
alias likeaboss [ if (= $arg1 4) [ if (= (player1 cn) $arg2 ) [ say "%Good job, team!" ] ] ]
alias onFlag [ likeaboss $arg1 $arg2; ]


// autosorry
alias srymsgpost [ "hey %1! sorry :c" "sorry %1! :/" "sorry %1! u.u" "sorry %1! :|" ]
alias smessage [ strmsg = (at $srymsgpost (rnd 4)); result (format $strmsg $arg1) ]
alias autosorry [
if (&& (= $arg1 (player1 cn) ) (= (curmodeattr "team") 1 ) ) [
if (!= $arg1 $arg2 ) [
if (= (player1 team) (player $arg2 team) ) [
plname = (findpn $arg2); sleep 500 [voicecom sorry (smessage $plname)]
]
]
]
]
alias onKill [ autosorry $arg1 $arg2 ]

[/cubescript]
Thanks given by:
#4
Is there an option to check if you teamate has the flag? And can we get player's yaw via cubescript out of editmode now?
Thanks given by:
#5
@ Mael:

1: onFlag
2: No, but easily implemented if there are no good reasons not to. :)
Thanks given by:
#6
Next version "delayed vote" concept, if you try to votemap when a vote is already pending, cubescript will automatically call the vote after the currently pending vote ends, again, only a concept, highly untested:

[cubescript]delayedvotemap = [
votemode = ""; votemapp = ""
votemode = $arg1
votemapp = $arg2
if (&& (strlen $votemode) (strlen $votemapp)) [
if (! $votepending) [ // no votes pending = no delayed vote
tmpdelayedvotealias = "" // blank it just in case
votemap $votemode $votemapp
] [
tmpdelayedvotealias = (format "votemap %1 %2" $votemode $votemapp)
if (! (strstr $onVoteEnd tmpdelayedvotealias)) [
add2alias onVoteEnd [
sleep 500 [ // both sleeps are persistent
tmpdelayedvotealias // execute vote 500 millis after previously pending vote ended
sleep 10 [ // cleanup onVoteEnd 10 millis after that so the initial (strstr) condition will pass on subsequent uses
onVoteEnd = (strreplace $onVoteEnd "tmpdelayedvotealias;" "")
] 1
] 1
]
]
]
]
]

if (! (checkalias mapstartalways)) [ mapstartalways = "" ]
if (! (strstr $mapstartalways tmpdelayedvotealias)) [
add2alias mapstartalways [ tmpdelayedvotealias = "" ]
]
if (! (checkalias onVoteEnd)) [ onVoteEnd = "" ]
addListOnQuit "delayedvotemap votemode votemapp"[/cubescript]

/delayedvotemap

...is the command and it works exactly like the regular /votemap (e.g. /votemap MODE MAP)...only difference being is the delayed functionality.
Thanks given by:
#7
(10 Jun 12, 05:20PM)Bukz Wrote: 2: No, but easily implemented if there are no good reasons not to. :)

I can't think of one and I'm pretty good at that sort of thing.

I did just think of a script I'd love to have; the "Here" script. It uses the player's yaw and position to determine what they are pointing at and depending on which map is in play retrieves a string describing the feature in question. So [ echo Here ] while pointing to the RVSF entrance of the tunnel on ac_depot could echo "RVSF tunnel entrance".

[cubescript]
[ say "%The flag is " Here ]
[/cubescript]

Correct that CS if it's wrong. It probably is.
Thanks given by:
#8
Pretty much right, it would probably be (Here) or $Here depending on how it was implemented. It certainly wouldn't be a small script.

A new /forceall command designed for use in clan matches:

[cubescript]// forceall - designed for use in clan matches
// use:
// /forceall CLANTAGHERE rvsf - to force all players with CLANTAGHERE in their name to team rvsf.
// /forceall CLANTAGHERE cla - to force all players with CLANTAGHERE in their name to team cla.
forceall = [
if $connected [
forcetoken = $arg1
forcetm = $arg2
forcelist = ""
loop fpl 21 [
if (isclient $fpl) [
if (strstr (player $fpl name) $forcetoken) [
if (!= (player $fpl team) (at "0 1" (strcmp (tolower $forcetm) rvsf))) [
add2list forcelist $fpl
]
]
]
]
if (listlen $forcelist) [
// if (! (currole)) claimadmin // for those of you with a claimadmin/takeadmin script uncomment this line
if (currole) [
loop fal (listlen $forcelist) [
sleep (* $fal 1500) (format "forceteam %1" (at $forcelist $fal))
]
] [ echo (red)Error: (white)You need admin status for /forceall to work properly. ]
]
]
][/cubescript]
Thanks given by:
#9
Map triggers:

[cubescript]// $arg1 = map to add a trigger for
// $arg2 = unique trigger name
// $arg3 = trigger zone (a list of 2 points on a grid: "82 84 56 58" for example, 82 = minX, 84 = maxX, 56 = minY 58 = maxY, indicating a trigger zone of 2x2 cubes)
// $arg4 = trigger action (cubescript to execute upon player1 entering the trigger zone)
// $arg5 = action when not in trigger zone
addmaptrigger = [
maptoadd = $arg1
triggername = $arg2
triggerzone = $arg3
triggeraction = $arg4
nottriggeraction = $arg5

check2init (format %1_triggers $maptoadd) ""
if (! (strstr (MDArray_Get_All_Subarray_Names (format %1_triggers $maptoadd)) $triggername)) [
// trigger doesn't exist
MDArray_New_Subarray (format %1_triggers $maptoadd) $triggername (concat (addpunct $triggerzone) (addpunct $triggeraction) (addpunct $nottriggeraction))
]
]

doMapTriggers = [
curmaptriggers = (MDArray_Get_All_Subarray_Names (format %1_triggers (curmap 1)))
if (listlen $curmaptriggers) [
loop cmt (listlen $curmaptriggers) [
curtrigger = (MDArray_Get (format %1_triggers (curmap 1)) (at $curmaptriggers $cmt) -1)
curzone = (at $curtrigger 0)
if (&& (checkrange (player1 x) (at $curzone 0) (at $curzone 1)) (checkrange (player1 y) (at $curzone 2) (at $curzone 3))) [
execute (at $curtrigger 1)
] [ execute (at $curtrigger 2) ]
]
]
sleep 0 doMapTriggers
]

checkinit mapstartalways [ if (checkalias (format %1_triggers (curmap 1))) doMapTriggers ]

// Examples:
inwell = 0
wellinmsg = [ if (<f (player1 z) 3) [ if (! $inwell) [ echo get out of the well!; inwell = 1 ] ] ]
welloutmsg = [ if $inwell [ echo thank you come again!; inwell = 0 ] ]

addmaptrigger ac_desert well "136 141 159 164" wellinmsg welloutmsg
addmaptrigger ac_desert clabase "155 182 164 184" [ echo don't camp the cla base! ] []
addmaptrigger ac_desert rvsfbase "72 102 84 102" [ echo don't camp the rvsf base! ] []

addmaptrigger ac_depot spamzone "192 200 216 226" [ echo watch out for the nade spam! ] []

// you can add as many triggers for as many maps as you want[/cubescript]

Hint: Use /whereami to find the 2 points needed for a "trigger zone"
Thanks given by:
#10
Trigger zone? that sounds interesting...
Thanks given by:
#11
Its pretty cool, you can setup any number of trigger zones on a map and execute different cubescript when you enter/exit the zones.

I used it to make a WIP "AC racing" script where you would do laps around ac_complex for the best lap time.
Thanks given by:
#12
(unofficial) Campaign mode gogogo.
Thanks given by:
#13
Updated my sniper rifle scope zoom script found here, for SVN/1110:

[cubescript]default_scopefov = 50
scopefov_increment = 10

validfov = [ result (checkrange $arg1 5 60) ]

doscope = [
if (! $numargs) [
scopefov $default_scopefov
setscope 1
onrelease [ setscope 0 ]
] [
if (strcmp $arg1 "+") [
newfov = (- $scopefov $scopefov_increment)
if (validfov $newfov) [ scopefov $newfov ]
]
if (strcmp $arg1 "-") [
newfov = (+ $scopefov $scopefov_increment)
if (validfov $newfov) [ scopefov $newfov ]
]
]
]

altaction_5 = doscope
delta_game_0 = [
if (&& (= (curweapon) $SNIPER) (player1 scoping)) [
if (= $arg1 1) [ doscope + ] [ doscope - ]
] [
if (= $arg1 1) [ shiftweapon 1 ] [ shiftweapon -1 ]
]
][/cubescript]

Protip: You're gonna want to use autoscopesens with this script (or code in your own fancy scopesens scaling).

[cubescript]/autoscopesens 1[/cubescript]
Thanks given by:
#14
that all sounds pretty cool, we just need the 1.1.1 out now :>
Thanks given by:
#15
Its coming soon, I promise. :)
Thanks given by:
#16
Amazing how this is only 1 page long.
Thanks given by: