Scripts
could someone please tell me why my rewind script isn't working ahhhhhhhhh, !!:(
Thanks given by:
(21 Mar 12, 06:03AM)Spicy_Orange1 Wrote: hey, im pretty.. im mean mega.. noob, and i was wondering how to use the script, cause that switch to pistl when out of ammo one sounds really neat
That script doesn't work in this version anymore.
Thanks given by:
You can use other stuff/script to change to pistol.
Not automatically when out of ammo but still...

[cubescript]pistolera = [
if (|| (= (curmode) 10) (= (curmode) 11)) [ if (= (curweapon) (currentprimary)) melee primary ] [
if (= (curweapon) (currentprimary)) secondary primary
]
][/cubescript]

bind "mouse3" [pistolera]

This lets you press mousewheel to change from primary weapon to pistol.
Pressing it when having pistol will change back to primary weapon.

Playing T/OSOK will let you change from sniper to knife and back - still by pressing mousewheel of course.

This script is not made by me, so no credits goes this way.
Thanks given by:
I think this script does the same thing OS, and it's much smaller.
[code=cubescript]bind KEY [if (= (curweapon) 0) [primary] [weapon 0]][/code]
Thanks given by:
Wolf, you forgot about the pistol functionality! D:

But...[cubescript]bind MOUSE3 [secondary; primary; melee; grenades][/cubescript]This works in every mode. Plus, you can change the order of the "primary", "melee", etc. commands as a sort of "priority" ordering. If the first weapon from left to right can be switched to (i.e. it isn't disabled by the current game mode and you aren't already holding it) it will switch to it. If not, it will try the next one, and so on.

I personally prefer this:
[cubescript]bind Q [ if $editing [ domodifier 1 ] [primary; secondary; melee; grenades] ]
autoreload 0[/cubescript]and I leave MOUSE3 for the knife (MOUSE2 is obviously still nades) This way, I can access every weapon without scrolling or using 1-4... except when I'm using sniper in a non-OSOK mode. Damn scoping.
Thanks given by:
Why is my rewind script not working anymore? :( It just skips the demo and stops. Hey! Wake up peeps! bump bump bump bump
Thanks given by:
Post the script you're using or try backing up and deleting your /config/saved.cfg and trying the script again, maybe its messing with one of the variables used by the script - theres no way of knowing unless you post it though :p

EDIT: DON'T post your saved.cfg (as it could have private information, passwords and whatnot), post the rewind script that you are using. :p

Also note that /rewind and /setmr (set minutes remaining) are hardcoded for the next version of AC, no scripts needed anymore. :)
Thanks given by:
// "Rewind" workaround by V-Man
// rewind x, where "x" is the number of minutes back to rewind
// setmr x, where "x" is the "minutes remaining" mark to skip to

[cubescript]
alias rewind [
if (watchingdemo) [
alias rewindtime (*f $arg1 60000)
alias timemark (* $minutesremaining 60000)
alias mapstartonce [
alias mapstartonce [
alias demosleeplength (- (* $minutesremaining 60000) (+ $rewindtime $timemark))
gamespeed 1000
tmp = $soundvol
soundvol 0
sleep $demosleeplength [gamespeed 30; soundvol $tmp]]
demo $_demofile)]
stopdemo
] [echo Not currently watching a demo.]]

alias setmr [
if (watchingdemo) [
alias millisrem (*f $arg1 60000)
alias mapstartonce [
alias mapstartonce [
alias demosleeplength (- (* $minutesremaining 60000) $millisrem)
gamespeed 1000
tmp = $soundvol
soundvol 0
sleep $demosleeplength [gamespeed 30; soundvol $tmp]]
demo $_demofile)]
stopdemo
] [echo Not currently watching a demo.]]

// Thanks to GeneralDisarray for saving our ears:
// tmp = $soundvol; soundvol 0 and afterwards soundvol $tmp

[/cubescript]



This is the Script obviously...and i already deleted saved.cfg once when i installed the script

Mod edit: put code into cubescript tags.
Thanks given by:
Quote:demo $_demofile)]

I have a suspicion this is the problematic line. Looks like an extra ")" snuck its way in there.

Change it to:

Quote:demo $_demofile]

and try again. :)
Thanks given by:
(15 May 12, 03:02AM)Bukz Wrote:
Quote:demo $_demofile)]

I have a suspicion this is the problematic line. Looks like an extra ")" snuck its way in there.

Change it to:

Quote:demo $_demofile]

and try again. :)

believe it or not Bukz, this made everything go into slow motion for a Looooong time. idk how long, but it was so weird.
Ugh...same script works fine on my laptop with puppy linux. :(
Thanks given by:
[cubescript]
alias rewind [
if (watchingdemo) [
alias rewindtime (*f $arg1 60000)
alias timemark (* $minutesremaining 60000)
alias mapstartonce [
alias mapstartonce [
alias demosleeplength (- (* $minutesremaining 60000) (+ $rewindtime $timemark))
gamespeed 1000
tmp = $soundvol
soundvol 0
sleep $demosleeplength [gamespeed 100; soundvol $tmp]]
demo $_demofile]
stopdemo
] [echo Not currently watching a demo.]]

alias setmr [
if (watchingdemo) [
alias millisrem (*f $arg1 60000)
alias mapstartonce [
alias mapstartonce [
alias demosleeplength (- (* $minutesremaining 60000) $millisrem)
gamespeed 1000
tmp = $soundvol
soundvol 0
sleep $demosleeplength [gamespeed 100; soundvol $tmp]]
demo $_demofile]
stopdemo
] [echo Not currently watching a demo.]]
[/cubescript]

This tested OK on my end. I don't know why we would set gamespeed to 30 at the end so I changed it to 100. Checked the brackets and they're all matched.
Thanks given by:
Hey guys, I have a problem - my script does not work.

http://pastebin.com/fdYQ1BKg

These "sorry" messages work, but "imonyourteamman" don't. Why?
Thanks.
Thanks given by:
Got it. :)
Thanks given by:
And the problem was?
Thanks given by:
Actually I do not know. I deleted some keywords that seemed useless and voila, it works!

// This file gets executed every time you start AssaultCube.

// This is where you should put any scripts you may have created for AC.

if (! (strstr $mapstartalways tkchk)) [add2alias mapstartalways [sleep 1000 [tkchk]]] []


alias "tkchk" [        
if (! (strcmp (at $conline 0) " 3you")) [] [
addOnLoadAlways [fog 1024]

alias srymsgpre ["Sorry " "I'm sorry " "Oops sorry, " "Sorry about that " "My mistake, "]
alias iaoytmsgpre ["WTF are you doing, " "Come on, " "What was that, " "Stop that " "OMG, "]

alias srymsgpost [", I really did not want to do that." ", that was an accident." ", it was unintentional." ", it won't happen again." ", my bad."]
alias iaoytmsgpost [", I am on your team!" ", that was my favourite camping place!" ", you behave like a rookie" ", don't do that again!" ", stop teamkilling!"]

if (strstr $conline "you fragged teammate ") [alias plrname (at $conline 3);sleep 500 [voicecom sorry (concatword (at $srymsgpre (rnd 5)) $plrname (at $srymsgpost (rnd 5)))];]
if (strstr $conline "you gibbed teammate ") [alias plrname (at $conline 3);sleep 500 [voicecom sorry (concatword (at $srymsgpre (rnd 5)) $plrname (at $srymsgpost (rnd 5)))];]
if (strstr $conline "you splattered teammate ") [alias plrname (at $conline 3);sleep 500 [voicecom sorry (concatword (at $srymsgpre (rnd 5)) $plrname (at $srymsgpost (rnd 5)))];]
if (strstr $conline "you slashed teammate ") [alias plrname (at $conline 3);sleep 500 [voicecom sorry (concatword (at $srymsgpre (rnd 5)) $plrname (at $srymsgpost (rnd 5)))];]
if (strstr $conline "you headshot teammate ") [alias plrname (at $conline 3);sleep 500 [voicecom sorry (concatword (at $srymsgpre (rnd 5)) $plrname (at $srymsgpost (rnd 5)))];]
                                                 ]
if (strstr $conline "you were fragged by teammate ") [alias plrname (at $conline 5);sleep 500 [voicecom imonyourteamman (concatword (at $iaoytmsgpre (rnd 5)) $plrname (at $iaoytmsgpost (rnd 5)))];]
if (strstr $conline "you were gibbed by teammate ") [alias plrname (at $conline 5);sleep 500 [voicecom imonyourteamman (concatword (at $iaoytmsgpre (rnd 5)) $plrname (at $iaoytmsgpost (rnd 5)))];]
if (strstr $conline "you were slashed by teammate ") [alias plrname (at $conline 5);sleep 500 [voicecom imonyourteamman (concatword (at $iaoytmsgpre (rnd 5)) $plrname (at $iaoytmsgpost (rnd 5)))];]
if (strstr $conline "you were splattered by teammate ") [alias plrname (at $conline 5);sleep 500 [voicecom imonyourteamman (concatword (at $iaoytmsgpre (rnd 5)) $plrname (at $iaoytmsgpost (rnd 5)))];]
if (strstr $conline "you were headshot by teammate ") [alias plrname (at $conline 5);sleep 500 [voicecom imonyourteamman (concatword (at $iaoytmsgpre (rnd 5)) $plrname (at $iaoytmsgpost (rnd 5)))];]

sleep 1 [tkchk]
    
]
Thanks given by:
OK I have another problem. Is there a way to remove a character (comma) from a string? I tried using strreplace but without any luck in this case


