Numpad1 & Numpad.::
if(Please==0)
{
SetTimer, Time, On, 5000
Please=0;
}
else
{
SetTimer, Time, Off, 0
Please=1;
}
return
Time:
if(Dialog== 0)
{
SendInput t/me Test 1. {enter}
Dialog=1;
}
if else(Dialog== 1)
{
SendInput t/me Test 2. {enter}
Dialog=2;
}
if else(Dialog== 3)
{
SendInput t/me Test 3. {enter}
Dialog=4;
}
else
{
SendInput t/me Test 1. {enter}
Dialog=0;
}
return
What am I doing wrong on this script?
Re: What am I doing wrong on this script?
First of all, the ;s don't belong there. That is not AHK syntax. Remove them.
Also, I assume you want a toggle - the problem is that if the variable 'please' is already 0 (or empty), it will always be set to 0 - if it is not zero, it will stay not zero (or 1 in this case). That is obviously not a toggle.
Also, I assume you want a toggle - the problem is that if the variable 'please' is already 0 (or empty), it will always be set to 0 - if it is not zero, it will stay not zero (or 1 in this case). That is obviously not a toggle.
Re: What am I doing wrong on this script?
Instead of Numpad. , you probably meant NumpadDot
See https://autohotkey.com/docs/KeyList.htm#Numpad_keys
See https://autohotkey.com/docs/KeyList.htm#Numpad_keys
Re: What am I doing wrong on this script?
The SetTimer syntax is also different than you assume, is my guess: You probably want SetTimer, Time, 5000 (calls the label Time every 5 seconds) and SetTimer, Time, Off. See https://autohotkey.com/docs/commands/SetTimer.htm
I recommend the tutorial (https://autohotkey.com/docs/Tutorial.htm) and a closer look at the docs in general.
I recommend the tutorial (https://autohotkey.com/docs/Tutorial.htm) and a closer look at the docs in general.
Re: What am I doing wrong on this script?
Do you have discord or teamspeak good sir, You might want to help me. I'm really new but I'm capable of learning quickly.
Re: What am I doing wrong on this script?
Code: Select all
Numpad1 & NumpadDot::
if(Please==0)
{
SetTimer, Time, 5000
Please=0
}
else
{
SetTimer, Time, Off
Please=1
}
return
Time:
if(Dialog== 0)
{
SendInput t/me Test 1. {enter}
Dialog=1
}
if else(Dialog== 1)
{
SendInput t/me Test 2. {enter}
Dialog=2
}
if else(Dialog== 3)
{
SendInput t/me Test 3. {enter}
Dialog=4
}
else
{
SendInput t/me Test 1. {enter}
Dialog=0
}
return
Re: What am I doing wrong on this script?
You have to Switch the Please Values then it will work
Now you can toggle it...
or try this...
i written this a few years ago for SAMP... it should help you, i tested it not, should it fail anything will i fix it if u want it...
With the SC_FormatString() Function u can split Long strings in small Max. 122 Signs Parts to providing Crashes cause "too Long string Output"...
Code: Select all
Numpad1 & NumpadDot::
if(Please==0) ; Please is equal 0, See Down!!
{
SetTimer, Time, 5000
Please=1 ; You have to set Please then on 1, cause you turn it "On"
}
else ; Please is equal 1
{
SetTimer, Time, Off
Please=0 ; You have to set Please then on 0, cause you turn it "OFF"
}
return
or try this...
i written this a few years ago for SAMP... it should help you, i tested it not, should it fail anything will i fix it if u want it...
With the SC_FormatString() Function u can split Long strings in small Max. 122 Signs Parts to providing Crashes cause "too Long string Output"...
Code: Select all
Numpad1 & NumpadDot::
if Please := !Please
SetTimer, Time, 5000
else
SetTimer, Time, Off
return
Time:
SC_FormatString("me",FS_STRING)
return
SC_FormatString(_ChatType,FS_STRING)
{
static MaxChatSize := 122
if(Strlen(FS_STRING) > MaxChatSize)
{
While(Strlen(FS_STRING)>0)
{
FS_COUNT := 0
FS_COUNTBACK := 0
Loop
{
FS_COUNT ? FS_COUNTBACK := "-" FS_COUNT : ""
if(SubStr(FS_STRING,FS_COUNTBACK,1) == " " || SubStr(FS_STRING,FS_COUNTBACK,1) == "," || SubStr(FS_STRING,FS_COUNTBACK,1) == "."){
break 1
}
FS_COUNT++
}
SendChat(_ChatType,SubStr(FS_STRING, 1 , MaxChatSize-(FS_COUNT)) "...")
StringTrimLeft, FS_STRING, FS_STRING, MaxChatSize-(FS_COUNT)
sleep 1100
}
}else{
SendChat(_ChatType,FS_STRING)
}
return
}
SendChat(_Type:="",_Text:="")
{
if(!_Text){
Sendinput % " {Enter}"
return
}
Sendinput % "t" strlen(_Type) ? "/" _Type " " _Text "{Enter}" : _Text "{Enter}"
return
}
Re: What am I doing wrong on this script?
Code: Select all
Numpad1 & NumpadDot::
if Please := !Please
SetTimer, Time, 5000
else
SetTimer, Time, Off
return
Time:
SC_FormatString("me",FS_STRING)
return
SC_FormatString(_ChatType,FS_STRING)
{
static MaxChatSize := 122
if(Strlen(FS_STRING) > MaxChatSize)
{
While(Strlen(FS_STRING)>0)
{
FS_COUNT := 0
FS_COUNTBACK := 0
Loop
{
FS_COUNT ? FS_COUNTBACK := "-" FS_COUNT : ""
if(SubStr(FS_STRING,FS_COUNTBACK,1) == " " || SubStr(FS_STRING,FS_COUNTBACK,1) == "," || SubStr(FS_STRING,FS_COUNTBACK,1) == "."){
break 1
}
FS_COUNT++
}
SendChat(_ChatType,SubStr(FS_STRING, 1 , MaxChatSize-(FS_COUNT)) "...")
StringTrimLeft, FS_STRING, FS_STRING, MaxChatSize-(FS_COUNT)
sleep 1100
}
}else{
SendChat(_ChatType,FS_STRING)
}
return
}
SendChat(_Type:="",_Text:="")
{
if(!_Text){
Sendinput % " {Enter}"
return
}
Sendinput % "t" strlen(_Type) ? "/" _Type " " _Text "{Enter}" : _Text "{Enter}"
return
}
Re: What am I doing wrong on this script?
I got it working, someone please tell me how to get this side working with 4 different choices.
Code: Select all
Time:
if(Dialog== 0)
{
SendInput t/me Test 1. {enter}
Dialog=1;
}
if else(Dialog== 1)
{
SendInput t/me Test 2. {enter}
Dialog=2;
}
if else(Dialog== 3)
{
SendInput t/me Test 3. {enter}
Dialog=4;
}
else
{
SendInput t/me Test 1. {enter}
Dialog=0;
}
Re: What am I doing wrong on this script?
The mistake you did was that you wrote 'if else' instead of else if. I also suggest you use SendMode Input if you are going to use sendinput throughout anyway.Guest wrote:I got it working, someone please tell me how to get this side working with 4 different choices.
Code: Select all
Time: if(Dialog== 0) { SendInput t/me Test 1. {enter} Dialog=1; } if else(Dialog== 1) { SendInput t/me Test 2. {enter} Dialog=2; } if else(Dialog== 3) { SendInput t/me Test 3. {enter} Dialog=4; } else { SendInput t/me Test 1. {enter} Dialog=0; }
Also complimentary question to y'all. What is the difference between Dialog == 0 andDialog = 0? They're the same? Also you don't need to end lines with a colon.
The script below will ty
Code: Select all
SendMode Input
Time:
if (Dialog = 0) {
Send, t/me Test 1. {enter}
Dialog := 1
}
else if (Dialog = 1) {
Send, t/me Test 2. {enter}
Dialog=2
}
else if (Dialog = 3) {
Send, t/me Test 3. {enter}
Dialog=4
}
else
{
Send, t/me Test 4. {enter}
Dialog=0
}
return
I am your average ahk newbie. Just.. a tat more cute.
Who is online
Users browsing this forum: No registered users and 88 guests