1 (edited by oAk 2016-02-21 06:31:15 am)

Topic: nModules mzscript javascript

Maybe im just tired, but i feel confused and could use some help on this

basically i have this with mzscript.

*Script bang !changePosition
  *Script exec  !varset someXPositíon 50
  *Script exec  !varset someYposition 50
  *Script exec  !varsave someXPositíon 
  *Script exec  !varsave someYposition 
*Script ~bang

i would have a label that gets the x and y from these variables (someXPositíon and someYPositíon)
and then i have this in a popup menu

*Popup "Set X and Y to a set number"        !changePosition

and doing a refresh or recycle after clicking on it, that label will then be at those new X and Y values (50 and 50).

but as lazy as i am i dont want to be writing up 10 similar bangs that simply changes the X and Y positions.
then i wondered if it would be possible to perhaps take some assistance from javascript
if i where to do something like this in my popup menu

*Popup "Set X and Y to a set number"    !execute [!nExecScript(changeXandY(50, 50))]

and then i make a javascript function that takes those two numbers (X, Y) in this case 50 and 50
would it then be possible to send those values to that one bang, that changes the X and Y based on what values it get?
and then i saw this from 0.6 release of nModules her on the forum.

LiteStep.Bangs.Execute('!Alert', '"' + 'Hello World! ' + params + '"');

but i gotta admit that now im getting confused here,is it possible to send parameters to the bang?
if i use this in the javascript, how would i go about sending both X and Y to that bang and then using those values inside the bang

hopefully you understand where im going with this.

EDIT:
nvm tongue
figured it out eventually somehow it only wook me a few hours smile, and now the clock says 6:am here so im going to bed xD
and if anyone wants to know here is a little snippet smile
javascript:

LiteStep.Execute("!changePos 50 50 someXpos someYpos");
*Script bang !changePos
    *Script exec !varset someXpos %{args:1}
    *Script exec !varset someYpos %{args:2}
    *Script exec !varsave someXpos 
    *Script exec !varsave someYpos 
*Script ~bang

and in the popup menu

*Popup "change X and Y" !execute [!nExecScript PosChangeFunction("50", "50")] [!Refresh]

yaay, now maybe i can start working out my new theme big_smile.... sleeeeepp noooow... zzz smile