Jump to content

RPG text game - in progress. (Open source)


satanttin
 Share

Recommended Posts

Hi autoiters,

This is my first script and well i think it can be a fun game. so feel free to use it or give me ideas to make it better.

the things that i made so far is:

Save/Load players information (100%)

Stats(99% - Finish this when i made some items because str and weapon dmg needs to be calculated just dunno what variable i give to weapons yet)

Multiple characters(100%)

Can change character/race and age.(100%)

things i plan to add in future is:

Mobs

Battle system

inventory/with pictures of the items/max carry weight perhaps

town/with quests or other things.

Stats/stat points on level and button to add.

skills

exp/levels (if it's easy to do i make lots of levels atleast 100/1000 because i think it's awesome)

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $GGame, $GStart, $Name, $Race, $Age, $Gold, $Str, $Dex, $Vit, $Health

$Gold = "100"
$Str = "10"
$Dex = "10"
$Vit = "10"

Opt("GUIOnEventMode", 1)

guistart()

Func guistart()
$GStart = GUICreate("Start", 166, 75, 506, 353)
$BStart = GUICtrlCreateButton("Start", 88, 0, 75, 25)
$BLoad = GUICtrlCreateButton("Load", 88, 24, 75, 25)
$BName = GUICtrlCreateButton("Name", 0, 0, 75, 25)
$BRace = GUICtrlCreateButton("Race", 0, 24, 75, 25)
$BAge = GUICtrlCreateButton("Age", 0, 48, 75, 25)
$BSave = GUICtrlCreateButton("Save", 88, 48, 75, 25)
GUISetOnEvent($GUI_EVENT_CLOSE, "Close")
GUICtrlSetOnEvent($BStart, "start")
GUICtrlSetOnEvent($BName, "name")
GUICtrlSetOnEvent($BRace, "race")
GUICtrlSetOnEvent($BAge, "age")
GUICtrlSetOnEvent($BSave, "save")
GUICtrlSetOnEvent($BLoad, "load")
GUISetState()
While 1
WEnd
EndFunc

Func guigame()

