Welcome, Guest. Please Login or Register.
eccoMAGIC Forums
03/28/24 at 15:26:22
News: If you have a scroll wheel, TRY EM SCROLL WHEELS. It's NICE!
Home Help Search Login Register


Pages: 1
Send Topic Print
  Rating
Rate:
Rating:
Rating: 0.00
Votes: 0

5
4
3
2
1












5
4
3
2
1


1


2


3


4


5


6


7


8


9


10

Setup of Lua to work with Eccoext (Popularity: 17341 )
tachyonfist
EccoMagic Apprentice
*


Ecco! Lean &
Mean

Posts: 2
Gender: male
Show the link to this post Setup of Lua to work with Eccoext
06/07/08 at 23:29:13
 
I am interested in using Lua with Eccoext.  I have download Lua from www.lua.org.  Since there is no installer I was interested in what/where I need to place files to have Lua scripting in Eccoext work.
 
 
 
Back to top
 
 

tachyonfist
Email   IP Logged
Admin
Administrator
*****


I love Ecco!

Posts: 134
Show the link to this post Re: Setup of Lua to work with Eccoext
Reply #1 - 06/08/08 at 13:36:06
 

 
Short answer: NOTHING!
 
 
 
The LUA language is *built in* to the slang extension.
 
 
Only if you wish to use perl or python,  need you worry about external program installation.
 
 
JavaScript and VBScript should also work 'right out of the box'  on most systems.
 
 
 
Back to top
 
 

The Administrator.
WWW   IP Logged
tachyonfist
EccoMagic Apprentice
*


Ecco! Lean &
Mean

Posts: 2
Gender: male
Show the link to this post Re: Setup of Lua to work with Eccoext
Reply #2 - 06/09/08 at 09:39:41
 
Thanks for the clarification.  Still glad I downloaded as I will use this to do other types of Lua testing.
 
tachyonfist
Back to top
 
 

tachyonfist
Email   IP Logged
randfb
EccoMagic Apprentice
*


I Love Ecco!

Posts: 4
Gender: male
Show the link to this post Re: Setup of Lua to work with Eccoext
Reply #3 - 10/02/08 at 12:45:35
 
How can I use an external Python script with EccoExt ?
 
Rand
Back to top
 
 
Email   IP Logged
Admin
Administrator
*****


I love Ecco!

Posts: 134
Show the link to this post Re: Setup of Lua to work with Eccoext
Reply #4 - 10/02/08 at 18:17:35
 

 
Yes you can call external scripts from a LUA rule or function.  (there are threads on that here, if memory servers).
 
You can have a python script WITHIN a rule.
 
Back to top
 
 

The Administrator.
WWW   IP Logged
randfb
EccoMagic Apprentice
*


I Love Ecco!

Posts: 4
Gender: male
Show the link to this post Re: Setup of Lua to work with Eccoext
Reply #5 - 04/13/10 at 12:40:53
 
Could you give me an example of the use of python within a rule ?
 
Rand
Back to top
 
 
Email   IP Logged
Admin
Administrator
*****


I love Ecco!

Posts: 134
Show the link to this post Re: Setup of Lua to work with Eccoext
Reply #6 - 04/13/10 at 13:13:06
 
Quote from randfb on 04/13/10 at 12:40:53:
Could you give me an example of the use of python within a rule ?

Rand

 
 
Have you tried any script within a rule ?
 
 
eg.,  have you tried simple LUA to get down basic syntax & how to for  simple script ?
 
 
Back to top
 
 

The Administrator.
WWW   IP Logged
randfb
EccoMagic Apprentice
*


I Love Ecco!

Posts: 4
Gender: male
Show the link to this post Re: Setup of Lua to work with Eccoext
Reply #7 - 04/13/10 at 15:01:34
 
I just tried the example at
http://eccoextdoc.wikispaces.com/Sample+Program+2
 
and I got a message
"
Error 31 launching "C:\Program Files\ECCO\luacmd.lua"
"
Back to top
 
 
Email   IP Logged
Admin
Administrator
*****


I love Ecco!

Posts: 134
Show the link to this post Re: Setup of Lua to work with Eccoext
Reply #8 - 04/13/10 at 19:03:14
 
perhaps this is helpful:
 

Re: ADVANCED TOPIC: LUA Rules or LUA Script?

Re: ADVANCED TOPIC: LUA Rules or LUA Script?

> just put any script in luacmd.lua, it will be loaded anytime when you

> execute lua rule.

>

> maybe the file name should be eccoext.lua, just like any other

> supportted script type :-).

>

I put this simple script in luacmd.lua:

++:L:

B=get_item_text(item_id)

if B=="New" then msgbox("New Added") end

(A message pops up if new item with text "New" is added)

It works fine when added to any Ecco folder, but not when added to

