How do I read a line using the macro ?

All about the macro plugin can be found in this forum. This forum is intended for the macro plugin only.

Moderator: Moderators

lightx
Noob
Noob
Posts: 2
Joined: 30 Sep 2012, 13:20
Noob?: Yes

How do I read a line using the macro ?

#1 Post by lightx »

How do I read a line using the macro ? :P (Another file)

Example:

variable>
x = 10;

The first line of the file = 26
_____________

LINE + X

LINE = (LINE + X)

So replacing the first line to 26 for 36 ;D

Thanks. :D

Sorry for my english
dracus_loki
Human
Human
Posts: 29
Joined: 13 Jul 2012, 06:32
Noob?: Yes

Re: How do I read a line using the macro ?

#2 Post by dracus_loki »

Could U explain the situation In game ...then maybe I can help .. And If this helps U can add variables with @eval
rocknroll
Been there done that!
Been there done that!
Posts: 118
Joined: 19 Sep 2011, 07:30
Noob?: Yes

Re: How do I read a line using the macro ?

#3 Post by rocknroll »

are u going to use goto function??
Sorry, my english is very bad !
ever_boy_
Developers
Developers
Posts: 308
Joined: 06 Jul 2012, 13:44
Noob?: No

Re: How do I read a line using the macro ?

#4 Post by ever_boy_ »

WHAT file?
EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: How do I read a line using the macro ?

#5 Post by EternalHarvest »

You need to use Perl eval or subs to read and write files.
lightx
Noob
Noob
Posts: 2
Joined: 30 Sep 2012, 13:20
Noob?: Yes

....

#6 Post by lightx »

I tried ... but do not understand much.

My current macro:
file name/place: logitem.txt (openkore\control\logitem.txt)

automacro open {
console /Event/
exclusive 1
call {
$x = 1;
do eval open(FILE, ">>", Settings::getControlFilename("logitem.txt"));print FILE $x+$x; close FILE;
}
}
he writes in the file.

But, I want the first line of the file (logitem.txt) becomes variable.

And replace the line with the new result.

Has as?


Sorry for my english