Author Topic: Zolarus Chripora - Pseudocode like code  (Read 3481 times)

Zefk

  • Hero Member
  • *****
  • Posts: 536
  • Just helping Solarus
    • View Profile
    • Zelzec
Zolarus Chripora - Pseudocode like code
« on: May 15, 2016, 06:11:07 am »
Zolarus Chripora

About:
I have only decided to start making the "Pseudocode like code" for now, but I will probably code it. No date decided. A small short game pack template with most needed scripts that I am "thinking" of making if I get time. Not really decided. The name is based on "Solarus Christopho." The name of the Engine and Creator. This project is suppose to be easy plug and go for those with little programming experience. Christopho has already made many of the needed scripts and the scripts can be found in the source code of his games.

Started Pseudocode:
5-16-16 (May 16, 2016)

Started some scripts:
8-25-16 (August 25, 2016)

Pseudocode:
What is Pseudocode like code? It is basically just an outline of the code. Normally easier to read and simplified. It will not function until programmed.

Currently working on:
14. Inventory system
14.5. Storage bag

--I will be delete Pseudocode as the working script is completed. No more will be made because I am experienced enough with Solarus to just script them now.
Scripts:
Scripts thinking of making for Zolarus Chripora: (I am posting this here to clean up the help guide project.)

10. Easy custom rain system (use multiple png images like rain drops, leaves, particle images, spores, flower, etc. I will be making this with opensource images.) - Pseudocode like code
11. Easy custom menu system  - Pseudocode like code
12. Rotating ARPG all in one menu
13. Easy custom crafting
14. Inventory system
14.5. Storage bag
15. Map location and the ability to teleport by picking places on the map
16. Deed karma system
17. Marriage system
18. Memory based Matching card Game
19. Black jack
20. Checker and maybe chess or shogi
21. Slot machine
22. Monster card game
23. Monster turnbased battle game
24. Coordinate grab script

Completed scripts for Zolarus script pack: (Many of the scripts will be modified to be shorter and have more customization options with arrays, but I will keep the older scripts here.)

New:
Advanced Number Input: Here
Advanced Digit Display: Here
Multiple Digit Display script: Here
New Bank Script: Here
Menu Dialog Display: Here
Character Input Script: Here
Pick Name Script: Here
Gallery Script: Here
Jam Station: Here (A Bug in the engine crashes the second page)
Time System Script: Here


Old:
-Volume Control script by Zefk: Here and the entire project: Here
-Input Number script by Zefk: Here
-Bank script: Here



Suggestions:
Thinking....many complicated scripts take full time....Ally AI, etc. Let me know of a good script to add.

Return to Solarus Resource Help Project

Zefk

  • Hero Member
  • *****
  • Posts: 536
  • Just helping Solarus
    • View Profile
    • Zelzec
Re: Zolarus Chripora - Pseudocode like code
« Reply #1 on: May 16, 2016, 10:06:11 am »
Custom Menu System - Pseudocode like code

About:
This is Pseudocode like code for a custom system. I am not all that good with Lua yet. Of course there will need to be changing for it to actually work. I am still adding to this.

Code: ( lua) [Select]
local  browse = 0
local  menu = false
local  item_button = false
local  skill_button = false
local  equipment_button = false
local  status_button = false
local  save_button = false
local  logout_button = false

local menu_img = sol.surface.create("Menu.png")
local item_button_img = sol.surface.create("Item Button.png")
local skill_button_img = sol.surface.create("Skill Button.png")
local equipment_button_img = sol.surface.create("Equipment Button.png")
local status_button_img = sol.surface.create("Status Button.png")
local save_button_img = sol.surface.create("Save Button.png")
local logout_button_img = sol.surface.create("Logout Button.png")

function sol.main:on_draw(screen)

--Display bottom layer menu

if command == "w"
then
     sol.audio.play_sound("menu/Menu Browse")
     menu = true
     if menu = true
     then
          menu_img:draw(screen)
     end
end   

--Down control for buttons

