Posts: 1,823
Threads: 20
Joined: Jun 2010
So you're saying my script is better because it recognizes 5.0 as an integer? :D
Posts: 3,780
Threads: 33
Joined: Jun 2010
So, Gibstick, that checks to see if an entry is a number (floating-point or integer)?
And... You can overload ||? Didn't know that. Does that work with && too?
Posts: 1,331
Threads: 44
Joined: Jun 2010
I'm saying it is not as friendly if people are trying to reverse it to check for alpha chars instead (including "."), t'is why I settled on whole numbers.
Posts: 1,823
Threads: 20
Joined: Jun 2010
31 Jan 11, 10:30PM
(This post was last modified: 31 Jan 11, 10:36PM by Gibstick.)
It checks to see the entry will behave as an integer. Strictly speaking, 5.0 is still floating point, but when used with non-floating point operations, the .0 just gets truncated and all is well. And I don't think I'm really "overloading" ||. If there wasn't a script for this and we typed this out, we would use:
if (|| (&& (!=f (divf $arg1 1) 0.0) (=f (modf $arg1 1)) 0) (=f $arg1 0) ) [if it's an integer] [if it isn't]
And now it makes sense. I make my "math" scripts, including roundf and isint to behave like all the other operators: /isint 5.5 outputs nothing to the console, but /echo (isint 5.5) works.
Posts: 1,436
Threads: 7
Joined: Jun 2010
(31 Jan 11, 10:21PM)V-Man Wrote: And... You can overload ||? Didn't know that. Does that work with && too? Why not? || and && just "compare" numbers, and of course, they can be the results of other calculations/expressions including || and &&.
"Overload" is not really the term for this, so I hope I didn't misunderstand you.
Posts: 3,780
Threads: 33
Joined: Jun 2010
(31 Jan 11, 10:30PM)Gibstick Wrote: I make my "math" scripts, including roundf and isint to behave like all the other operators: /isint 5.5 outputs nothing to the console, but /echo (isint 5.5) works. Aye, I've been trying to do that with the tools. With Bukz' checkint (which filters out chars) and your number-checker (which detects numerical behavior), that section of string analysis could be pretty well-balanced. May I add your script to tools.cfg?
@tempest: I realize it probably isn't overloading in the strict sense, but I had never even considered giving || more than two arguments. It could turn out pretty handy. Thanks for showing me that, you two.
Posts: 1,823
Threads: 20
Joined: Jun 2010
Everything in brackets = one argument x)
Add away to tools.cfg!
Posts: 3,780
Threads: 33
Joined: Jun 2010
I've finished updating the RapidFire screenshot script! :D
Posts: 1,331
Threads: 44
Joined: Jun 2010
More of a toy than anything, but could be useful in many situations (like the akimbo countdown script :D)...
// Countdown script - counts down from x to y, in z intervals, and outputs it all on the console every A milliseconds - by DES|Bukz
alias countdown [
alias countdownfrom $arg1
alias countdownto $arg2
alias countdownint $arg3
alias countdownsleep $arg4
alias countdownsleepcounter 0
loop ctdnloop (div $countdownfrom $countdownint) [
+= countdownsleepcounter $countdownsleep
if (>= (- $countdownfrom $countdownint) $countdownto) [
sleep $countdownsleepcounter [-= countdownfrom $countdownint; echo $countdownfrom]
] []
]
]
docsection [Countdown];
docident [countdown] [Shows a countdown on the console.];
docargument [X] [The starting value.];
docargument [Y] [The ending value.];
docargument [I] [The interval to count in.];
docargument [S] [The sleep value between each echo.];
docexample [/countdown 10 0 1 1000] [Output: 10 lines on the console that show up in 1 second intervals.];
Posts: 951
Threads: 23
Joined: Jun 2010
Couldnt you four just talk about stuff the rest of us can understand? :P
Half of the stuff in this thread is about calculating numbers (DIE MATH!!!!!) that do magic to make the game better lol. Anyways thanks guys.
Posts: 1,438
Threads: 54
Joined: Jun 2010
I understand it, it's easy. Just learn CubeScript, takes like an hour xD
Posts: 951
Threads: 23
Joined: Jun 2010
DrauL ive talked to you about this lol I know enough CubeScript to understand almost evry script in here i just dont know what they do lol
Posts: 1,438
Threads: 54
Joined: Jun 2010
Look for
//comments that tell you what to do
Posts: 119
Threads: 8
Joined: Jun 2010
02 Feb 11, 07:49PM
(This post was last modified: 14 Feb 11, 07:22PM by VallDiGna.)
I think last auto-sorry script is outdated (knifed -> slashed, headshotted -> headshot). I changued a little bit it for 1.1.0.4, now the "tk-mate name" is displayed after the sorry message.
Sorry dei_oppai :(
Personal auto-sorry 1.1.0.4
Posts: 638
Threads: 10
Joined: Jun 2010
Honestly, type at least "sry" or just leave it. Such scripts are spam, nothing more nothing less...
Posts: 205
Threads: 3
Joined: Jun 2010
add "sleep" between loops, example: /sloop a 5 1000 [echo $a]
//sloop tool by =SA=macm
alias sloop [
slp1 = $arg1
slp2 = $arg2
slp3 = $arg3
slp4 = $arg4
slp5 = (result (concatword "$" $slp1))
loop $slp1 $slp2 [sleep (* (slp5) $slp3) [$slp1 = (+ ($slp1) 1); slp4; if (= ($slp1) (- $slp2 1)) [
loop slp6 6 [if (= $slp6 0) [delalias $slp1] [delalias (concatword "slp" $slp6)]]
] []]];
$slp1 = -1
]
Posts: 1,823
Threads: 20
Joined: Jun 2010
^Sauer has hardcoded indent for that too :(
Posts: 1,331
Threads: 44
Joined: Jun 2010
Oh behalf of V-Man:
// breakloop -- "Stops" a loop at a certain point to execute a given command -- by V-Man
alias breakloop [
brk = 0
brkstop = 0
loop ta 99 [
if $brkstop [] [
if (arg1) [brkstop = 1; arg2] [+= brk 1]]]]
// breakloop [condition to stop on (stops after 99 loops)] [command to execute when stopped]
// Uses $brk as a counter
// breakloop [= $brk 11] [echo brk is $brk]
// tmpgen -- uses breakloop to create a not-already-existing temporary alias with a name prefix of "tmp" and suffix of 0-99
alias tmpgen [
tmp_command = $arg1
breakloop [! (checkalias (concatword "tmp" $brk))] [alias (concatword "tmp" $brk) (getalias tmp_command)]
delalias tmp_command
]
// Deletes all aliases beginning with "tmp" and having a number between 0 and 99 as a suffix
addcheck_onquit [loop td 99 [delalias (concatword "tmp" $td)]]
Posts: 554
Threads: 45
Joined: Dec 2010
05 Feb 11, 04:25AM
(This post was last modified: 05 Feb 11, 04:26AM by Duckett.)
My first script
bind 9 [
say "Bye Dudes"
sleep 1000 [say "No Seriously"]
sleep 2000 [say "I will this time"]
sleep 3000 [say "Fine I'm not leaving"]
sleep 4000 [disconnect]
]
Special thanks to DES|Bukz
Posts: 25
Threads: 0
Joined: Dec 2010
I wonder if this is any helpful...
bind "R" [ // something useless made by |FOX|Yarukinasu...
reload
if (|| (= (curweapon) 0) (= (curweapon) 8)) [ // avoid failure
echo "LOL FAIL" ] [ // accept success
echo "reloading..."
alias reloadtime
if (|| (= (curweapon) 1) (= (curweapon) 9)) [ // PISTOL OR AKIMBO
reloadtime = 1400 ]
if (= (curweapon) 2) [ // CARBINE
reloadtime = 1800 ]
if (= (curweapon) 3) [ // PRO GUN
reloadtime = 2400 ]
if (= (curweapon) 4) [ // SUBMACHINE GUN
reloadtime = 1650 ]
if (= (curweapon) 5) [ // NOOB GUN
reloadtime = 1950 ]
if (= (curweapon) 6) [ // ASSAULT RIFLE
reloadtime = 2000 ]
sleep $reloadtime [ echo "reloaded" ] ] ]
Also... what is the weapon if (curweapon) is 7?
Posts: 1,331
Threads: 44
Joined: Jun 2010
05 Feb 11, 07:23PM
(This post was last modified: 05 Feb 11, 10:23PM by Bukz.)
Takeadmin on steroids:
// takeadmin.cfg by DES|Bukz - Claim admin status on multiple servers with different passwords with a single
// command that requires no arguments. Bind to a key for a quick admin/non-admin toggle key. Can be used within
// other cubescripts to make the automation of server processes possible/easy. Comes with built-in commands for
// managing your admin passwords list "on-the-fly". Many thanks to grenadier's "claimadmin" which powers much of
// this script.
// Requires tools.cfg: http://forum.cubers.net/thread-1776.html
if (checkalias admin_list) [] [admin_list = []]
alias takeadmin [
if (&& $connected (= (currole) 0)) [
if (> (listlen $admin_list) 0) [
alias app (findlist $admin_list (curserver 1))
if (!= $app -1) [
echo (c 0)Claiming admin for server (c 2) (getalias (format "%1_d" (at $admin_list $app))) (c 0) using password (c 2) (at $admin_list (+ $app 1))
setadmin 1 (at $admin_list (+ $app 1))
] [
alias app (findlist $admin_list (concatword (curserver 1) : (curserver 3)))
if (!= $app -1) [
echo (c 0)Claiming admin for server (c 2) (getalias (format "%1_d" (at $admin_list $app))) (c 0) using password (c 2) (at $admin_list (+ $app 1))
setadmin 1 (at $admin_list (+ $app 1))
] [
alias tmp_hostname (curserver 2)
alias app (findlist $admin_list $tmp_hostname)
if (!= $app -1) [
echo (c 0)Claiming admin for server (c 2) (getalias (format "%1_d" (at $admin_list $app))) (c 0) using password (c 2) (at $admin_list (+ $app 1))
setadmin 1 (at $admin_list (+ $app 1))
] [
alias app (findlist $admin_list (concatword $tmp_hostname : (curserver 3)))
if (!= $app -1) [
echo (c 0)Claiming admin for server (c 2) (getalias (format "%1_d" (at $admin_list $app))) (c 0) using password (c 2) (at $admin_list (+ $app 1))
setadmin 1 (at $admin_list (+ $app 1))
] [
echo (c 3)Cannot find an admin password for this server in your configuration!
]
]
]
]
] [
echo (c 3)Your admin passwords list is empty!
]
] [setadmin 0]
]
// Adds entries to your admin passwords list.
alias add2adminlist [
if (< $numargs 3) [
echo (c 3)add2adminlist requires 3 arguments, one for the IP, one for the password, and the last for the description.
] [
if (strstr $admin_list (concat $arg1 $arg2)) [] [
add2list admin_list (concat $arg1 $arg2)
alias (format "%1_d" $arg1) $arg3
echo (c 0)Added (c 2)server (c 5) (concatword $arg3 :) (c 2)IP: (c 5) $arg1 (c 2)Password: (c 5) $arg2 (c 2)to your admin passwords list.
]
]
]
// Clears the entire contents of your admin passwords list.
alias clearadminlist [
if (= $arg1 1) [
alias admin_list []
echo (c 2)Your admin passwords list has been cleared!
] []
]
// Clears an entry from your admin passwords list.
alias delfromadminlist [
if (< $numargs 1) [
echo (c 3)delfromadminlist requires 1 argument, the IP of the server to delete.
] [
alias delipcounter 0
alias delpwcounter 1
tmp_admin_list = []
loop deladminloop (div (listlen $admin_list) 2) [
if (strcmp (at $admin_list $delipcounter) $arg1) [echo (c 3)Removed (c 2)server (c 5) (concatword (getalias (format "%1_d" $arg1)) :) (c 2)IP: (c 5) $arg1 (c 2)Password: (c 5) (at $admin_list (+ $delipcounter 1)) (c 2)from your admin passwords list.] [
tmp_admin_list = (concat $tmp_admin_list (at $admin_list $delipcounter) (at $admin_list $delpwcounter))
]
+= delipcounter 2
+= delpwcounter 2
]
admin_list = $tmp_admin_list
]
]
// Updates the password for an entry in your admin passwords list.
alias updateadminlist [
if (< $numargs 2) [
echo (c 3)updateadminlist requires 2 arguments, one for the IP of the server to update, the last for the new password.
] [
alias ipcounter 0
loop upadminloop (div (listlen $admin_list) 2) [
if (strcmp $arg1 (at $admin_list $ipcounter)) [
delfromadminlist $arg1
add2adminlist $arg1 $arg2 (getalias (format "%1_d" $arg1))
echo (c 1)Updated (c 2)server (c 5) (concatword (getalias (format "%1_d" $arg1)) :) (c 2)IP: (c 5) $arg1 (c 2)with the new password: (c 5) $arg2
] []
+= ipcounter 2
]
]
]
// Shows the contents of your admin passwords list.
alias showadminlist [
alias ipcounter 0
alias pwcounter 1
loop showadminloop (div (listlen $admin_list) 2) [
if (checkalias (format "%1_d" (at $admin_list $ipcounter))) [
echo (c 2)Description: (c 5) (getalias (format "%1_d" (at $admin_list $ipcounter))) (c 2)IP: (c 5) (at $admin_list $ipcounter) (c 2)Password: (c 5) (at $admin_list $pwcounter)
] [
echo (c 2)IP: (c 5) (at $admin_list $ipcounter) (c 2)Password: (c 5) (at $admin_list $pwcounter)
]
+= ipcounter 2
+= pwcounter 2
]
]
docsection [Take Admin];
docident [takeadmin] [Automatically claims admin status on predefined servers.];
docremark [Drops admin status if executed while having admin status.];
docident [add2adminlist];
docargument [I] [The IP or hostname of the server.];
docargument [P] [The admin password to use.];
docargument [D] [The description of the server.];
docexample [/add2adminlist 127.0.0.1 temporarypassword "My servers"] [Result: Attempts to claim admin with password "temporarypassword" on any server running from IP "127.0.0.1" when executing /takeadmin];
docexample [/add2adminlist 127.0.0.1:1337 temporarypassword "My LAN server"] [Result: Attempts to claim admin with password "temporarypassword" on the server running from port "1337" on IP "127.0.0.1" when executing /takeadmin.];
docremark [Specific ports can be specified in the first argument to support multiple servers on the same IP with different passwords.];
docident [clearadminlist] [Clears the contents of your admin passwords list.];
docargument [X] [Must be 1 to function.];
docexample [/clearadminlist 1] [Clears the list.];
docident [delfromadminlist] [Clears an entry from your admin passwords list.];
docargument [I] [The IP of the server you wish to delete the entry for.];
docexample [/delfromadminlist 127.0.0.1:1337] [Clears server 127.0.0.1:1337 and it's password from your admin password list.];
docident [updateadminlist] [Updates a password for an entry in your admin passwords list.];
docargument [I] [The IP of the server you wish to update the password for.];
docargument [N] [The new password.];
docexample [/updateadminlist 127.0.0.1 newpass] [Updates servers 127.0.0.1 password to "newpass" in your admin passwords list.];
docident [showadminlist] [Shows your admin passwords list.];
The new "takeadmin" command will automatically claim admin status on the current server if a password is found for it in your admin passwords list. You can bind this to a key for a quick "on/off admin" key. To do that use something along the lines of:
...where "KEY" is the name of the key you want to bind. If you don't have admin status when executing this command (or pressing the bind) it will auto-claim admin status, if you already have admin status it will drop it.
The "on steroids" bit comes into play with the new admin passwords list managing commands that allow you to delete from, update, or add to the list "on-the-fly". Here's a list of the new in-game commands that can be used:
/takeadmin - Automatically claim admin on the current server if the password is found in your list.
/add2adminlist - Add a server to your admin passwords list.
/clearadminlist - Clears the entire contents of your admin passwords list.
/delfromadminlist - Clears the given server's entry from your admin passwords list.
/updateadminlist - Changes the password for the given server's entry in your admin passwords list.
/showadminlist - Displays the entire contents of your admin passwords list.
Since entries won't be added if they already exist in your list, "add2adminlist" can be used multiple times in your "autoexec.cfg" to ensure that certain entries are ALWAYS in your admin passwords list. e.g.:
add2adminlist 127.0.0.1:1337 test_password_1 "My LAN Server #1"
add2adminlist 127.0.0.1:1338 test_password_2 "My LAN Server #2"
add2adminlist 255.255.255.255 test_password_3 "Some weird server"
Would always keep those 3 entries in your admin passwords list (unless you used delfromadminlist, in which case that password would become unavailable for the current session, but will come back upon restarting AC unless you remove it from your configuration entirely).
Many thanks to grenadier's original "claimadmin" script which powers much of the script. :)
NOTE: I have not taken the time to write up proper error handling or anything like that, what little bit there is in the script is minimal and is only checking for a proper number of arguments, if you give any of the script's commands invalid arguments, the results may be quite unexpected. Try to verify that you're giving the commands proper arguments before pressing enter. ;)
And some auto-admin scripts to go along with it... ;)
// auto_admin.cfg by DES|Bukz
alias get_screenshot_type [
if (= $screenshottype 0) [alias screenshotextension ".bmp"] [
if (= $screenshottype 1) [alias screenshotextension ".jpg"] [
alias screenshotextension ".png"
]
]
result $screenshotextension
]
alias banscreenshot [
screenshot (concatword screenshots\bans\ "banshot_" (at (timestamp) 0) (at (timestamp) 1) (at (timestamp) 2) _ (at (timestamp) 3) . (at (timestamp) 4) . (at (timestamp) 5) _ (curmap 1) (get_screenshot_type))
]
alias whoscreenshot [
screenshot (concatword screenshots\whois\ "whoshot_" (at (timestamp) 0) (at (timestamp) 1) (at (timestamp) 2) _ (at (timestamp) 3) . (at (timestamp) 4) . (at (timestamp) 5) _ (curmap 1) (get_screenshot_type))
]
if (checkalias autodrop) [] [alias autodrop 0]
// Uncomment the line below to automatically drop admin status after using auto-admin commands.
// autodrop = 1
alias aban [
if (= (currole) 0) [
takeadmin
sleep 300 [whois $arg1]
sleep 600 [toggleconsole]
sleep 900 [ban $arg1 admin]
sleep 1200 [banscreenshot]
sleep 1500 [
toggleconsole
if $autodrop [setadmin 0] []
]
] [
whois $arg1
sleep 300 [toggleconsole]
sleep 600 [ban $arg1 admin]
sleep 900 [banscreenshot]
sleep 1200 [
toggleconsole
if $autodrop [setadmin 0] []
]
]
]
alias akick [
if (= (currole) 0) [
takeadmin
sleep 300 [whois $arg1]
sleep 600 [kick $arg1 admin]
sleep 900 [if $autodrop [setadmin 0] []]
] [
whois $arg1
sleep 300 [kick $arg1 admin]
sleep 600 [if $autodrop [setadmin 0] []]
]
]
alias aforce [
if (= (currole) 0) [
takeadmin
sleep 300 [forceteam $arg1]
sleep 600 [if $autodrop [setadmin 0] []]
] [
forceteam $arg1
sleep 300 [if $autodrop [setadmin 0] []]
]
]
alias awhois [
if (= (currole) 0) [
takeadmin
sleep 300 [toggleconsole]
sleep 600 [whois $arg1]
sleep 900 [whoscreenshot]
sleep 1200 [
toggleconsole
if $autodrop [setadmin 0] []
]
] [
toggleconsole
sleep 300 [whois $arg1]
sleep 600 [whoscreenshot]
sleep 900 [
toggleconsole
if $autodrop [setadmin 0] []
]
]
]
alias adeny [
if (= (currole) 0) [
takeadmin
sleep 300 [vote 2]
sleep 600 [if $autodrop [setadmin 0] []]
] [
vote 2
sleep 300 [if $autodrop [setadmin 0] []]
]
]
alias aaccept [
if (= (currole) 0) [
takeadmin
sleep 300 [vote 1]
sleep 600 [if $autodrop [setadmin 0] []]
] [
vote 1
sleep 300 [if $autodrop [setadmin 0] []]
]
]
docsection [Auto Admin];
docident [aban] [Automatically whois, ban, and screenshot a specified client.];
docargument [C] [A valid client number.];
docremark [Uses takeadmin to auto-claim admin status to ensure the forced completion of the command, and outputs custom named screenshots to /screenshots/bans/];
docident [akick] [Automatically whois and kick a specified client.];
docargument [C] [A valid client number.];
docremark [Uses takeadmin to auto-claim admin status to ensure the forced completion of the command.];
docident [aforce] [Automatically force a specified client to the other team.];
docargument [C] [A valid client number.];
docremark [Uses takeadmin to auto-claim admin status to ensure the forced completion of the command.];
docident [awhois] [Automatically whois and screenshot a specified client.];
docargument [C] [A valid client number.];
docremark [Uses takeadmin to auto-claim admin status to ensure the forced completion of the command, and outputs custom named screenshots to /screenshots/whois/];
docident [adeny] [Automatically force any pending vote to fail.];
docremark [Uses takeadmin to auto-claim admin status to ensure the forced completion of the command.];
docident [aaccept] [Automatically force any pending vote to pass.];
docremark [Uses takeadmin to auto-claim admin status to ensure the forced completion of the command.];
docident [autodrop] [If set to 1, automatically drops admin status after using an auto-admin command.];
docexample [/autodrop = 1] [Enables automatic admin-drop.];
docexample [/autodrop = 0] [Disables automatic admin-drop.];
You'll want to make a "bans" and a "whois" folder within your existing "screenshots" folder before using "aban" or "awhois".
Commands here are:
/aban - forced ban of a specified client, full IP whois + screenshot.
/akick - forced kick of a specified client, full IP whois.
/aforce - forced forceteam of a specified client.
/awhois - forced full IP whois of a specified client.
/adeny - forced pending vote fail.
/aaccept - forced pending vote pass.
/autodrop = 0 - no auto-drop admin after using an auto-admin command
/autodrop = 1 - auto-drop admin after using an auto-admin command
Enjoy! :)
Posts: 3
Threads: 0
Joined: Jun 2010
10 Feb 11, 04:02PM
(This post was last modified: 11 Feb 11, 05:31PM by JSchweigert.)
I'm a noob when it comes to scripting, but after reading all the commands and looking through here, I was able to come up with my first script. Please tell me if there is anything wrong or if there's anything I could fix/change.
(EDIT: Updated with newer version.)
// --------------------------------
// No fog script by JSchweigert --
// Press "`" to turn it on/off. --
// --------------------------------
alias nofog [ if (!= $fog 1024) [ alias oldfog $fog; fog 1024; echo (c 0) "No Fog: ON" ] [ fog $oldfog; echo (c 3) "No Fog: OFF" ] ]
bind BACKQUOTE [ nofog ]
Posts: 1,823
Threads: 20
Joined: Jun 2010
10 Feb 11, 10:25PM
(This post was last modified: 10 Feb 11, 10:26PM by Gibstick.)
When I make toggles, I usually just use 1 and 0, but it doesn't really matter. Your script works. However, you may want to give instructions to type
/addOnLoadAlways [ alias x "333" ]
in-game, so that their current "mapstartalways" isn't wiped. Don't add it to autoexec or it will be added every time AC is started. There's also strstr and checkalias, but I'm usually too lazy for that. Instead of using an alias to toggle, you could just check if the fog is 1024 or not.
togglefog = [ if (= $fog 1024) [ if (&& (checkalias oldfog) (>= $oldfog 64) ) [ fog $oldfog ] [ fog 180 ] ] [ oldfog = $fog; sleep 5 [ fog 1024 ] ] ] ]
Yes, that's the most error proof simple script I've ever written.
Posts: 3,780
Threads: 33
Joined: Jun 2010
Or use tools.cfg. :-P
@Yarukinasu: weapon index of 7 indicates the akimbo.
Posts: 1,331
Threads: 44
Joined: Jun 2010
IIRC, '/echo (curweapon)' while holding the akimbo returns 9.
Posts: 1,823
Threads: 20
Joined: Jun 2010
It is 9. Remember the combat pistol!11!!!
Posts: 3,780
Threads: 33
Joined: Jun 2010
:( No, cuz I never got to play with it.
Posts: 1,331
Threads: 44
Joined: Jun 2010
15 Feb 11, 09:24AM
(This post was last modified: 15 Feb 11, 09:29AM by Bukz.)
Auto-pillar script for mappers:
// Auto-pillar script for mappers by DES|Bukz
if (checkalias auto_pillar_corner) [] [alias auto_pillar_corner 0]
alias makepillar [
if $editing [
if (= $arg1 4) [
x_sel = (- $selx 2); y_sel = (- $sely 2)
select $x_sel $y_sel 4 4; solid 1
select $x_sel $y_sel 1 1; if $auto_pillar_corner [corner] []
+= x_sel 3; select $x_sel $y_sel 1 1
if $auto_pillar_corner [corner] []; -= x_sel 3
+= y_sel 3; select $x_sel $y_sel 1 1
if $auto_pillar_corner [corner] []; += x_sel 3
select $x_sel $y_sel 1 1; if $auto_pillar_corner [corner] []
] [
if (= $arg1 6) [
x_sel = (- $selx 3); y_sel = (- $sely 3)
select $x_sel $y_sel 6 6; solid 1
select $x_sel $y_sel 1 1; if $auto_pillar_corner [corner] []
+= x_sel 5; select $x_sel $y_sel 1 1
if $auto_pillar_corner [corner] []; -= x_sel 5
+= y_sel 5; select $x_sel $y_sel 1 1
if $auto_pillar_corner [corner] []; += x_sel 5
select $x_sel $y_sel 1 1; if $auto_pillar_corner [corner] []
] [
if (= $arg1 8) [
x_sel = (- $selx 4); y_sel = (- $sely 4)
select $x_sel $y_sel 8 8; solid 1
select $x_sel $y_sel 1 1; if $auto_pillar_corner [corner] []
+= x_sel 7; select $x_sel $y_sel 1 1
if $auto_pillar_corner [corner] []; -= x_sel 7
+= y_sel 7; select $x_sel $y_sel 1 1
if $auto_pillar_corner [corner] []; += x_sel 7
select $x_sel $y_sel 1 1; if $auto_pillar_corner [corner] []
] [echo make_pillar only allows 4, 6, or 8 as an argument.]
]
]
] []
]
newmenu [Auto Map Commands]
menuitemvar [concat (c 2)Pillars] [showmenu "Pillars"]
menuitem [ OK] [closemenu "Auto Map Commands"]
if (checkalias pillar_size) [] [pillar_size = 4]
newmenu [Pillars]
menuitemslider [Size: ] 4 8 [$pillar_size] 2 ["small (4x4)" "" "medium (6x6)" "" "large (8x8)"] [pillar_size = $arg1]
menuitemcheckbox [Automatically corner pillars?] [$auto_pillar_corner] [auto_pillar_corner = $arg1]
menuitem [] -1
menuitemvar [concat (c 1)Make pillar!] [makepillar $pillar_size]
menuitem [] -1
menuitem [ OK] [closemenu "Pillars"]
alias mapcom [showmenu "Auto Map Commands"]
// Change "KEY" to whatever key you want to use for viewing the menu
bind KEY [mapcom]
docsection [Auto Map];
docident [makepillar] [Automatically creates a square pillar of the given size.];
docargument [S] [The size of the pillar: 4, 6, or 8];
docexample [/makepillar 4] [Creates a 4x4 pillar centered over the current selection.];
docremark [If auto_pillar_corner is set to 1, the resulting pillars will have automatically cornered corners.];
docident [mapcom] [Shows the "Auto Map Commands" menu.];
Be sure to edit line 58 of the script to change the bind to the key of your choice, otherwise you'll see an error about unknown key 'KEY' on startup.
There is a menu to make things easier, use the:
...command or your keybind to view the menu. From here you can set the size of the pillar, decide whether or not to automatically corner it, and actually create the pillar. If you prefer to use commands:
...is the command used to automatically create the pillars. It only requires 1 arugment, the size, and the only valid arguments currently are 4 (4x4 pillar), 6 (6x6 pillar), or 8 (8x8 pillar) until other sizes are suggested/requested.
The command obviously only works while in edit mode, and therefore the menu will only be useful then as well (unless you're just settings some defaults for later). It has NOT yet been tested in coop edit and so if anyone tries it let me know how it goes. HF, enjoy. :)
Posts: 137
Threads: 2
Joined: Jun 2010
15 Feb 11, 06:40PM
(This post was last modified: 15 Feb 11, 07:06PM by Kirin.)
HOW TO CHECK FOR FLOATING POINT:
no need for fancy modf stuff or other bruteforce checking :P
this will work always (for number that fit in the precision&size allowed by the game).
alias "isfloat" [if (strcmp (+f $arg1 0) $arg1) [result 1] [result 0]]
alias "isint" [if (strcmp (+ $arg1 0) $arg1) [result 1] [result 0]]
alias "isnumber" [if (|| (isfloat $arg1) (isint $arg1)) [result 1] [result 0]]
:)
(V-Man nice work on the toolbox thing)
Posts: 1,331
Threads: 44
Joined: Jun 2010
15 Feb 11, 07:02PM
(This post was last modified: 15 Feb 11, 07:08PM by Bukz.)
Auto-search on startup/exec script, searches for players in a predefined list of names at a predefined rate automatically upon launching AC/executing the command. Comes with a menu and "on-the-fly" list managing features to make life easier:
NOTE: This script requires tools.cfg!
// Auto-Search script by DES|Bukz - Automatically searches for players on servers by looping through a list of names.
// With "on-the-fly" list managing features and a menu. Requires tools.cfg!
if (checkalias names_to_search) [] [alias names_to_search []]
if (checkalias auto_search) [] [alias auto_search 0]
if (checkalias time_between_searches) [] [alias time_between_searches 10000]
if $auto_search [init_search] []
// alias names_to_search ["{FOO}" "John" "Jane" "Doe" "DEV|"]
// add2initsearch - Adds an entry to your auto-search list if it doesn't already exist.
alias add2initsearch [
alias found 0
loop tmp_search (listlen $names_to_search) [
if (strcmp (at $names_to_search $tmp_search) $arg1) [found = 1] []
]
if $found [] [
add2list names_to_search $arg1
echo (c 1)Successfully added (c 5) $arg1 (c 1)to your auto-search list.
]
]
// updateinitsearch - Updates an entry within your auto-search list.
alias updateinitsearch [
tmp_list = []
loop tmp_search (listlen $names_to_search) [
if (strcmp (at $names_to_search $tmp_search) $arg1) [add2list tmp_list $arg2] [add2list tmp_list (at $names_to_search $tmp_search)]
]
names_to_search = $tmp_list
echo (c 1)Successfully updated (c 5) $arg1 (c 1)to (c 5) (concatword $arg2 ".")
]
// delfrominitsearch - Deletes an entry from your auto-search list.
alias delfrominitsearch [
tmp_list = []
loop tmp_search (listlen $names_to_search) [
if (strcmp (at $names_to_search $tmp_search) $arg1) [] [add2list tmp_list (at $names_to_search $tmp_search)]
]
names_to_search = $tmp_list
echo (c 1)Successfully deleted (c 5) $arg1 (c 1)from your auto-search list.
]
// dumpinitsearch - Shows all entries in your auto-search list.
alias dumpinitsearch [
if (> (listlen $names_to_search) 0) [
loop tmp_search (listlen $names_to_search) [
echo (c 2)Auto-search entry (concatword "#" (+ $tmp_search 1) ":") (c 5) (at $names_to_search $tmp_search)
]
] [echo (c 3)There are no entries in your auto-search list. Use /add2initsearch to add some!]
]
// init_search - Search sequence, sleeps a specified amount of time between query switches, loops through the entire
// names_to_search list.
alias init_search [
tmp_search_int = -1
tmp_counter = 0
loop search_loop (listlen $names_to_search) [
sleep $tmp_counter [closemenu search; sleep 0 [+= tmp_search_int 1; searchnickname (at $names_to_search $tmp_search_int)]]
+= tmp_counter $time_between_searches
]
]
newmenu [Auto Search]
menuitemcheckbox [Enable init search?] [$auto_search] [auto_search = $arg1]
menuitemslider [Milliseconds between searches: ] 2500 15000 [$time_between_searches] 2500 [] [time_between_searches = $arg1]
menuitemvar [concat (c 2)Manage search list] [showmenu "Manage Auto Search List"]
menuitem [] -1
menuitem [ Search!] [init_search]
menuitem [ OK] [closemenu "Auto Search"]
newmenu [Manage Auto Search List]
menuitemvar [concat (c 0)Add to the search list...] [saycommand /add2initsearch ""]
menuitemvar [concat (c 3)Delete from the search list...] [saycommand /delfrominitsearch ""]
menuitemvar [concat (c 2)Update an entry in the search list...] [saycommand /updateinitsearch ""]
menuitemvar [concat (c 1)Show the contents of your search list...] [dumpinitsearch]
menuitem [] -1
menuitem [ OK] [closemenu "Manage Auto Search List"]
add2menu Misc [menuitemvar [concat (c 2)Auto-Search settings...] [showmenu "Auto Search"]]
alias as [showmenu "Auto Search"]
docsection [Auto-Search];
docident [init_search] [When enabled; automatically executed on startup, searching for all names in a list.];
docremark [Loops through the entire contents of alias "names_to_search" and searches for people currently online that are using those names.];
docident [add2initsearch] [Adds an entry to your auto-search list.];
docargument [N] [The name to add.];
docident [updateinitsearch] [Updates an entry in your auto-search list.];
docargument [O] [The old entry to replace.];
docargument [N] [The new entry (name).];
docexample [/updateinitsearch FOO foo] [Result: Replaces "FOO" with "foo" in your auto-search list.];
docident [delfrominitsearch] [Deletes an entry from your auto-search list.];
docargument [N] [The name (entry) to delete.];
docident [dumpinitsearch] [Shows the entire contents of your auto-search list.];
docident [as] [Shows the auto-search menu.];
...command and/or viewing it from the Settings > Misc menu. From here you can enable/disable the script, set the search frequency interval, perform the searches, and access the other menu which helps you manage your list of auto-search names on-the-fly.
The list of commands are:
/init_search - Performs the automatic searching of players in your auto-search list.
/add2initsearch - Adds entries to your auto-search list.
/as - Shows the auto-search menu.
/delfrominitsearch - Deletes entires from your auto-search list.
/dumpinitsearch - Shows the entire contents of your auto-search list.
/updateinitsearch - Updates entires in your auto-search list.
Basically, the script will make it easy for you to search for multiple people/clans by using a predefined list of names to search for and allowing you to configure how the script behaves on-the-fly.
|