Skip to content

DuskyElf/rpg-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terminal Based Rpg Game (Engine)

In it's early stages of development

Quick Start

$ git clone [email protected]:DuskyElf/rpg-rs.git
$ cd rpg-rs
$ git checkout tags/v0.0.1-alpha

Sample Program

"Hello, World! This is just so awesome!!!"
?0 "What is your name?"
"Which Branch?" {
    "first" => {
        ?1 "What is your age?"
        "Hi $0, you are $1 years old!"
    }

    "second" => {
        "Are you 18+ $0?" {
            "yes" => { "Whooo, you can vote" }
            "no" => { "Sorry, you can't vote" }
        }
    }
}

Quick Run

$ cargo r --release test.rpg

Features that are currently implemented

  • Variables
  • Asking question into a variable (identifier)
  • Branching System

Rpg lang Reference

Messages

Currently, it clears the terminal and animates the message as it being typed, then stops for the user to proceed.

"Example message"

image

Questions

Currently, it clears the terminal and animtes the question as it being typed, then stops for the user to type in the answer till a newline. Then saves the answer in the variable index provided (0 in the following example).

?0 "What's your name?"

image

Variables

As stated above, questions save the answer in the variable index provided. Those values could be accessed via the index as $<index> inside a quotes.

?0 "What's your name?"
"Hi $0!"

image | image

Branches

Currently, it's able to ask a question then show the possible options to select, on the basis of which it branches the code flow.

"Select an option -" {
    "First" => {
        "You selected the first branch!"
    }
    "Second" => {
        "You selected the second branch!"
    }
}

image