Search Archive

How to perform multiply and divide operation in SCRIPTs

By Chuck88 · Apr 16, 2011in Hacks/Mods💬 6 posts👁️ 1,296 views
Posted Apr 16, 2011 · 14:15 UTC#1

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!

Edited Apr 16, 2011 by Chuck88
Posted Apr 21, 2011 · 17:21 UTC#2

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!

Posted Jun 13, 2011 · 16:22 UTC#3

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>

Posted Jun 14, 2011 · 15:52 UTC#4

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.

Posted Jun 22, 2011 · 02:15 UTC#5

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.

Posted Jun 22, 2011 · 16:09 UTC#6

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.