How run a function by a button?

About Truespace Archives

These pages are a copy of the official truespace forums prior to their removal somewhere around 2011.

They are retained here for archive purposes only.

How run a function by a button? // Scriptorium

1  |  

Post by ivampretti // Aug 25, 2008, 4:09am

ivampretti
Total Posts: 151
pic
How can I run a function defined in the jscript command by a push button?

What script I should to put in the push button?

Post by trueBlue // Aug 25, 2008, 5:48am

trueBlue
Total Posts: 1761
pic
I think what you are asking for can be achieved by using a FnSet.
http://forums1.caligari.com/truespace/showthread.php?p=45831#post45831 (http://forums1.caligari.com/truespace/showthread.php?p=45831#post45831)

Post by ivampretti // Aug 25, 2008, 6:01am

ivampretti
Total Posts: 151
pic
could be a function set, but I need that the function be in the jscript command.


jscript command example:


function Execute(params)

{

blablablablablabla...

}


function MoveUp()

{

blablablablabla2......

}


then in the panel of the jscript command I put a Push button that run the MoveUp() function every time I push it"


if this is possible I can use a single jscript command and dont needs a funcion set.

Post by trueBlue // Aug 25, 2008, 6:07am

trueBlue
Total Posts: 1761
pic
could be a function set, but I need that the function be in the jscript command.

jscript command example:

function Execute(params)
{
blablablablablabla...
}

function MoveUp()
{
blablablablabla2......
}

then in the panel of the jscript command I put a Push button that run the MoveUp() function every time I push it"

if this is possible I can use a single jscript command and dont needs a funcion set.

Do not use these lines in your button script:
function MoveUp()
{

}

Just put the blablablablablabla... in the button script. :)

Post by ivampretti // Aug 25, 2008, 6:37am

ivampretti
Total Posts: 151
pic
ooow great trueblue.


there is a way to access the params to use the convalue("variable")?

Post by trueBlue // Aug 25, 2008, 7:12am

trueBlue
Total Posts: 1761
pic
Yes... can you upload an example of what you want to do? Or paste your MoveUp script here?

Post by ivampretti // Aug 25, 2008, 11:32am

ivampretti
Total Posts: 151
pic
well, I did not wrotte the script yet... because I was studyng the options first. But I now what I need. I have a JScript Command whith a IN string Attribute named Sequency. and it is displayed in a Edit Control with the multiline on! I need to press a push button and one line gos up! She change her position with her near up line, like these:


Sequency:

aaaaaaaaaaaaaaaaa

bbbbbbbbbbbbbbbbb

ccccccccccccccccc

ddddddddddddddddd

eeeeeeeeeeeeeeeee


choice the c line! press the push button then this happens:


aaaaaaaaaaaaaaaaa

ccccccccccccccccc

bbbbbbbbbbbbbbbbb

ddddddddddddddddd

eeeeeeeeeeeeeeeee


press again:


ccccccccccccccccc

aaaaaaaaaaaaaaaaa

bbbbbbbbbbbbbbbbb

ddddddddddddddddd

eeeeeeeeeeeeeeeee


thats it. then I'll need one move up, one move down and a delete line too. these 3 functions I need.

Post by trueBlue // Aug 25, 2008, 4:21pm

trueBlue
Total Posts: 1761
pic
I think from what I am understanding from you is you would have to call functions from a script by way of an FnSet. Other ways you could do it is break up your script into individual scripts and call them from a button. The button properties is limited but you certainly can run any tS7.6 commands. Here is a simple example.
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn