Skip to content

Random stuck in macro and eventMacro when doing do north/east/west/south #4140

Description

@ragnarokoffline

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

Image

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)
}
Image

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)
}
Image

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)
}
Image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions