# Move Scripts

## What are Move Scripts?

Move Scripts are a way to run multiple public functions on Endless in a single transaction. This is similar to deploying a helper module that would do common tasks, but allows for the flexibility of not having to deploy beforehand.

An example would be a function to transfer a half of a user's balance to another account. This is something that is easily programmable, but likely would not need a module deployed for it:

```move
script {
  use std::signer;
  use endless_framework::coin;
  use endless_framework::endless_account;

  fun transfer_half<Coin>(caller: &signer, receiver_address: address) {
    // Retrieve the balance of the caller
    let caller_address: address = signer::address_of(caller);
    let balance: u64 = coin::balance<Coin>(caller_address);

    // Send half to the receiver
    let half = balance / 2;
    endless_account::transfer_coins<Coin>(caller, receiver_address, half);
  }
}
```

## Learn more about using Move Scripts

* Writing scripts
* Compiling scripts
* Running scripts

## More details

For more details on Move Scripts, checkout:

* Move Book on Scripts
* Tutorial on Scripts


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.endless.link/endless/devbuild/build/learn-the-move-language/advanced-move-guides/move-scripts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