luacmd.lua. What am I doing wrong?

Re: ADVANCED TOPIC: LUA Rules or LUA Script?

Re: ADVANCED TOPIC: LUA Rules or LUA Script?

luacmd.lua holds functions (you can call from rules or tools), not rules.

--- In ecco_pro@yahoogroups.com, rbrandes1 <no_reply@...> wrote:

>

>

> > just put any script in luacmd.lua, it will be loaded anytime when you

> > execute lua rule.

> >

> > maybe the file name should be eccoext.lua, just like any other

> > supportted script type :-).

> >

>

> I put this simple script in luacmd.lua:

>

> ++:L:

> B=get_item_text(item_id)

> if B=="New" then msgbox("New Added") end

>

> (A message pops up if new item with text "New" is added)

>

> It works fine when added to any Ecco folder, but not when added to

> luacmd.lua. What am I doing wrong?

>

Re: ADVANCED TOPIC: LUA Rules or LUA Script?

Re: ADVANCED TOPIC: LUA Rules or LUA Script?

--- In ecco_pro@yahoogroups.com, "yoursowelcomethanks"

<perlloaderplease@...> wrote:

>

>

>

> if you define a LUA function in the external file,

>

> you can 'execute' that just like any LUA command AS YOUR LUA RULE.

>

>

>

How woudl I call such a function from the rule?

Something like

++:L:LUAScript:myfunction() ?

Re: ADVANCED TOPIC: LUA Rules or LUA Script?

Re: ADVANCED TOPIC: LUA Rules or LUA Script?

--- In ecco_pro@yahoogroups.com, rbrandes1 <no_reply@...> wrote:

>

> >

> How woudl I call such a function from the rule?

> Something like

> ++:L:LUAScript:myfunction() ?

>

++:L: myfunction([optional vars])

Re: ADVANCED TOPIC: LUA Rules or LUA Script?

Re: ADVANCED TOPIC: LUA Rules or LUA Script?

--- In ecco_pro@yahoogroups.com, "yoursowelcomethanks"

<perlloaderplease@...> wrote:

>

> --- In ecco_pro@yahoogroups.com, rbrandes1 <no_reply@> wrote:

> >

>

> > >

> > How woudl I call such a function from the rule?

> > Something like

> > ++:L:LUAScript:myfunction() ?

> >

>

> ++:L: myfunction([optional vars])

>

I still can not get my rules in luacmd.lua to work.

Per YSWT's post above, I placed the LUA rule as a function in luacmd.lua:

function newpopup()

B=get_item_text(item_id)

if B=="New" then msgbox("New Added") end

end

I next added the rule in an Ecco folder:

++:L:LUAScript:newpopup()

However, the rule is not executing! What am I doing wrong?

p.s. As explained previously, it works fine when I place the rule

directly in a folder:

++:L:

B=get_item_text(item_id)

if B=="New" then msgbox("New Added") end

Re: ADVANCED TOPIC: LUA Rules or LUA Script?

Re: ADVANCED TOPIC: LUA Rules or LUA Script?

Slang has added so much, it's easy to need a few send looks to get it

all down pat.

LUAScript:newpopup() is format style of LAUNCH TOOL syntax.

functions BECOME part of the LUA langauge.

so if you have a function newpopup()

"newpopup()" becomes a LUA command, just like x = x + 1

so,

your rule is just

++:L:newpopup()

--- In ecco_pro@yahoogroups.com, rbrandes1 <no_reply@...> wrote:

>

> --- In ecco_pro@yahoogroups.com, "yoursowelcomethanks"

> <perlloaderplease@> wrote:

> >

> > --- In ecco_pro@yahoogroups.com, rbrandes1 <no_reply@> wrote:

> > >

> >

> > > >

> > > How woudl I call such a function from the rule?

> > > Something like

> > > ++:L:LUAScript:myfunction() ?

> > >

> >

> > ++:L: myfunction([optional vars])

> >

>

> I still can not get my rules in luacmd.lua to work.

> Per YSWT's post above, I placed the LUA rule as a function in

luacmd.lua:

>

> function newpopup()

> B=get_item_text(item_id)

> if B=="New" then msgbox("New Added") end

> end

>

> I next added the rule in an Ecco folder:

> ++:L:LUAScript:newpopup()

>

> However, the rule is not executing! What am I doing wrong?

>

> p.s. As explained previously, it works fine when I place the rule

> directly in a folder:

> ++:L:

> B=get_item_text(item_id)

> if B=="New" then msgbox("New Added") end

>

Re: ADVANCED TOPIC: LUA Rules or LUA Script?

Re: ADVANCED TOPIC: LUA Rules or LUA Script?

--- In ecco_pro@yahoogroups.com, "yoursowelcomethanks"

<perlloaderplease@...> wrote:

>

>

> Slang has added so much, it's easy to need a few send looks to get it

> all down pat.

>

> LUAScript:newpopup() is format style of LAUNCH TOOL syntax.

>

>

> functions BECOME part of the LUA langauge.

>

>

> so if you have a function newpopup()

>

>

> "newpopup()" becomes a LUA command, just like x = x + 1

>

>

> so,

>

> your rule is just

>

> ++:L:newpopup()

>

>

Sorry there was a typo in my post. Indeed my rule was:

++:L:newpopup()

However, it still doesn't work though, because the item_id is not

automatically passed to the function. To get it to work, I need to

pass the item ID:

++:L:newpopup(item_id)

Re: ADVANCED TOPIC: LUA Rules or LUA Script?

Re: ADVANCED TOPIC: LUA Rules or LUA Script?

--- In ecco_pro@yahoogroups.com, rbrandes1 <no_reply@...> wrote:

>

> --- In ecco_pro@yahoogroups.com, "yoursowelcomethanks"

> <perlloaderplease@> wrote:

> >

> >

> > Slang has added so much, it's easy to need a few send looks to

get it

> > all down pat.

> >

> > LUAScript:newpopup() is format style of LAUNCH TOOL syntax.

> >

> >

> > functions BECOME part of the LUA langauge.

> >

> >

> > so if you have a function newpopup()

> >

> >

> > "newpopup()" becomes a LUA command, just like x = x + 1

> >

> >

> > so,

> >

> > your rule is just

> >

> > ++:L:newpopup()

> >

> >

> Sorry there was a typo in my post. Indeed my rule was:

> ++:L:newpopup()

>

> However, it still doesn't work though, because the item_id is not

> automatically passed to the function. To get it to work, I need to

> pass the item ID:

> ++:L:newpopup(item_id)

>

you can add a function newpopup with one parameter in luacmd.lua,

then use ++:L:newpopup(item_id) in the folder rule.


Back to top
 
 

The Administrator.
WWW   IP Logged
Admin
Administrator
*****


I love Ecco!

Posts: 134
Show the link to this post Re: Setup of Lua to work with Eccoext
Reply #9 - 04/13/10 at 19:21:11
 

Also this example may be helpful:
 

Re: EccoExt; LUA Rules; Solution to A=B+2 & B=A-2

Re: EccoExt; LUA Rules; Solution to A=B+2 & B=A-2

It was a bit tricky, but I am giving a solution below in case someone

else needs it. The approach can be used to set up a rule that

calculates values in one folder based on values in another OR vice versa!

For examples, we may have the simple relation:

Cost=Rate*Hrs where Cost is in one folder and Hrs is in another.

If we change Cost, we want EccoExt to calculate the resulting Hrs

(=Cost/Rate)

If we change Hrs, we want EccoExt to calculate the resulting

Cost(=Rate*Hrs)

In my own example I had the relation

B=A+2 (or A=B-2)

I setup 4 number folders:

A, B, PrA, PrB

PrA & PrB are dummy folders that holds the previous values (only used

for the LUA Rule to work). The LUA script is then placed in any folder

(e.g. "LUA_Rules"):

++:L:

vA=get_folder_value("A",item_id)

vB=get_folder_value("B",item_id)

vPrA=get_folder_value("PrA",item_id) -- Get Previous Value

vPrB=get_folder_value("PrB",item_id) -- Get Previous Value

if vPrA~=vA then -- A Changed => Calulate B & set new PrA, PrB

vB=vA+2

set_folder_value("B",item_id,vB)

set_folder_value("PrB",item_id,vB)

set_folder_value("PrA",item_id,vA)

elseif vPrB~=vB then -- B Changed => Calulate A set new PrA, PrB

vA=vB-2

set_folder_value("A",item_id,vA)

set_folder_value("PrA",item_id,vA)

set_folder_value("PrB",item_id,vB)

-- else msgbox("No folder Changed")

end

The message box is of course optional (and commented out with -- above)

p.s. YSWT, I guess I will try to post in the EM forum as well. I agree

that it would be easier to find bugs, scripts etc there rather than

have to search here. However, I suspect that many users of this forum

may not bother reading the EM forum (in particular if they have an

E-mail subscription to this forum....).

--- In ecco_pro@yahoogroups.com, rbrandes1 <no_reply@...> wrote:

>

> I am still trying to figure out a way to calculate two number folders.

> If value in A changes, I would like to calculate value in B and vice

> versa.

> e.g.

> B=A+2

> A=B-2

>

> Is there some LUA way that I can tell which folder (A or B), I changed

> the number in?

>


 
from:
Ecco_Pro post 3754      rbrandes1      EccoExt; LUA Rules                  
 
                                         
Back to top
 
 

The Administrator.
WWW   IP Logged
Pages: 1
Send Topic Print