Jump to content
Sign in to follow this  
Followers 1
Ah!

Arithmetic

Recommended Posts

How can I add, subtract,, multiply or divide variables?  These are very basic things in computing, can they be performed in earwigo?

 

Cheers,

Ah!

Edited by Ah!

Share this post


Link to post

Yes, they can be performed.

 

Assuming you declared two variables. Type must be "Number". (Don't pay attention to the strange language my browser uses):

5b904199869be_VariablesTab.thumb.png.53972129700a104d4ff88a68ea6f1240.png

 

You could use arithmetic in a message:

5b904234b7eda_Variablesarithmeticinamessage.thumb.png.01b13748bf995ab315f87400b55e8f6c.png

 

If you feel creative, you can also write some Author Code. You'll find this in the Cartridge tab:

5b90427564744_FunctioninAuthorCode.thumb.png.e7f6c974cd86843ea95ccaf3af6d291a.png

 

Then, you'll have to call the function in an event trigger:

5b9043159c409_LUAAction.thumb.png.0e3020f372c92745d625d50f676dadb1.png

 

Reference: Earwigo Tips and Tricks / How do I show a value to the player?

Share this post


Link to post

 Thanks again for your quick reply.  I have tried that and it works fine.  I had tried ~~var_v1~~ + ~~var_v2~~ but I now realise that was stupid. 

 Cheers,

Ah!  

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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...
Sign in to follow this  
Followers 1

×
×
  • Create New...