Random stuck in macro and eventMacro when doing do north/east/west/south
Nobody has claimed this yet.
- Dominant language
- Perl
- Stars
- 1.5k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
Openkore version git
OpenKore what-will-become-2.1 ( version ctime:2026_02_05 )
XKore Mode
Empty
RO Server Name
localhost (rAthena)
Link to RO server
localhost (rAthena)
Result
When I use rand in macro or eventMacro, it always gets stuck in the second iteration and so on.
I mean, it won't randomize the number anymore.
This problem only happens when doing do north, do east, etc.
Relevant Log Output
Expected Result
It should be randomize each call
How to Reproduce
macros.txt
automacro test {
location prontera
call walk
timeout 5
}
macro walk {
pause 1
$num = @rand(1, 4)
do c I will follow the path $num
do north if ($num == 1)
do south if ($num == 2)
do east if ($num == 3)
do west if ($num == 4)
}
eventMacros.txt
automacro test {
InMap prontera
call walk
timeout 5
}
macro walk {
pause 1
$fix = &rand(1, 4)
$num = &rand(1, 4)
do c I will follow the path $num
do north if ($num == 1)
do south if ($num == 2)
do east if ($num == 3)
do west if ($num == 4)
}
The workaround
By adding another variable with random
automacro test {
InMap aegis
call walk
timeout 5
}
macro walk {
pause 1
$fix = &rand(1, 4)
$num = &rand(1, 4)
do c I will follow the path $num
do north if ($num == 1)
do south if ($num == 2)
do east if ($num == 3)
do west if ($num == 4)
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the supplied macros.txt and eventMacros.txt examples. Trace how @rand and &rand are handled when followed by do north, south, east, or west, then verify repeated macro iterations produce a newly randomized direction without requiring the extra random variable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- perl
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100