-
gauravkhurana
- Posts: 2
- Joined: 19 May 2022, 08:28
Getting this error — Function calls require a space or «(
I created a script called a.ahk and it has just one line. This started happening since i moved to a new PC.
Script is working fine on my other computer but with the version i recently installed.. its failing.
F12::Send,#+s
While running the script i am getting below error
—————————
a.ahk
—————————
Error: Function calls require a space or «(«. Use comma only between parameters.
Specifically: Send,#+s
Line#
—> 001: {
The program will exit.
—————————
OK
—————————
-
mikeyww
- Posts: 19568
- Joined: 09 Sep 2014, 18:38
Re: Getting this error — Function calls require a space or «( Topic is solved
19 May 2022, 08:55
Welcome to this AutoHotkey forum!
As I understand it, AHK version 2 has transformed commands into functions.
Use AHK version 1.x. The latest is 1.1.34.02.
Or:
-
gauravkhurana
- Posts: 2
- Joined: 19 May 2022, 08:28
Re: Getting this error — Function calls require a space or «(
19 May 2022, 09:17
Thanks a lot this has helped me.
Strangely i have 1.1.34 version and
Still i need to replace , with «
Is there a place where i can see all the changes at one place as i think i would need to change my all scripts.
Return to “Ask for Help”
First of all, a *huge* thanks to Rick for developing this most excellent software! It is fantastic, exceedingly flexible, and provides a truly amazing set of tools to spark creativity. Also thanks to the developers and publishers of the vast array of plugins that takes the base software and makes it even more amazing!
That being said, I too was seeking a way to bypass the superfluous (at least to me ‘Save Configuration’ dialog box that surfaces every single time I wish to save a copy of a file in a different format (i.e., use ‘Save As’). Rick has stated very clearly that this is not a bug, it is a feature and one that he does not intend to ‘correct’ despite requests here:https://forums.getpaint.net/topic/31775-can-save-configuration-popup-be-by-passed/ and here:https://forums.getpaint.net/topic/115251-disable-window-save-configuration/. That’s fair, paint.NET is his baby and if that’s what he prefers then so be it. It was worth it to me, however, to seek an alternative to ‘just hit enter twice’, since I purely hate RSI.
I dusted off AutoHotKey (https://www.autohotkey.com/), a generic Windows-based hotkey scripting program that I used to use to fix the most irritating user interface errors in Lotus Notes, nearly 20 years ago. I was pleased to see that the AHK community and codebase has been flourishing, and the most recent version is fully compatible with Windows 10. After a bit of investigation, I put together the following AHK script that a) waits for the paint.NET ‘Save Configuration’ window to become active, then b) sends an immediate ‘Enter’ keypress to dismiss it and save the file using the default settings.
;*********************************
;AutoHotKey Script
;captain_carrot
;Jan 1, 2021
;*********************************
;* Monitors for the superfluous 'Save Configuration' dialog box in paint.NET. When found, sends an immediate 'return' keypress to bypass and save immediately with default settings
;* To disable this behaviour, simply stop this script
;*********************************
; Sets the window title matching mode
SetTitleMatchMode, 3
; This is the tooltip that pops up if people hover over the script in the system tray
Menu, Tray, Tip, In the world-class paint.NET program this script automatically`nclears the extra 'Save Configuration' dialog box when saving.
; The following procedure will only run if paint.NET is the active window, and will keep resetting to the 'Start' label as long as the script is running
#IfWinActive, ahk_class WindowsForms10.Window.8.app.0.b7ab7b_r6_ad1
Start:
WinWaitActive, Save Configuration,
Send, {ENTER}
Goto, Start
;********************************
To use this script, you will need to
a) install AutoHotKey on whatever system is running Paint.NET. Here is the download link: https://www.autohotkey.com/download/ahk-install.exe
b) copy the above script into a text editor, saving it as <whatever filename you want>.ahk
c) double-click on the newly-created ahk file (note: if it opens in Notepad, change the file extension from .txt to .ahk)
That should be it. Now every time the Save Configuration dialog box surfaces, it should be dismissed with an ‘Enter’ keypress automagically.
Hope that is satisfactory to everyone: we are not mucking with the code to ‘fix’ this relatively minor user interface anachronism, yet people who find this extra dialog box sufficiently annoying will now have a way to bypass it automatically.
Best regards, and goodbye to 2020!
cap
p.s. AHK is useful for tweaking all sorts of weird Windows quirks, so if this is your first time reading about it, hope you find it a useful tool in other areas of your digital life! I am by no means an expert, but the beauty of AHK is that you don’t need to be an expert to get the results you are looking for…much like paint.NET, now that I think of it: in both cases the software is just that good 😄
I was using JSLint and I got an error for putting a space after the function name. Why is that bad?
function coolness () {
var hi = "this";
}
ERROR: Problem at line 1 character 19: Unexpected space between ‘coolness’ and ‘(‘.
asked Mar 19, 2012 at 6:33
supercoolvillesupercoolville
8,37620 gold badges50 silver badges69 bronze badges
3
According to Crockford,
For named functions, DO NOT insert space between function name and parentheses:
function doStuff() {
//stuff here
}
For anonymous functions, DO insert space between function
keyword and parentheses:
function () {
//stuff here
}
meshy
8,2349 gold badges51 silver badges71 bronze badges
answered Jun 18, 2012 at 2:02
7
JSLint is not a JavaScript syntax checker as much as it is a JavaScript style checker. The style guidelines it uses are those written by Douglas Crockford.
Some people do not agree with his style decisions, some people do. They are not law and you are not required to follow them. Alternative JS linters such as JSHint exist.
The particular rule you are running into is here:
There should be no space between the name of a function and the (left parenthesis) of its parameter list.
JavaScript is not whitespace-sensitive. You can add this space if it makes you feel better. (It is not standard, however.)
answered Mar 19, 2012 at 6:37
InterrobangInterrobang
16.9k3 gold badges54 silver badges62 bronze badges
0
Please check the javascript code convetions bellow and you will find your answer.
http://crockford.com/javascript/code.html#function
There should be no space between the name of a function and the ( (left parenthesis) of its parameter list. There should be one space between the ) (right parenthesis) and the { (left curly brace) that begins the statement body. The body itself is indented four spaces. The } (right curly brace) is aligned with the line containing the beginning of the declaration of the function.
Example for a function:
function outer(c, d) {
var e = c * d;
function inner(a, b) {
return (e * a) + b;
}
return inner(0, 1);
}
Example for anonymous function:
div.onclick = function (e) {
return false;
};
meshy
8,2349 gold badges51 silver badges71 bronze badges
answered Mar 19, 2012 at 6:34
0
Technically speaking, your code is perfectly valid, although some code style standards dictate that there should not be such space (for example, the one that @Bodgan cited).
In fact, when you compress your code (using one of many tools like YUI Compressor or Google Closure Compiler) these spaces are entirely removed — including the ones before/after curly brackets as cited by @Bodgan. And it’s valid JS of course.
answered Mar 19, 2012 at 6:39
Ofer ZeligOfer Zelig
16.9k9 gold badges58 silver badges93 bronze badges
I think if your project want to have only one style (function name () {...}
VS function name() {...}
), the former is worse because:
- Many conventional coding style guidelines have no space between function name and left parenthesis in a function declaration. (That mean, doing the opposite is introducing divisions)
E.g.
C++:
void main() {
}
PHP:
function run() {
}
-
I think function call and function declaration is not worthy enough to need two different styles (#1). It’s not following the KISS principle.
For example: In few occasions, I copy a function declaration template because the function have many parameters (there may be no good auto-completion hint), and paste it into a code position to turn it into a function call. If two styles there, I will need additional care (assume no linter) to remove the extra space in-between
functionName (longParameterList...)
.
Remarks:
#1 — some opinions argue for easier searching in files for function declarations, which I don’t think a persuasive-enough reason to add the extra style to remember in coding.
answered Jun 6, 2019 at 10:25
Johnny WongJohnny Wong
9239 silver badges16 bronze badges
1
|
Authenticator Code |
|
Thread Tools |
|
#21 |
|||||||||||
Surry n00bie Join Date: Sep 2020
Reputation: 47 Points: 88, Level: 1 Level up: 22%, 312 Points needed Activity: 8.5% |
Broken script. Error at line 50. Line Text: Switch k{ The program will exit. |
|||||||||||
Surry is offline |
|
|
#22 |
|||||||||||
Surry n00bie Join Date: Sep 2020
Reputation: 47 Points: 88, Level: 1 Level up: 22%, 312 Points needed Activity: 8.5% |
Quote:
Originally Posted by Surry Broken script. Error at line 50. Line Text: Switch k{ The program will exit. So I guess this is technically a double post but I didn’t see any mention about «double posting» in the rules and it’s almost 24h now, so here goes. If you encounter this problem like I did you have to update AHK. The «switch» command is relatively new and you need an up-to-date version for it to work. By the way, this script is already seeing noticeable use. When I watch my bot he is in good company. Always one or two other guys behaving exactly the same way. Bound to be noticed eventually. However, I wonder if they can even do anything about it. Say, you simply queue up and afk over and over again. Pretty much the same but how could they ever punish that? In the same vein they can’t punish people for never progressing past the first round. BUT I think the behavior patterns of this script make it even more obvious that it’s not a human player than if the script would simply stand around doing nothing. After all, AFKs happen. But three people behaving exactly the same way? Unlikely. |
|||||||||||
Surry is offline |
|
|
#23 |
|||||||||||
kamoglio n00bie Join Date: May 2020 Location: Kitchen
Reputation: 21 Points: 403, Level: 1 Level up: 1%, 497 Points needed Activity: 1.9% |
It work but if you can add the function to go back to main menu and re join after first round lost it will be more fast for farming instead of waiting spectator mode till the end of whole game. |
|||||||||||
kamoglio is offline |
|
|
#24 |
|||||||||||
TROGO n00bie Join Date: Sep 2020
Reputation: 10 Points: 14, Level: 1 Level up: 4%, 386 Points needed Activity: 2.2% |
Works great! Would be nice if it doesn’t spectate the second, then quits. Thank You! |
|||||||||||
TROGO is offline |
|
|
#25 |
|||||||||||
Biblioyster n00bie Join Date: Sep 2020
Reputation: 10 Points: 1, Level: 1 Level up: 0%, 1 Points needed Activity: 0% |
Works perfectly. Thank you. I tried taking out the movement part, but that breaks the bot. Not sure, why, though. However, nothing that a bit of rebinding the keys doesn’t fix. |
|||||||||||
Biblioyster is offline |
|
|
#26 |
|||||||||||
definitelyq n00bie Join Date: May 2019
Reputation: 73 Points: 1,524, Level: 3 Level up: 18%, 576 Points needed Activity: 5.7% Last Achievements |
can you make it so it quits the round after you’re eliminated? waiting for a whole game to finish seems like an eternity even while afking |
|||||||||||
definitelyq is offline |
|
|
#27 |
|||||||||||
codsec The Legendary Cheater Join Date: Apr 2016 Location: in your heart
Reputation: 5179 Points: 14,744, Level: 15 Level up: 82%, 256 Points needed Activity: 8.9% Last Achievements |
cool, thanks for share xd __________________
♡ I just love her, and myself ♡ |
|||||||||||
codsec is offline |
|
|
#28 |
|||||||||||
Surry n00bie Join Date: Sep 2020
Reputation: 47 Points: 88, Level: 1 Level up: 22%, 312 Points needed Activity: 8.5% |
Quote:
Originally Posted by Biblioyster Works perfectly. Thank you. I tried taking out the movement part, but that breaks the bot. Not sure, why, though. However, nothing that a bit of rebinding the keys doesn’t fix. The code’s a bit spaghetti. Basically, it relies on the consistent Space-spam that makes you jump in-game to continue with menus. I changed the script so it won’t spam movement commands anymore. It exists the round after you get eliminated and joins the next. But, again, if you are using a different resolution the pixel locations on screen will be different and the script won’t work. You have to adjust these in that case. Code: F1::main() F3::exitapp main(){ loop{ if(menuDetection()=true){ Send {Esc} sleep 100 Send {Space} }else{ mainDetection() } } } menuDetection(){ PixelGetColor, color1, 1827, 984 PixelGetColor, color2, 40, 1040 if(color1=0x313131 or color2=0x313131) { return true }else{ return false } } mainDetection(){ PixelGetColor, color3, 1275, 975 PixelGetColor, color4, 1835, 1045 if(color3=0x313131 or color4=0x313131) { Send {Space} }else{ sleep 100 } } ;Based on script by DenctoPR So what the script relies on is that the in-game buttons to leave the round and continue with menus is a distinct gray and always shows up in a specific location. It first checks if the respective pixel on the elimination or progression screen is indeed gray. If true, it sends Esc and then Space to leave. If the pixel for these prompts is not gray it instead checks if the pixel signalling the main menu button to join a new round is gray. When this is true it sends space to join the next round. If neither are true (meaning the game is currently in progress), it just loops the process of checking for pixel matches. |
|||||||||||
Surry is offline |
|
|
#29 |
|||||||||||
definitelyq n00bie Join Date: May 2019
Reputation: 73 Points: 1,524, Level: 3 Level up: 18%, 576 Points needed Activity: 5.7% Last Achievements |
Quote:
Originally Posted by Surry The code’s a bit spaghetti. Basically, it relies on the consistent Space-spam that makes you jump in-game to continue with menus. I changed the script so it won’t spam movement commands anymore. It exists the round after you get eliminated and joins the next. But, again, if you are using a different resolution the pixel locations on screen will be different and the script won’t work. You have to adjust these in that case. Code: F1::main() F3::exitapp main(){ loop{ if(menuDetection()=true){ Send {Esc} sleep 100 Send {Space} }else{ mainDetection() } } } menuDetection(){ PixelGetColor, color1, 1827, 984 PixelGetColor, color2, 40, 1040 if(color1=0x313131 or color2=0x313131) { return true }else{ return false } } mainDetection(){ PixelGetColor, color3, 1275, 975 PixelGetColor, color4, 1835, 1045 if(color3=0x313131 or color4=0x313131) { Send {Space} }else{ sleep 100 } } ;Based on script by DenctoPR So what the script relies on is that the in-game buttons to leave the round and continue with menus is a distinct gray and always shows up in a specific location. It first checks if the respective pixel on the elimination or progression screen is indeed gray. If true, it sends Esc and then Space to leave. If the pixel for these prompts is not gray it instead checks if the pixel signalling the main menu button to join a new round is gray. When this is true it sends space to join the next round. If neither are true (meaning the game is currently in progress), it just loops the process of checking for pixel matches. is your variation of the script based on 1920×1080? |
|||||||||||
definitelyq is offline |
|
|
#30 |
|||||||||||
DenctoPR Member
Join Date: Mar 2019 Location: localhost
Reputation: 529 Points: 3,220, Level: 5 Level up: 53%, 380 Points needed Activity: 3.9% Last Achievements |
Quote:
Originally Posted by Surry The code’s a bit spaghetti… Optimized and elegant, thanks for the share! |
|||||||||||
DenctoPR is offline |
|
|
#31 |
|||||||||||
Surry n00bie Join Date: Sep 2020
Reputation: 47 Points: 88, Level: 1 Level up: 22%, 312 Points needed Activity: 8.5% |
Quote:
Originally Posted by definitelyq is your variation of the script based on 1920×1080? Yes, it is. The pixel coordinates that the script checks for colors are based on that resolution. If you are using a different resolution you have to use the AHK Windows Spy to get your respective pixel locations. Quote:
Originally Posted by DenctoPR Optimized and elegant, thanks for the share! It’s thanks to you, I wouldn’t have known where exactly to start with the script myself. I don’t even exactly know which pixel coordinates checks which menu button And it occurred to me that different languages might mess with the button location too.
|
|||||||||||
Surry is offline |
|
|
#32 |
|||||||||||
definitelyq n00bie Join Date: May 2019
Reputation: 73 Points: 1,524, Level: 3 Level up: 18%, 576 Points needed Activity: 5.7% Last Achievements |
Quote:
Originally Posted by Surry Yes, it is. The pixel coordinates that the script checks for colors are based on that resolution. If you are using a different resolution you have to use the AHK Windows Spy to get your respective pixel locations.It’s thanks to you, I wouldn’t have known where exactly to start with the script myself. I play on 2k and the original script works, yet yours doesn’t.. even tho it’s using the same pixelgets.. i don’t get it |
|||||||||||
definitelyq is offline |
|
|
#33 |
|||||||||||
Surry n00bie Join Date: Sep 2020
Reputation: 47 Points: 88, Level: 1 Level up: 22%, 312 Points needed Activity: 8.5% |
Quote:
Originally Posted by definitelyq I play on 2k and the original script works, yet yours doesn’t.. even tho it’s using the same pixelgets.. i don’t get it Different language setting then maybe? I don’t know for certain but the length of words could lead to the buttons ending up somewhere else. |
|||||||||||
Surry is offline |
|
|
#34 |
|||||||||||
definitelyq n00bie Join Date: May 2019
Reputation: 73 Points: 1,524, Level: 3 Level up: 18%, 576 Points needed Activity: 5.7% Last Achievements |
Quote:
Originally Posted by Surry Different language setting then maybe? I don’t know for certain but the length of words could lead to the buttons ending up somewhere else. my game is in english, i assume yours is too |
|||||||||||
definitelyq is offline |
|
|
#35 |
|||||||||||
Surry n00bie Join Date: Sep 2020
Reputation: 47 Points: 88, Level: 1 Level up: 22%, 312 Points needed Activity: 8.5% |
Quote:
Originally Posted by definitelyq my game is in english, i assume yours is too Changing languages for this game is a pain in the ass so mine is not. But maybe it’s not the language either that messes with your script. Don’t know in that case. Must be something with the pixel positions, I think. Otherwise the script is too straight-forward to break for some extravagant reason, I would assume.
|
|||||||||||
Surry is offline |
|
|
#36 |
|||||||||||
p1gsy n00bie Join Date: Aug 2020
Reputation: 10 Points: 898, Level: 1 Level up: 99%, 2 Points needed Activity: 4.8% |
this bot can’t running in the background, use a virtual machine to run is recommended. coordinate conversion: Quote:
{original X}/1920*{new resolution width} example(to 720p): Quote:
color2.x: 40/1920*1280 = 26.66666667 = 27 you can also convert it to 2K,4K or others. |
|||||||||||
p1gsy is offline |
|
|
#37 |
|||||||||||
Bugrinnk n00bie Join Date: Aug 2020
Reputation: 10 Points: 1, Level: 1 Level up: 0%, 1 Points needed Activity: 0% |
Can someone give a download link working on 1280×720 please? I have no idea how to do it by myself. |
|||||||||||
Bugrinnk is offline |
|
|
#38 |
|||||||||||
MisterEvil n00bie Join Date: Aug 2020
Reputation: 10 Points: 266, Level: 1 Level up: 67%, 134 Points needed Activity: 2.0% |
This is working great for me! I’ll hit the Season 2 level cap in no time! Sometimes a message pops up that says matchmaking restricted. If it comes up overnight, do you think it’ll stop the script from working? Thank you! |
|||||||||||
MisterEvil is offline |
|
|
#39 |
|||||||||||
mendia n00bie Join Date: Oct 2020
Reputation: 10 Points: 1, Level: 1 Level up: 0%, 1 Points needed Activity: 0% |
Quote:
—————————
FallGuysBot.ahk ————————— Error at line 18. Line Text: PixelGetColor, color1, 1827, 984 The program will exit. Does anyone know how to fix this issue? |
|||||||||||
mendia is offline |
|
|
#40 |
|||||||||||
MisterEvil n00bie Join Date: Aug 2020
Reputation: 10 Points: 266, Level: 1 Level up: 67%, 134 Points needed Activity: 2.0% |
Quote:
Originally Posted by MisterEvil This is working great for me! I’ll hit the Season 2 level cap in no time! Sometimes a message pops up that says matchmaking restricted. If it comes up overnight, do you think it’ll stop the script from working? Thank you! Works fine! I’m already level 21! |
|||||||||||
MisterEvil is offline |
|
|
Similar Threads |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Release] A.V.A: Dog Tag EXP and Euro Booster — 300% Bonus EXP and Euro! | ccman32 | Alliance of Valiant Arms | 15 | 10th May 2019 09:50 AM |
[Discuss] Need help hiding Autoit — I think the game detects the Autoit Library | blotty | General Programming and Reversing | 0 | 19th June 2017 08:16 PM |
[Discuss] Exp Bot Arctic Combat By ZicoS77 | zicos77 | Other FPS Games | 1 | 23rd March 2013 01:17 AM |
Tags |
bot, script, game, code, screen, randomized, modify, inputs, reports, detection |
«
Previous Thread
|
Next Thread
»
Forum Jump |
All times are GMT. The time now is 06:15 PM.
Contact Us —
Toggle Dark Theme
Terms of Use Information Privacy Policy Information
Copyright ©2000-2023, Unknowncheats� UKCS #312436
no new posts