if command == "down"
then
     sol.audio.play_sound("menu/Menu Browse")
     if browse < 5
     then
          browse = browse + 1
     end
end

--up control for buttons

if command == "up"
then
     sol.audio.play_sound("menu/Menu Browse")
     if browse > 0
     then
          browse = browse -1
     end
end

--Showing buttons for going up and down
if browse == 0
then
     item_button = true
      if item_button = true
      then
           item_button_img:draw(screen)
     end
end

if browse == 1
then
     skill_button = true
     if skill_button = true
     then
          skill_button_img:draw(screen)
     end
end

if browse == 2
then
     equipment_button = true
     if equipment_button = true
     then
          equipment_button_img:draw(screen)
     end
end

if browse == 3
then
     status_button = true
     if status_button = true
     then
          status_button_img:draw(screen)
     end
end

if browse == 4
then
     save_button = true
     if save_button = true
     then
          save_button_img:draw(screen)
     end
end

if browse == 5
then
     logout_button = true
     if logout_button = true
     then
          logout_button_img:draw(screen)
     end
end

--Exit Menu

if command == "EXC and or X"
then
     sol.audio.play_sound("menu/Menu click")
     browse = 0
     menu = false
     item_button = false
     skill_button = false
     equipment_button = false
     status_button = false
     save_button = false
     logout_button = false
   
end

--Activate or call the menus from the buttons (change it an elseif)

if command == "Z"
then
     sol.audio.play_sound("menu/Menu click")
     if browse == 0
     then
     require("scripts.Item")
     item();
     end
     if browse == 1
     then
     require("scripts.Skill")
     skill();
     end
     if browse == 2
     then
     require("scripts.Equipment")
     equipment();
     end
     if browse == 3
     then
     require("scripts.Status")
     status();
     end
     if browse == 4
     then
     require("scripts.Save")
     save();
     end
     if browse == 5
     then
     require("scripts.Logout")
     logout();
     end

end   
   
end
end

Item.lua

Skill.lua

Equipment.lua

Status.lua

Save.lua

Logout.lua


     

Zefk

  • Hero Member
  • *****
  • Posts: 536
  • Just helping Solarus
    • View Profile
    • Zelzec
Re: Zolarus Chripora - Pseudocode like code
« Reply #2 on: May 19, 2016, 08:04:45 am »
Easy custom rain system - Pseudocode like code

About:
You can use multiple png images like rain drops, leaves, particle images, spores, flower, etc. I will be making this with opensource images. Understand this is Pseudocode like code and it will not be functional yet. I am still adding to this.

Timer.lua
Code: ( lua) [Select]
--Move these locals to type 1-4 scripts and finish them.
local type_one = false
local type_two = false
local type_three = false
local type_four = false

--Require scripts to work
require("scripts.Type1") 
require("scripts.Type2")
require("scripts.Type3")
require("scripts.Type4")

--Activate scripts
first();
second();
third();
fourth();

--Nest this loop, so it can be stopped
--Rain timer cycle
while( true ) do
 
 rain_seconds = rain_seconds + 1
 if rain_seconds == 1
 then
     rain_seconds = 2
     rain_seconds = 3
     rain_seconds = 4
     rain_seconds = 5
     rain_seconds = 6
     rain_seconds = 7
     rain_seconds = 8
     rain_seconds = 1
     rain_seconds = 0
  end
end



Type1.lua
Code: ( lua) [Select]
-- Easy custom rain system
-- Can be use for more than rain. Ex: spores, snow, magic paticles, ect.
-- Requires rain timer.lua

local rain_type_one = false
local rain_type_two = false
local rain_type_three = false
local rain_type_four = false

--Eight frames for rain pattern one
local type_one_rain_frame_one = false
local type_one_rain_frame_two = false
local type_one_rain_frame_three = false
local type_one_rain_frame_four = false
local type_one_rain_frame_five = false
local type_one_rain_frame_six = false
local type_one_rain_frame_seven = false
local type_one_rain_frame_eight = false