$GGame = GUICreate("Game", 851, 555, 485, 288)
$GrStats = GUICtrlCreateGroup("", 0, 0, 849, 33)
$Label1 = GUICtrlCreateLabel($name &" you are a "& $age& " year old " &$race, 8, 8, 250, 17)
$Label2 = GUICtrlCreateLabel("Gold: "& $Gold, 288, 8, 150, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$LStr = GUICtrlCreateLabel("Strenght: "&$Str, 128, 216, 150, 17)
$LDex = GUICtrlCreateLabel("Dexterity: "&$Dex, 128, 240, 150, 17)
$LVit = GUICtrlCreateLabel("Vitality: "&$Vit, 128, 264, 150, 17)
$LHealth = GUICtrlCreateLabel("Health: "&$Health, 128, 288, 150, 17)
$GrMain = GUICtrlCreateGroup("", 0, 32, 121, 521)
$BMenu = GUICtrlCreateButton("Menu", 8, 512, 100, 33)
$BBattle = GUICtrlCreateButton("Battle", 8, 48, 100, 33)
$BShop = GUICtrlCreateButton("Shop", 8, 88, 100, 33)
$BInventory = GUICtrlCreateButton("Inventory", 8, 128, 100, 33)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$GrMai = GUICtrlCreateGroup("", 120, 32, 729, 521)
$LN = GUICtrlCreateLabel("Name:"&$Name, 128, 48, 150, 17)
$LR = GUICtrlCreateLabel("Race:"&$Race, 128, 72, 150, 17)
$LA = GUICtrlCreateLabel("Age:"&$Age, 128, 96, 75, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetOnEvent($GUI_EVENT_CLOSE, "Close")
GUICtrlSetOnEvent($BMenu, "Menu")
GUISetState()
EndFunc

Func load()
$sIniFile = FileOpenDialog("Select your character", @scriptdir, "Character (*.ini)")
If Not @error Then
$name = IniRead ($sIniFile, "Player", "Name", "Error")
$race = IniRead ($sIniFile, "Player", "Race", "Error")
$age = IniRead ($sIniFile, "Player", "Age", "Error")
$Gold = IniRead ($sIniFile, "Player", "Gold", "Error")
$Str = IniRead ($sIniFile, "Player", "Strength", "Error")
$Dex = IniRead ($sIniFile, "Player", "Dexterity", "Error")
$Vit = IniRead ($sIniFile, "Player", "Vitality", "Error")
$Health = IniRead ($sIniFile, "Player", "Health", "Error")
IniWrite (@ScriptDir & "\" & $name & ".ini" , "Player", "Health", $Health)
EndIf
EndFunc

Func save()
IniWrite (@ScriptDir & "\" & $name & ".ini" , "Player", "Name", $name)
IniWrite (@ScriptDir & "\" & $name & ".ini" , "Player", "Race", $race)
IniWrite (@ScriptDir & "\" & $name & ".ini" , "Player", "Age", $age)
IniWrite (@ScriptDir & "\" & $name & ".ini" , "Player", "Gold", $Gold)
IniWrite (@ScriptDir & "\" & $name & ".ini" , "Player", "Strength", $Str)
IniWrite (@ScriptDir & "\" & $name & ".ini" , "Player", "Dexterity", $Dex)
IniWrite (@ScriptDir & "\" & $name & ".ini" , "Player", "Vitality", $Vit)
IniWrite (@ScriptDir & "\" & $name & ".ini" , "Player", "Health", $Health)
EndFunc

Func start()
$Health = $Vit*10
guigame()
GUISetState($GStart, @SW_HIDE)
EndFunc

Func Close()
save()
Exit
EndFunc

Func name()
$Name = InputBox ("Name", "What is your name?","")
EndFunc

Func race()
$Race = InputBox ("Race", "What is your race "&$name&"?","")
EndFunc

Func age()
$Age = InputBox ("Age",$name& " what is your age?","")
EndFunc

Func menu()
GUIDelete($GGame)
EndFunc
Edited by satanttin
Link to comment
Share on other sites

Whenever you see in your code something like this

IniWrite($sIni, "section", "name", $sName)
IniWrite($sIni, "section", "class", $sClass)
IniWrite($sIni, "section", "race", $sRace)
IniWrite($sIni, "section", "sex", $sSex)
IniWrite($sIni, "section", "gold", $iGold)

It would be wise to put that block of code into a function

Case $cMenub
    _WriteData()
EndSwitch


Func _WriteData()
    IniWrite($sIni, "section", "name", $sName)
    IniWrite($sIni, "section", "class", $sClass)
    IniWrite($sIni, "section", "race", $sRace)
    IniWrite($sIni, "section", "sex", $sSex)
    IniWrite($sIni, "section", "gold", $iGold)
EndFunc

If you start structuring your code well to begin with, it will save you many headaches later.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

I like the idea... would it be similar to online quest type of games? So do you want to use just like pictures for now? Because if you're interested we could make this together. But instead we use a gaming engine and there are a few gaming engines I believe one could use(thanks to some bright autoit coders), as this would not require too much graphic designing and the terrain doesn't have to be huge.

[u]My dream is to have a dream...[/u]

Link to comment
Share on other sites

I think pictures could just work for now, as a base to get familiar with the environment that has to be created and the coding that goes with it...

We could even use small avi's, if a player has been awarded like a blade or something, the avi could be played...

It would be even better if we can get someone to help that has lots of experience in communications like tcp, then we could host a server and autoit users could play against one another. This will surely spark other coders to accomplish better...

Edited by acidman

[u]My dream is to have a dream...[/u]

Link to comment
Share on other sites

This game would be so easy to create using pictures it would even be better if 2 coders could be working together...

Here's my version of the script, just made a bit simpler...

It doesn't have as much parameters the user must specify, but it's just to play around with some ideas...

Global $Input

Global $charm, $Strength, $karma

Global $msg



Test1()

Func Test1()

$Input = InputBox("The Quest", "Please choose a usernmae")

If @error = 1 then

Exit

Else

IniWrite(@scriptdir & "\" & $input & ".ini", "Username", "ID", $input)

$Charm = Random(1, 10, 1)

$Strength = Random(1, 10, 1)

$Karma = Random(1, 10, 1)

$msg = Msgbox(0, "The dice has been Rolled", "Charm: " & $Charm & @CRLF & "Strength: " & $Strength & @crlf & "Karma: " & $Karma & @CRLF & "You have " & $charm + $Strength + $Karma & " points Out of 10000 Skill points" & @crlf & "Welcome to The Quest " & $input, 20)

Msgbox(0, "The Quest", "Welcome to the quest " & $input, 10)

EndIf

Exit

Endfunc

Now I am going to play a simple avi to welcome the user, next script will follow shortly.

Edited by acidman

[u]My dream is to have a dream...[/u]

Link to comment
Share on other sites

#include 

#include 

Global $hAVI

Global $Input

Global $charm, $Strength, $karma

Global $msg



Test1()

Func Test1()

$Input = InputBox("The Quest", "Please choose a usernmae")

If @error = 1 then

Exit

Else

IniWrite(@scriptdir & "\" & $input & ".ini", "Username", "ID", $input)

$Charm = Random(1, 10, 1)

$Strength = Random(1, 10, 1)

$Karma = Random(1, 10, 1)

$msg = Msgbox(0, "The dice has been Rolled", "Charm: " & $Charm & @CRLF & "Strength: " & $Strength & @crlf & "Karma: " & $Karma & @CRLF & "You have " & $charm + $Strength + $Karma & " points Out of 10000 Skill points" & @crlf & "Welcome to The Quest " & $input, 20)

$form1 = GUICreate("A welcome to the user", 300, 200)

$hAVI = GUICtrlCreateAvi(@scriptdir & "\Test.avi", 160, 10, 10)

GUISetState(@sw_show, $Form1)

Local $play = _GUICtrlAVI_Play($hAVI)

Sleep(5000)

_GUICtrlAVI_Close($play)

EndIf

Exit

Endfunc


While 1

Sleep(100)

WEnd

To make a battle system, mobs, Quests in other towns, pictures to keep for displaying of what

inventory you have is not that hard, basically nothing is hard, it's only as hard as you want it to be...

[u]My dream is to have a dream...[/u]

Link to comment
Share on other sites

  • Moderators

acidman,

That is now 4 posts in succession - I thought you were going to stop doing this? :huh:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

I like the idea... would it be similar to online quest type of games? So do you want to use just like pictures for now? Because if you're interested we could make this together. But instead we use a gaming engine and there are a few gaming engines I believe one could use(thanks to some bright autoit coders), as this would not require too much graphic designing and the terrain doesn't have to be huge.

no it wouldn't be like it. i mean maybe a little because the standard rpg text based game is always kinda similair but the quests is optional like in future i first want to script mobs battle shop and inventory and leveling/exp system when i done that would be a while cause i am a newb xD but that's when the questing part comes in. besides it's not an online game cause i wouldn't have a clue how to do that actually if i choose to do that would be after the questing part xD

and scripting together could be fun just i think u are better than me with scripting so i might not understand parts of the scripting u do :')

but if u still want it i don't mind doing that with you:) we can see how it goes and we can always stop working togehter or start our own version and chat with each other to compare things or scripts and help each other?

and we could use game engines like unity or udk or something like that but i guess i keep it to this game as my first one cause my knowless isn't that great so far:P

the .avi sounds great to show us some animations^^ i think i can ask some people on facebook to create some^^ and some icons or what not to make it more good looking:)

and the part u said about so autoiters can play together would be fun:P just hard to make i think xD

btw thanks for the posts i appreciate that^^

so if u want to script with me on this game then let me know:3

btw sorry for my bad english(i'm dutch)

Link to comment
Share on other sites

  • Moderators

satanttin,

No need to apologize - your English is fine. You might not get a reply for a couple of days though - acidman has been sent to the naughty step for a while by Jos. I hope he will be back afterwards though. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Developers

btw sorry for my bad english(i'm dutch)

.. en zelfs Nederlands is voor sommige geen probleem :)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Moderators

satanttin et al,

If you want to chat there is a forum section for that - please keep this thread roughly on topic. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Guys dont take offence. ik ben heel blij jullie allemaal leren elkaar zo goed kennen. Maar alsjeblieft willen we het onderwerp houden aan de topic, het gaat over een fundamentele speeleitjie. hehehehehehehehe

Edited by acidman

[u]My dream is to have a dream...[/u]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...