Openkore.com

OpenKore Forums
It is currently 20 Oct 2018, 04:12

All times are UTC - 5 hours [ DST ]





Post new topic Reply to topic  [ 11 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: variable usage
PostPosted: 16 Aug 2018, 01:45 
Offline
Plain Yogurt
Plain Yogurt

Joined: 22 Jul 2009, 23:19
Posts: 86
Good Day, I want to make a macro that will use @rand as variable assignments. How can I properly construct this?

The bot will try to detect a player within 6 cells , and if someone comes in within 6 cells , it will trigger the macro and the bot will execute the seq in which chosen by @rand .

Code:
automacro check {
player (.*) 6
call mymacro
}

macro mymacro {
@rand (1,4)
$var = @rand
if (($var == 1) call seq1 1 { )
if (($var == 2) call seq2 1 { )
if (($var == 3) call seq3 1 { )
if (($var == 4) call seq4 1 { )
}

macro seq1 {
do blah blah
do put command here
}

macro seq2 {
do blah blah
do put command here
}

macro seq3 {
do blah blah
do put command here
}

macro seq4 {
do blah blah
do put command here
}




Top
 Profile  
 
 Post subject: Re: variable usage
PostPosted: 16 Aug 2018, 06:30 
Offline
OpenKore Monk
OpenKore Monk
User avatar

Joined: 17 Nov 2017, 23:32
Posts: 431
Location: Genting Highland, Malaysia
kamirie wrote:

Code:
if (($var == 1) call seq1 1 { )
if (($var == 2) call seq2 1 { )
if (($var == 3) call seq3 1 { )
if (($var == 4) call seq4 1 { )



Why you put '{' then ')' ?
Where the closing?

Image

Try or should be like this:

Code:

macro mymacro {
@rand (1,4)
$var = @rand
if (($var == 1) call seq1 1 || ($var == 2) call seq2 1 || ($var == 3) call seq3 1 || ($var == 4) call seq4 1)
}


_________________

iRO server supporter.
Wiki & Google are your best allies.
I'll not give answers, I only show you the way to find it.
Image


Top
 Profile  
 
 Post subject: Re: variable usage
PostPosted: 16 Aug 2018, 21:29 
Offline
Plain Yogurt
Plain Yogurt

Joined: 22 Jul 2009, 23:19
Posts: 86
I will try this thanks


Top
 Profile  
 
 Post subject: Re: variable usage
PostPosted: 17 Aug 2018, 02:55 
Offline
Plain Yogurt
Plain Yogurt

Joined: 22 Jul 2009, 23:19
Posts: 86
Can I do this ?

I'm playing in a pk server and I use this bot to cast skills . So if a player comes near my bot or tries to kill me , my bot will transfer to a different savepoint ( the new sp will depend on the result of the @rand ) , save in the kafra then continue what it's supposed to do.

Code:
if (($var == 1) call seq1 1 { set $var1 == town0 } )
if (($var == 2) call seq2 1 { set $var1 == town1 } )
if (($var == 3) call seq3 1 { set $var1 == town2 } )
if (($var == 4) call seq4 1 { set $var1 == town3 } )


then in another automacro I will use $var1 . I read that all variables are global .

Code:
automacro sp {
run-once 1
map $var1 {
do conf lockMap $var1
do move --to kafra coordinate
do talk --to kafra to save
release all
}
}


Top
 Profile  
 
 Post subject: Re: variable usage
PostPosted: 17 Aug 2018, 06:10 
Offline
OpenKore Monk
OpenKore Monk
User avatar

Joined: 17 Nov 2017, 23:32
Posts: 431
Location: Genting Highland, Malaysia
Why not make it more simple?

Like

When attacked > @warp $random
Then change lockMap as $random.
Automacro to trigger when at certain map >macro to save point.


Example:
Code:
automacro Attacked {
   console /oh no im attacked or what ever it is>
   run-once 1
   call {
      $random = <ur maps
      do warp $random
      release all
   }
}

automacro map1 {
   location
   run-once 1
   call {
      do go save or whate ver you want
   }
}

<some more maps you wnat just like above



I'm myself don't write fancy code or complex stuff. I like it simple 8-)

_________________

iRO server supporter.
Wiki & Google are your best allies.
I'll not give answers, I only show you the way to find it.
Image


Top
 Profile  
 
 Post subject: Re: variable usage
PostPosted: 17 Aug 2018, 11:08 
Offline
Plain Yogurt
Plain Yogurt

Joined: 22 Jul 2009, 23:19
Posts: 86
fadreus wrote:
Why not make it more simple?

Like

When attacked > @warp $random
Then change lockMap as $random.
Automacro to trigger when at certain map >macro to save point.


Example:
Code:
automacro Attacked {
   console /oh no im attacked or what ever it is>
   run-once 1
   call {
      $random = <ur maps
      do warp $random
      release all
   }
}

automacro map1 {
   location
   run-once 1
   call {
      do go save or whate ver you want
   }
}

<some more maps you wnat just like above



I'm myself don't write fancy code or complex stuff. I like it simple 8-)


I will try this thanks


Top
 Profile  
 
 Post subject: Re: variable usage
PostPosted: 20 Aug 2018, 17:12 
Offline
Moderators
Moderators
User avatar

Joined: 16 Dec 2011, 02:53
Posts: 1211
Location: Brazil
Code:
console /oh no im attacked or what ever it is>


Take a look at the LAST forward slash.

Correct is :

Code:
console /oh no im attacked or what ever it is/

_________________
"'There are three things all wise men fear: the sea in storm, a night with no moon, and the anger of a gentle man.'" :P

viewtopic.php?f=10&t=16117

Thanks for this Eternal! =D <3<3


Top
 Profile  
 
 Post subject: Re: variable usage
PostPosted: 20 Aug 2018, 23:55 
Offline
OpenKore Monk
OpenKore Monk
User avatar

Joined: 17 Nov 2017, 23:32
Posts: 431
Location: Genting Highland, Malaysia
That one typo. xD
Comment made in hurry..

Ma bad..

_________________

iRO server supporter.
Wiki & Google are your best allies.
I'll not give answers, I only show you the way to find it.
Image


Top
 Profile  
 
 Post subject: Re: variable usage
PostPosted: 22 Aug 2018, 12:19 
Offline
Moderators
Moderators
User avatar

Joined: 16 Dec 2011, 02:53
Posts: 1211
Location: Brazil
fadreus wrote:
That one typo. xD
Comment made in hurry..

Ma bad..

u are a god! more power to u

_________________
"'There are three things all wise men fear: the sea in storm, a night with no moon, and the anger of a gentle man.'" :P

viewtopic.php?f=10&t=16117

Thanks for this Eternal! =D <3<3


Top
 Profile  
 
 Post subject: Re: variable usage
PostPosted: 23 Aug 2018, 00:39 
Offline
Plain Yogurt
Plain Yogurt

Joined: 22 Jul 2009, 23:19
Posts: 86
I forgot , I need to use If statements because I need to do manual npc talk steps to save to the kafra of the new random map. I'm planning to also use inns as save points so I need IF statements to direct a sequence to a correct macro for steps.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group