Jump to content
AVIC411.com

How to perform multiply and divide operation in SCRIPTs


Recommended Posts

Been a while since I looked at it, but I think you can't.

 

 

in iGO Primo they moved to a more general purpose scripting language (Lua) to make these things easier...

 

Hi there,

 

I was looking to find a way to multiply or divide something when writing scripts, and sometime I would like to involve floating point. Is this all possible in the iGo scripting language?

 

Thanks!

Link to post
Share on other sites
  • 1 month later...

Hey BorisM,

 

I just found out the following code in place.ui, but didn't dig into it ... seems to be very stupid of iGo not providing multiply and division mechanisms.

 

Cheers!

 

;Common Multiplication and Division Function
<script d_Umnog>
run d_UmnDelDone
dUmnDel1.set $1
dUmnDel2.set $2
dUmnDel3.set $3
dUmnDel4.set $1
1	run d_UmnogInit
</script>

<script d_UmnogInit>
decval "dUmnDel2" 1
incval "dUmnDel5" 1
1	runif dUmnDel2 0 'run dUmnDel3'
1	else_run 'incval "dUmnDel1" dUmnDel4, run d_UmnogRepeat'
</script>

<script d_UmnogRepeat>
runif dUmnDel5 1000 'dUmnDel5.set 0, 30 run d_UmnogInit'
else_run '1 run d_UmnogInit'
</script>

<script d_Delen>
run d_UmnDelDone
dUmnDel1.set -1
dUmnDel2.set $1
dUmnDel3.set $3
dUmnDel4.set $2
1	run d_DelenInit
</script>

<script d_DelenInit>
incval "dUmnDel1" 1
incval "dUmnDel5" 1
1	runif dUmnDel2 <= 0 'run dUmnDel3'
1	else_run 'decval "dUmnDel2" dUmnDel4, run d_DelenRepeat'
</script>

<script d_DelenRepeat>
runif dUmnDel5 1000 'dUmnDel5.set 0, 30 run d_DelenInit'
else_run '1 run d_DelenInit'
</script>

<script d_UmnDelDone>
term d_UmnogInit
term d_UmnogRepeat
term d_DelenInit
term d_DelenRepeat
dUmnDel5.set 0
</script>

Link to post
Share on other sites

Hey BorisM,

 

I just found out the following code in place.ui, but didn't dig into it ... seems to be very stupid of iGo not providing multiply and division mechanisms.

 

Cheers!

 

 

 

Yeah. I don't think they imagined it would be needed at the time, though. But of course, true, you can emulate multiplication and division with addition and substraction. Not the prettiest way, but it works.

Link to post
Share on other sites

Hi Boris,

 

Another subject: Do you know what is the difference between the commands STATE and NEXTSTATE?

 

STATE ST_XXX

NEXTSTATE ST_XXX

 

For me both commands achieve the same thing, switch to the ST_XXX.

 

Thanks for any insight.

Link to post
Share on other sites

Hi Boris,

 

Another subject: Do you know what is the difference between the commands STATE and NEXTSTATE?

 

STATE ST_XXX

NEXTSTATE ST_XXX

 

For me both commands achieve the same thing, switch to the ST_XXX.

 

Thanks for any insight.

 

Could not find any difference between them online... Probably they do the same thing, although may be NEXTSTATE waits for the current sctipt to complete somehow.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...