--load the eight(8) frames for type one pattern.
local type_one_rain_frame_one_img = sol.surface.create("p1-1.png")
local type_one_rain_frame_two_img = sol.surface.create("p1-2.png")
local type_one_rain_frame_three_img = sol.surface.create("p1-3.png")
local type_one_rain_frame_four_img = sol.surface.create("p1-4.png")
local type_one_rain_frame_five_img = sol.surface.create("p1-5.png")
local type_one_rain_frame_six_img = sol.surface.create("p1-6.png")
local type_one_rain_frame_seven_img = sol.surface.create("p1-7.png")
local type_one_rain_frame_eight_img = sol.surface.create("p1-8.png")

--show and remove images one after another for type 1.
if rain_seconds >=1
then
    type_one_rain_frame_one = true
    type_one_rain_frame_one_img:draw(screen)
    if rain_seconds >=2
    then
        type_one_rain_frame_one = false
        type_one_rain_frame_two = true
        type_one_rain_frame_two_img:draw(screen)
        if rain_seconds >=3
        then
            type_one_rain_frame_two = false
            type_one_rain_frame_three = true
            type_one_rain_frame_three_img:draw(screen)
            if rain_seconds >=4
            then
                type_one_rain_frame_three = false
                type_one_rain_frame_four = true
                type_one_rain_frame_four_img:draw(screen)
                if rain_seconds >=5
                then
                    type_one_rain_frame_four = false
                    type_one_rain_frame_five = true
                    type_one_rain_frame_five_img:draw(screen)
                    if rain_seconds >=6
                    then
                        type_one_rain_frame_five = false
                        type_one_rain_frame_six = true
                        type_one_rain_frame_six_img:draw(screen)
                        if rain_seconds >=7
                        then
                            type_one_rain_frame_six = false
                            type_one_rain_frame_seven = true
                            type_one_rain_frame_seven_img:draw(screen)
                            if rain_seconds >=8
                            then
                               type_one_rain_frame_seven = false
                               type_one_rain_frame_eight= true
                               type_one_rain_frame_eight_img:draw(screen)
                           end
                        end
                     end
                  end
               end
            end
         end
      end
   end
end



Type2.lua
Code: ( lua) [Select]
--Eight frames for rain pattern two
local type_two_rain_frame_one = false
local type_two_rain_frame_two = false
local type_two_rain_frame_three = false
local type_two_rain_frame_four = false
local type_two_rain_frame_five = false
local type_two_rain_frame_six = false
local type_two_rain_frame_seven = false
local type_two_rain_frame_eight = false

--load the eight(8) frames for type 2 pattern.
local type_two_rain_frame_one_img = sol.surface.create("p2-1.png")
local type_two_rain_frame_two_img = sol.surface.create("p2-2.png")
local type_two_rain_frame_three_img = sol.surface.create("p2-3.png")
local type_two_rain_frame_four_img = sol.surface.create("p2-4.png")
local type_two_rain_frame_five_img = sol.surface.create("p2-5.png")
local type_two_rain_frame_six_img = sol.surface.create("p2-6.png")
local type_two_rain_frame_seven_img = sol.surface.create("p2-7.png")
local type_two_rain_frame_eight_img = sol.surface.create("p2-8.png")

--show and remove images one after another for type 2.
if rain_seconds >=1
then
    type_two_rain_frame_one = true
    type_two_rain_frame_one_img:draw(screen)
    if rain_seconds >=2
    then
        type_two_rain_frame_one = false
        type_two_rain_frame_two = true
        type_two_rain_frame_two_img:draw(screen)
        if rain_seconds >=3
        then
            type_two_rain_frame_two = false
            type_two_rain_frame_three = true
            type_two_rain_frame_three_img:draw(screen)
            if rain_seconds >=4
            then
                type_two_rain_frame_three = false
                type_two_rain_frame_four = true
                type_two_rain_frame_four_img:draw(screen)
                if rain_seconds >=5
                then
                    type_two_rain_frame_four = false
                    type_two_rain_frame_five = true
                    type_two_rain_frame_five_img:draw(screen)
                    if rain_seconds >=6
                    then
                        type_two_rain_frame_five = false
                        type_two_rain_frame_six = true
                        type_two_rain_frame_six_img:draw(screen)
                        if rain_seconds >=7
                        then
                            type_two_rain_frame_six = false
                            type_two_rain_frame_seven = true
                            type_two_rain_frame_seven_img:draw(screen)
                            if rain_seconds >=8
                            then
                               type_two_rain_frame_seven = false
                               type_two_rain_frame_eight= true
                               type_two_rain_frame_eight_img:draw(screen)
                           end
                        end
                     end
                  end
               end
            end
         end
      end
   end
end



Type3.lua
Code: ( lua) [Select]
--Eight frames for rain pattern three
local type_three_rain_frame_one = false
local type_three_rain_frame_two = false
local type_three_rain_frame_three = false
local type_three_rain_frame_four = false
local type_three_rain_frame_five = false
local type_three_rain_frame_six = false
local type_three_rain_frame_seven = false
local type_three_rain_frame_eight = false



--load the eight(8) frames for type 3 pattern.
local type_three_rain_frame_one_img = sol.surface.create("p3-1.png")
local type_three_rain_frame_two_img = sol.surface.create("p3-2.png")
local type_three_rain_frame_three_img = sol.surface.create("p3-3.png")
local type_three_rain_frame_four_img = sol.surface.create("p3-4.png")
local type_three_rain_frame_five_img = sol.surface.create("p3-5.png")
local type_three_rain_frame_six_img = sol.surface.create("p3-6.png")
local type_three_rain_frame_seven_img = sol.surface.create("p3-7.png")
local type_three_rain_frame_eight_img = sol.surface.create("p3-8.png")

--show and remove images one after another for type 3.
if rain_seconds >=1
then
    type_three_rain_frame_one = true
    type_three_rain_frame_one_img:draw(screen)
    if rain_seconds >=2
    then
        type_three_rain_frame_one = false
        type_three_rain_frame_two = true
        type_three_rain_frame_two_img:draw(screen)
        if rain_seconds >=3
        then
            type_three_rain_frame_two = false
            type_three_rain_frame_three = true
            type_three_rain_frame_three_img:draw(screen)
            if rain_seconds >=4
            then
                type_three_rain_frame_three = false
                type_three_rain_frame_four = true
                type_three_rain_frame_four_img:draw(screen)
                if rain_seconds >=5
                then
                    type_three_rain_frame_four = false
                    type_three_rain_frame_five = true
                    type_three_rain_frame_five_img:draw(screen)
                    if rain_seconds >=6
                    then
                        type_three_rain_frame_five = false
                        type_three_rain_frame_six = true
                        type_three_rain_frame_six_img:draw(screen)
                        if rain_seconds >=7
                        then
                            type_three_rain_frame_six = false
                            type_three_rain_frame_seven = true
                            type_three_rain_frame_seven_img:draw(screen)
                            if rain_seconds >=8
                            then
                                type_three_rain_frame_seven = false
                                type_three_rain_frame_eight= true
                                type_three_rain_frame_eight_img:draw(screen)
                           end
                        end
                     end
                  end
               end
            end
         end
      end
   end
end



Type4.lua
Code: ( lua) [Select]
--Eight frames for rain pattern four
local type_four_rain_frame_one = false
local type_four_rain_frame_two = false
local type_four_rain_frame_three = false
local type_four_rain_frame_four = false
local type_four_rain_frame_five = false
local type_four_rain_frame_six = false
local type_four_rain_frame_seven = false
local type_four_rain_frame_eight = false


--load the eight(8) frames for type 4 pattern.
local type_four_rain_frame_one_img = sol.surface.create("p4-1.png")
local type_four_rain_frame_two_img = sol.surface.create("p4-2.png")
local type_four_rain_frame_three_img = sol.surface.create("p4-3.png")
local type_four_rain_frame_four_img = sol.surface.create("p4-4.png")
local type_four_rain_frame_five_img = sol.surface.create("p4-5.png")
local type_four_rain_frame_six_img = sol.surface.create("p4-6.png")
local type_four_rain_frame_seven_img = sol.surface.create("p4-7.png")
local type_four_rain_frame_eight_img = sol.surface.create("p4-8.png")