if (strstr $conline "called a vote: kick player")[alias plrname (at $conline 6); say (concatword (at $variable0)) $plrname (concatword (at $variable1 (rnd 5))) (concatword (at $variable2))]

When a vote to kick someone pops up, their name is followed by a comma. I need to remove it to use it in the variable $plrname. How to achieve that?

Thanks.
Thanks given by:
@dumbass, you can't do that in the current version. You could compare all the names in the server with $prlname using strstr, but it wouldn't work so good (ex: "unarmed," and someone named with one letter like "a").
Thanks given by:
Oh, that sucks.

Another issue: I want to remove some conditions if there is a gema map. But not every gema map has the name "gema" in lower cases. Is there a way to lower the (curmap 1) string? I know that there is a function "convertcase" but I do not know how to use it here.

if (strstr (curmap 1) "gema")[say "true";][say "false";]
Thanks given by:
iirc convertcase is one of the new SVN idents. You will probably have to add another condition like this:

[cubescript]
if (|| (strstr (curmap 1) "gema") (strstr (curmap 1) "GEMA"))[say "true";][say "false";]
[/cubescript]


But here is how you would use convertcase:
[cubescript]
(strstr (convertcase 0 (curmap 1)) "gema")
//Add back into the script
if (strstr (convertcase 0 (curmap 1)) "gema")[say "true";][say "false";]
[/cubescript]


Sorry if there is a bug or two in the code, I didn't decide to bugtest it :3
Thanks given by:
or you can make a list of every possible gema combinations
[cubescript]gema_list = [ gema GEMA G3m@ ...]
loop i (listlen $gema_list) [if (strstr (curmap 1) (at $gema_list $i)) [say "this map is a gema"] []][/cubescript]
Thanks given by:
Thanks.

Ronald_Reagan: I tried the same thing before but it says in the console that command convertcase is unknown... Any idea how to fix that?
Thanks given by:
convertcase isn't in the current version of AC.
Thanks given by:
Ronald_Reagan: Is there another function that I can use for this purpose then? Will it be included in the next version?

I also encountered a problem when the player's name cannot be saved as alias when it contains "special" characters, for example parenthesis etc. Is there a way to fix it?

----

BTW, do you use this zoomwheel script by kirin? http://forum.cubers.net/thread-4970-post...l#pid90551 -- When I press MOUSE2 the zoom is set to max but I want the lowest zoom. How to achieve that?
Thanks given by:
I script request, Can someone make it so every round in a survivor or team survivor mode, my accuracy will reset itself. This would help because i like seeing how many bullets i still need to kill the person.
Thanks given by:
dumbass, it is in the next version of AC. As far as I know, there is nothing you could use to easily work around it.
Thanks given by:
(15 Jul 12, 04:28AM)Ronald_Reagan Wrote: dumbass, it is in the next version of AC. As far as I know, there is nothing you could use to easily work around it.

cmon, no need to insult him
Thanks given by:
haha funny
Thanks given by:
EDITFINAL: Everything was resolved. Uploading the script later. Consider this as a sneakpeak. ;)
(and the one below)
Thanks given by:
Try this
bind KP8 [ showmenu Aliases ]

newmenu Aliases

menuitem " [Link]" [name "[Link]" ; echo "Alias [Link] selected."]
menuitem " <[Link]Legacy>" [name "<[Link]Legacy>" ; echo "Alias <[Link]Legacy> selected."]
menuitem " [Link]|.13"" [name "[Link]|.13"" ; echo "Alias [Link]|.13" selected."]
menuitem " .13"|LightZ" [name ".13"|LightZ" ; echo "Alias .13"|LightZ selected."]

menuitem "Alias Menu by [Link]" -1
Thanks given by:
(15 Jul 12, 04:47AM)Foo Wrote:
(15 Jul 12, 04:28AM)Ronald_Reagan Wrote: dumbass, it is in the next version of AC. As far as I know, there is nothing you could use to easily work around it.

cmon, no need to insult him

dumbass, is the players name....
Thanks given by: