[solved] Underscore becomes dash in console Topic is solved

Ask gaming related questions (AHK v1.1 and older)
Evil-e
Posts: 262
Joined: 04 Sep 2018, 11:09

[solved] Underscore becomes dash in console

21 Oct 2018, 11:06

Hey,pepes :)

OK.... been working quite a while on this and thought I should ask for some help. I have no problem writing a script to open console and send commands and close console when done, but whenever and underscore "_" is written in script, it becomes a dash "-" in the console:

sv_everything_1
becomes
sv-everything-1

Current solution: Write script without "_" and add 5 second pause. Ample time to hold LShift and key and type "_" before it continues
---------------------------------------------
$F1::
{
Send, ``
Sleep, 100
Send, s
Sleep, 100
Send, v
Sleep, 5000 ;pause here to hold LShift and type "_" prior to script continuing
Send, e
Sleep, 100
Send, v
Sleep, 100
Send, e
Sleep, 100
Send, r
Sleep, 100
Send, y
Sleep, 100
Send, t
Sleep, 100
Send, h
Sleep, 100
Send, i
Sleep, 100
Send, n
Sleep, 100
Send, g
Sleep, 2000 ;pause here to type "_" (shorter pause, because my fingers are already on the necessary keys)
Send, 1
Send, {enter}
sleep, 100
Send, ``
}
---------------------------------------------

The above is works perfectly..... but is awkward during gameplay. Research has suggested "?" or "/" in place of underscore, but no go :(

Thanks for any help, Eric

PS. The Game is Painkiller: Recurring Evil and this code command gives all kinds of really crazy weapons to kill the badies

PPS. I just remembered... I have another game in which this type of script DOES allow the "_" character.... so this issue is game specific,
but maybe somebody knows a trick :morebeard: <--- so jelly of beard
Last edited by Evil-e on 22 Oct 2018, 09:55, edited 1 time in total.
I have a bit of experience opening and sending commands to game console and CMD.exe... just ask :)
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Underscore becomes dash in console

21 Oct 2018, 11:26

if the game allows it, u can try pasting the command in:

Code: Select all

Send ``
ClipSaved := Clipboard
Clipboard := "sv_whatever"
Send ^v{Enter}``
Clipboard := ClipSaved 
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Underscore becomes dash in console

21 Oct 2018, 11:31

You could try Send {Text}.

Code: Select all

SendInput, {Text}abc_def ;note: {Text} requires AHK v1.1.27+
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Evil-e
Posts: 262
Joined: 04 Sep 2018, 11:09

Re: Underscore becomes dash in console

21 Oct 2018, 13:52

Thank you both for rapid response time :thumbup:

OK.... I am running AHK v1.1.30, so we good there.

This is what I tried without success :(

---------------------------------------------------------
$F1::
{
Send, ``
sleep, 100
SendInput, {Text}sv_everything_1 ;tried with & without a space after {text}
Send, {enter}
sleep, 100
Send, ``
}
return
----------------------------------------------------------

When the above is tried, the console is opened then closed and get a "game saved" message. BUT, regardless of what key I program to send this code, I get that same "game saved" message.

when I copied sv_everything_1 to clipboard and ran this script...
----------------------------------------------------------
$F1::
{
Send ``
ClipSaved := Clipboard
Clipboard := "sv_everything_1"
Send ^v{Enter}``
Clipboard := ClipSaved
Send, ``
}
return
----------------------------------------------------------

.... I got no results at all :( Probably the syntax is incorrect, as I have never tried this option

Eric :)

BTW..... I am able to "paste" this code when I use the tilde key to open console, key ENTER and it works perfectly fine. No doubt I am
writing swags code incorrectly :oops:
I have a bit of experience opening and sending commands to game console and CMD.exe... just ask :)
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Underscore becomes dash in console

21 Oct 2018, 14:21

maybe its a matter of timing, split the Send commands into individual ones and add Sleep in between, or adjust A_KeyDelay and restore it back to its original values when ure done sending:

Code: Select all

$F1::
{
	DelaySaved := A_KeyDelay
	SetKeyDelay 100
	
	ClipSaved := Clipboard
	Clipboard := "sv_everything_1"

	Send ``^v{Enter}``
	
	Clipboard := ClipSaved 
	SetKeyDelay % DelaySaved
}
return
Evil-e
Posts: 262
Joined: 04 Sep 2018, 11:09

Re: Underscore becomes dash in console  Topic is solved

21 Oct 2018, 15:06

Hmmmm.... i tried your idea here and nothing happened. So, I then opened console via tilde key and "paste" the text and it works just fine.
Regardless of the "context" in which I try to send text with an underscore, the result is a dash in its place

This is clearly an issue with how this game handles console commands. I even tried tinkering with adding this to the Target line of short-cut and did not work. What I can do is just copy this line to clipboard and open console, paste, close console and will work just fine...... but what's the fun in that :D


The question I need to ask: is there an alternate way to type an underscore character? Maybe some computer programmer out
there knows something?

[solved! FEMALE CANINES]

My new code....
--------------------------------------------------------------------------
$F1::
{
Send, `` ;All weapons & ammo: sv_everything_1
Sleep, 20
Send, sv
Sleep, 20
Send, {LShift down}
Sleep, 20
Send, _
Sleep, 20
Send, {LShift up}
Sleep, 20
Send, everything
Sleep, 20
Send, {LShift down}
Sleep, 20
Send, _
Sleep, 20
Send, {LShift up}
Sleep, 20
Send, 1
Send, {enter}
sleep, 20
Send, ``
}
return
----------------------------------------------------------------------------------

This works flawlessly :superhappy: and only took 24 hours :wtf:

Many thanks to all input, as it each of it gave clues to resolving the mystery of the ages that has plagued mankind for millennium :beer:
I have a bit of experience opening and sending commands to game console and CMD.exe... just ask :)

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 50 guests