--show and remove images one after another for type 4.
if rain_seconds >=1
then
    type_four_rain_frame_one = true
    type_four_rain_frame_one_img:draw(screen)
    if rain_seconds >=2
    then
        type_four_rain_frame_one = false
        type_four_rain_frame_two = true
        type_four_rain_frame_two_img:draw(screen)
        if rain_seconds >=3
        then
            type_four_rain_frame_two = false
            type_four_rain_frame_three = true
            type_four_rain_frame_three_img:draw(screen)
            if rain_seconds >=4
            then
                type_four_rain_frame_three = false
                type_four_rain_frame_four = true
                type_four_rain_frame_four_img:draw(screen)
                if rain_seconds >=5
                then
                    type_four_rain_frame_four = false
                    type_four_rain_frame_five = true
                    type_four_rain_frame_five_img:draw(screen)
                    if rain_seconds >=6
                    then
                        type_four_rain_frame_five = false
                        type_four_rain_frame_six = true
                        type_four_rain_frame_six_img:draw(screen)
                        if rain_seconds >=7
                        then
                            type_four_rain_frame_six = false
                            type_four_rain_frame_seven = true
                            type_four_rain_frame_seven_img:draw(screen)
                            if rain_seconds >=8
                            then
                                type_four_rain_frame_seven = false
                                type_four_rain_frame_eight= true
                                type_four_rain_frame_eight_img:draw(screen)
                           end
                        end
                     end
                  end
               end
            end
         end
      end
   end
end



20degree

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
    • Sylvain Personnal Website
Re: Zolarus Chripora - Pseudocode like code
« Reply #3 on: September 12, 2016, 10:41:59 am »
Here is an example of code for the current time of the computer for the software futurepinball.

1st there is a timer component: 1 timer = 1000ms (micro seconds) = 1 second
Code: [Select]
' *****************************************************************
' ***** This display the current time and date in the HudDmd ******
' *****************************************************************

Sub DmdDate_Expired()
DmdDate.Enabled = False

Dim CurrentDateTime
Dim CurrentYear
Dim CurrentMonth
Dim CurrentDay
Dim CurrentHour
Dim CurrentMinute
Dim CurrentSecond

CurrentDateTime = Now()

CurrentYear = Year(CurrentDateTime)
CurrentMonth = Month(CurrentDateTime)
CurrentDay = Day(CurrentDateTime)
CurrentHour = Hour(CurrentDateTime)
CurrentMinute = Minute(CurrentDateTime)
CurrentSecond = Second(CurrentDateTime)

If (CurrentMonth = 1) Then
CurrentMonth = "JANUARY"
ElseIf (CurrentMonth = 2) Then
CurrentMonth = "FEBRUARY"
ElseIf (CurrentMonth = 3) Then
CurrentMonth = "MARCH"
ElseIf (CurrentMonth = 4) Then
CurrentMonth = "APRIL"
ElseIf (CurrentMonth = 5) Then
CurrentMonth = "MAY"
ElseIf (CurrentMonth = 6) Then
CurrentMonth = "JUNE"
ElseIf (CurrentMonth = 7) Then
CurrentMonth = "JULY"
ElseIf (CurrentMonth = 8) Then
CurrentMonth = "AUGUST"
ElseIf (CurrentMonth = 9) Then
CurrentMonth = "SEPTEMBER"
ElseIf (CurrentMonth = 10) Then
CurrentMonth = "OCTOBER"
ElseIf (CurrentMonth = 11) Then
CurrentMonth = "NOVEMBER"
ElseIf (CurrentMonth = 12) Then
CurrentMonth = "DECEMBER"
End If

If (CurrentHour = 0) Then
CurrentHour ="00"
ElseIf (CurrentHour = 1) Then
CurrentHour = "01"
ElseIf (CurrentHour = 2) Then
CurrentHour = "02"
ElseIf (CurrentHour = 3) Then
CurrentHour = "03"
ElseIf (CurrentHour = 4) Then
CurrentHour = "04"
ElseIf (CurrentHour = 5) Then
CurrentHour = "05"
ElseIf (CurrentHour = 6) Then
CurrentHour = "06"
ElseIf (CurrentHour = 7) Then
CurrentHour = "07"
ElseIf (CurrentHour = 8) Then
CurrentHour = "08"
ElseIf (CurrentHour = 9) Then
CurrentHour = "09"
Else
CurrentHour = CurrentHour
End If

If (CurrentMinute = 0) Then
CurrentMinute ="00"
ElseIf (CurrentMinute = 1) Then
CurrentMinute = "01"
ElseIf (CurrentMinute = 2) Then
CurrentMinute = "02"
ElseIf (CurrentMinute = 3) Then
CurrentMinute = "03"
ElseIf (CurrentMinute = 4) Then
CurrentMinute = "04"
ElseIf (CurrentMinute = 5) Then
CurrentMinute = "05"
ElseIf (CurrentMinute = 6) Then
CurrentMinute = "06"
ElseIf (CurrentMinute = 7) Then
CurrentMinute = "07"
ElseIf (CurrentMinute = 8) Then
CurrentMinute = "08"
ElseIf (CurrentMinute = 9) Then
CurrentMinute = "09"
Else
CurrentMinute = CurrentMinute
End If

If (CurrentSecond = 0) Then
CurrentSecond = "00"
ElseIf (CurrentSecond = 1) Then
CurrentSecond = "01"
ElseIf (CurrentSecond = 2) Then
CurrentSecond = "02"
ElseIf (CurrentSecond = 3) Then
CurrentSecond ="03"
ElseIf (CurrentSecond = 4) Then
CurrentSecond = "04"
ElseIf (CurrentSecond = 5) Then
CurrentSecond = "05"
ElseIf (CurrentSecond = 6) Then
CurrentSecond = "06"
ElseIf (CurrentSecond = 7) Then
CurrentSecond = "07"
ElseIf (CurrentSecond = 8) Then
CurrentSecond = "08"
ElseIf (CurrentSecond = 9) Then
CurrentSecond = "09"
ElseIf (CurrentSecond = 55) Then
DmdDate.Enabled = False
Else
CurrentSecond = CurrentSecond
End If

DmdShowDate.FlushQueue()
DmdShowDate.FlushAnimation()
DmdShowDate.QueueText "[y1][f3]" &CurrentHour& "H " &CurrentMinute& "M " &CurrentSecond& "[y11]" &CurrentMonth& " " &CurrentDay& "[y21]" &CurrentYear

DmdDate.Interval = 1000
DmdDate.Enabled = True
End Sub
The object named: DmdShowDate, is some dmd (dot matrix display) object. If you wonder what is: [y1][f3]? There are simply some coordinations and font type for the dmd.

I know it's not LUA, but there are month's that have 5 weeks if you want to show the current time of the computer.

A+

Zefk

  • Hero Member
  • *****
  • Posts: 536
  • Just helping Solarus
    • View Profile
    • Zelzec
Re: Zolarus Chripora - Pseudocode like code
« Reply #4 on: September 13, 2016, 03:22:05 am »
None of the code posted here will work without quite a bit of tweaking, so I do not mind that it is not related to Lua.

Zefk

  • Hero Member
  • *****
  • Posts: 536
  • Just helping Solarus
    • View Profile
    • Zelzec
Re: Zolarus Chripora - Pseudocode like code
« Reply #5 on: September 15, 2016, 11:34:51 am »
Input number script completed:

I made this input script because I need it for a bank script I am working on.
Download

I will probably update it later, but it is functional.

YouTube Video: (Sorry for the blur. This is YouTube's fault. My video is super clear.)
https://youtu.be/orWRphRfncw