- 3
- Posts
- 10
- Years
- Seen Jul 28, 2016
Introduction
I made an AutoHotkey script to edit trainers/wild pokemon in Spiky's DS Map Editor which supports the NDS Pokemon games. It is a fully automatic macro tool, it will go through the entire list, but it doesnt stop on itself, you have to stop it manually as soon as it has reached the end of the list. It also detects how many Pokemon a trainer has.
I wrote this for myself, but decided to share it in case anyone has use for it. I'd appreciate it if you optimize the code and post it here.
Installation
My tool is an automatic macro that does the same things a human would do, just faster. It is made specifically for Spiky's DS Map Editor, it only works with that, so that's the first thing you need.
Next you need my tool, you have several options here:
Requirements
My anti-virus (avast) warns me about the .exe. But we know anti-viruses give false positives sometimes, don't we? I assure you the .exe is the same thing that you see in the script code above. You will have to take my word for it I guess. But I'm just some random guy on the Internet, why would you trust me?
If you really want to make sure, then just download AutoHotkey and save the above code in a new text file. More details on that in the 'Usage' section.
Usage
Using the open source version
If you double click the .exe or the .ahk file, the tool will open and you will see the GUI, which looks like this:
GUI
Help
next
Credits
Code in case mirrors break
I made an AutoHotkey script to edit trainers/wild pokemon in Spiky's DS Map Editor which supports the NDS Pokemon games. It is a fully automatic macro tool, it will go through the entire list, but it doesnt stop on itself, you have to stop it manually as soon as it has reached the end of the list. It also detects how many Pokemon a trainer has.
I wrote this for myself, but decided to share it in case anyone has use for it. I'd appreciate it if you optimize the code and post it here.
Installation
My tool is an automatic macro that does the same things a human would do, just faster. It is made specifically for Spiky's DS Map Editor, it only works with that, so that's the first thing you need.
Next you need my tool, you have several options here:
- Option 1) download the compiled .exe
- Option 2) download AutoHotkey and
- the script as .ahk text file
or - copy + paste the script into a new text file and save it as .ahk
- the script as .ahk text file
Requirements
- 1) Pokemon ROM file (.nds)
- 2) Spiky's DS Map Editor
- 3) Script as compiled .exe with GUIOR
- 3) AutoHotkey Tool
- 4) Script as AutoHotkey file (.ahk) with GUI (this is just a text file)Optional
- 4) Script with GUI as open source, past it into a new text file and save as .ahk
My anti-virus (avast) warns me about the .exe. But we know anti-viruses give false positives sometimes, don't we? I assure you the .exe is the same thing that you see in the script code above. You will have to take my word for it I guess. But I'm just some random guy on the Internet, why would you trust me?
If you really want to make sure, then just download AutoHotkey and save the above code in a new text file. More details on that in the 'Usage' section.
Usage
Using the open source version
- Install AutoHotkey
- create a new text document and open it
- paste the code into text file and save it as .ahk or save it first and rename it from .txt to .ahk afterwards
If you double click the .exe or the .ahk file, the tool will open and you will see the GUI, which looks like this:
Spoiler:
GUI
![[PokeCommunity.com] make any NDS Pokemon game harder automatically! [for Spiky's DS Map Editor] [PokeCommunity.com] make any NDS Pokemon game harder automatically! [for Spiky's DS Map Editor]](https://i.imgur.com/I5ElWb6.png)
Help
![[PokeCommunity.com] make any NDS Pokemon game harder automatically! [for Spiky's DS Map Editor] [PokeCommunity.com] make any NDS Pokemon game harder automatically! [for Spiky's DS Map Editor]](https://i.imgur.com/mCNuQT6.png)
next
- open Spiky's DS Map Editor
- load .nds ROM
- click on 'Trainer Editor' or 'wild Pokemon Editor'
- select the first trainer/area you want to edit (very top), this is where the macro starts. Note that sometimes the first trainer is the very first rival encounter which you may not want to make harder.
- press Alt + 1 for trainers and Alt + 2 for wild Pokemon. This starts the macro.
- after the macro is finished, click on File -> save game, the editor will create a new .nds file
Credits
Rajat said:
Code in case mirrors break
Spoiler:
Code:
; #### Raise Pokemon level ####
; Trainer Pokemon & Wild Pokemon
; == Description ==
; you can set your own percentage values, edit variables 'p1'-'p6' or 'percent'
; Alt + 1 for raising trainer pokemon levels
; Alt + 2 for raising wild pokemon levels
; Shift + 0 tells the script to stop, in order to continue hit Ctrl + Shift + 0 and the corresponding shortcut again (Alt + 1 or Alt + 2)
; == Usage ==
; - Trainers -
; 1) open 'Trainer Editor', select first trainer where you want to start
; 2) hit Alt + 1 to start automatic routine of raising pokemon levels of ALL trainers
; 3) hit Shift + 0 (spam it, works better) as soon as the last trainer is being edited
; ATTENTION: the script will keep going until you manually stop it. If it reaches the last trainer in the list,
; it will continue to raise his pokemon levels infinitely (until all are 100)
; - Wild Pokemon -
; 1) open 'Wild Pokemon Editor'
; 2) hit Alt + 2 to start automatic routine of raising ALL wild pokemon levels
; 3) hit Shift + 0 (spam it, works better) as soon as the last area is being edited
; ATTENTION: the script will keep going until you manually stop it. If it reaches the last area in the list,
; it will continue to raise the pokemon levels infinitely (until all are 100)
; set default values
defValTrainer := 20
defValWild := 23
i := 1
Loop, 6
{
p%i% := defValTrainer
i := i + 1
}
pWild := defValWild
; ==== GUI ====
Gui, Add, GroupBox, x12 y110 w240 h200 , raise levels by `% depending on team size
Gui, Font, S12, Verdana
Gui, Add, Text, x202 y130 w20 h20 , `%
Gui, Add, Text, x202 y160 w20 h20 , `%
Gui, Add, Text, x202 y190 w20 h20 , `%
Gui, Add, Text, x202 y220 w20 h20 , `%
Gui, Add, Text, x202 y250 w20 h20 , `%
Gui, Add, Text, x202 y280 w20 h20 , `%
Gui, Add, Text, x202 y320 w20 h20 , `%
Gui, Font, S10, Verdana
Gui, Add, Text, x12 y10 w240 h90 , Set your custom percentage values. You can set different values for different team sizes. The entire opponent's team is raised by the percentage you enter.
Gui, Add, Text, x22 y130 w120 h20 , has 1 Pokemon
Gui, Add, Text, x22 y160 w120 h20 , has 2 Pokemon
Gui, Add, Text, x22 y190 w120 h20 , has 3 Pokemon
Gui, Add, Text, x22 y220 w120 h20 , has 4 Pokemon
Gui, Add, Text, x22 y250 w120 h20 , has 5 Pokemon
Gui, Add, Text, x22 y280 w120 h20 , has 6 Pokemon
Gui, Add, Text, x22 y320 w120 h20 , wild Pokemon
Gui, Add, Edit, x152 y130 w40 h20 vp1, %p1%
Gui, Add, Edit, x152 y160 w40 h20 vp2, %p2%
Gui, Add, Edit, x152 y190 w40 h20 vp3, %p3%
Gui, Add, Edit, x152 y220 w40 h20 vp4, %p4%
Gui, Add, Edit, x152 y250 w40 h20 vp5, %p5%
Gui, Add, Edit, x152 y280 w40 h20 vp6, %p6%
Gui, Add, Edit, x152 y320 w40 h20 vpWild, %pWild%
Gui, Add, Button, x152 y350 w70 h30, Help
Gui, Add, Button, x42 y350 w80 h30, OK
; Generated using SmartGUI Creator 4.0
Gui, Show, xCenter yCenter h402 w267, Automatic Level Raising
Return
ButtonHelp:
MsgBox,, Help, == Usage ==`n- Trainers -`n1) open 'Trainer Editor' in Spiky's DS Map Editor, select first trainer where you want to start`n2) hit Alt + 1 to start automatic routine of raising Pokemon levels of ALL trainers`n3) hit Shift + 0 (spam it, works better) as soon as the last trainer is being edited`n`n- Wild Pokemon -`n1) open 'Wild Pokemon Editor' in Spiky's DS Map Editor`n2) hit Alt + 2 to start automatic routine of raising ALL wild Pokemon levels`n3) hit Shift + 0 (spam it, works better) as soon as the last area is being edited`n`nATTENTION: the script will keep going until you manually stop it. If it reaches the last trainer/wild Pokemon area in the list, it will continue to raise the Pokemon levels infinitely (until all are 100)`n`n== Hotkeys ==`nAlt + 1 - raise trainer's Pokemon levels`nAlt + 2 - raise wild Pokemon levels`nAlt + 3 - check the currently set and active percentage values`nShift + 0 - stop script `nCtrl + Shift + 0 - continue script (press Alt + 1 or Alt + 2 again)`n`nAfter you have set your values, hit OK to submit them. Afterwards, you can use the hotkeys in Spiky's DS Map Editor.
return
ButtonOK:
Gui, Submit, NoHide
; set default values if empty strings were submitted
defaultSetNote := ""
submittedEmpty := false
; Pokemon 1-6
i := 1
Loop, 6
{
if (p%i% = "")
{
p%i% := defValTrainer
submittedEmpty := true
}
i := i + 1
}
; wild Pokemon
if (pWild = "")
{
pWild := defValWild
submittedEmpty := true
}
if (submittedEmpty)
defaultSetNote := "NOTE: You submitted empty values, they were set to the default value!`n`n"
MsgBox,, Values set!, %defaultSetNote%You're set!`nPress the hotkeys (Alt + 1 or Alt + 2) in Spiky's DS Map Editor`nto start the automatic routine!
return
GuiClose:
ExitApp
; ==== GUI end ====
; === Script ===
; 'clipboard' is a reserved global variable from AutoHotkey that contains the current clipboard value
; sleep (wait in milliseconds) in between certain steps works better
stop := false
; Shift + 0 - stop
+0::stop := true
; Ctrl + Shift + 0 - continue
^+0::stop := false
; Alt + 3 - check active/set percentage values
!3::
MsgBox,, Value Check, has 1 PKMN: %p1%`%`nhas 2 PKMN: %p2%`%`nhas 3 PKMN: %p3%`%`nhas 4 PKMN: %p4%`%`nhas 5 PKMN: %p5%`%`nhas 6 PKMN: %p6%`%`nWild Pokemon: %pWild%`%
return
; Alt + 1 - raise trainer pokemon levels
!1::
if WinActive("ahk_exe SDSME.exe")
{
; raise pokemon levels by percentage, depending on how many pokemon a trainer has (allows more fine tuning)
while !stop
{
pokeCount := countPokemon()
percent := p%pokeCount% ; get according percentage value dynamically
;percent := 20 ; set static percentage value for all cases equally
Loop, %pokeCount%
{
addTrainerLevel(percent) ; raise levels
sleep, 25
if (pokeCount > 1)
{
nextPokemon() ; select next pokemon
sleep, 25
}
}
saveTrainer()
sleep, 25
nextTrainer()
sleep, 50
}
}
return
; Alt + 2 - raise wild pokemon levels
!2::
if WinActive("ahk_exe SDSME.exe")
{
X := 460
while !stop
{
Y := 123
Loop, 12 ; always 12
{
addWildLevel(pWild, X, Y)
Y := Y + 27
sleep, 10
}
saveWild()
sleep, 25
nextArea()
}
}
return
; get current level and add percentage
addWildLevel(percent, X, Y)
{
Click %X%, %Y%, 2 ; double click
sleep, 25
Send, ^c ; copy current level into clipboard
sleep, 25
cache := clipboard
; always round up
result := ceil(cache * (percent / 100)) + cache
clipboard := result
sleep, 25
Send, ^v ; paste new level from clipboard
}
; select next area in 'Wild Pokemon Editor'
nextArea()
{
Click 135, 50
sleep, 25
send, {down}
sleep, 25
send, {enter}
sleep, 25
}
; counts trainer pokemon by clicking through pokemon tabs
; returns pokemon amount
countPokemon()
{
pokemon := 0
exists := true
X := 22
while exists
{
exists := pokemonExists(X, 215)
if (exists)
pokemon := pokemon + 1
X := X + 66
}
Click 50, 215 ; click on first pokemon tab of trainer
return pokemon
}
; checks if a pokemon tab exists at X, Y coordinates by checking color at mouse position after clicking
; white = exists, any other color = doesn't exist
pokemonExists(X, Y)
{
ret := false
Click %X%, %Y%
PixelGetColor color, X, Y
if (color = "0xFFFFFF") ; = white
ret := true
sleep, 10
return ret
}
; get current level and add percentage
addTrainerLevel(percent)
{
Click 175, 255, 2 ; double click
sleep, 25
Send, ^c ; copy current level into clipboard
sleep, 25
cache := clipboard
; always round up
result := ceil(cache * (percent / 100)) + cache
clipboard := result
sleep, 25
Send, ^v ; paste new level from clipboard
}
; select next pokemon
nextPokemon()
{
send, {LCtrl down} {Tab} {LCtrl up} ; send Ctrl + Tab
}
; click 'Trainer Editor' save button
saveTrainer()
{
Click 390, 350
sleep, 25
Click 390, 350 ; click save button 2 times with a small delay, works better
}
; click 'Wild Pokemon Editor' save button
saveWild()
{
Click 800, 520
sleep, 25
Click 800, 520 ; click save button 2 times with a small delay, works better
}
; select next trainer
nextTrainer()
{
Click 195, 50
sleep, 25
send, {down}
sleep, 25
send, {enter}
sleep, 25
Click 50, 215 ; click on first pokemon tab of trainer
}
Last edited: