user input on 3x3 tic tac toe board?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
bluebirdaerie
Newbie
Posts: 4
Joined: Fri Aug 29, 2014 4:24 pm
Organization: Ambushed Gamer, GamingforAdoption, Indiegamestand
Tumblr: bluebirdplays
Skype: live:bluetweets
Location: USA
Contact:

user input on 3x3 tic tac toe board?

#1 Post by bluebirdaerie » Sun Feb 09, 2020 10:34 pm

Hi, I'm quite new to programming with Ren'py but am working on a to-do 'game' where the user inputs what they want to do on each square of a tic tac toe grid. Once entered, the game will randomly select what the user should do next.

I know the baseline of what I need is all in just having the player input data that the game will save, and I've been able to do the basic - "Name your character"! Code,

But I'm not sure how to approach this big chunk.

I think the easier method would be to allow the user to input their tasks in the text box, separately for each one. Each line becomes its own variable which will be randomly placed on the tic tac toe board.

That's where I'm kinda stuck, I'm not sure how to show this on the screen, on a board. I know it's gotta do with making a frame but that's about it. If anyone can steer me towards similar codes or even offer a mockup I could work with, I'd appreciate it!

User avatar
Per K Grok
Miko-Class Veteran
Posts: 673
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1
Projects: Defenders of Adacan Part 2
itch: per-k-grok
Location: Sverige
Contact:

Re: user input on 3x3 tic tac toe board?

#2 Post by Per K Grok » Mon Feb 10, 2020 1:22 pm

bluebirdaerie wrote:
Sun Feb 09, 2020 10:34 pm
Hi, I'm quite new to programming with Ren'py but am working on a to-do 'game' where the user inputs what they want to do on each square of a tic tac toe grid. Once entered, the game will randomly select what the user should do next.

I know the baseline of what I need is all in just having the player input data that the game will save, and I've been able to do the basic - "Name your character"! Code,

But I'm not sure how to approach this big chunk.

I think the easier method would be to allow the user to input their tasks in the text box, separately for each one. Each line becomes its own variable which will be randomly placed on the tic tac toe board.

That's where I'm kinda stuck, I'm not sure how to show this on the screen, on a board. I know it's gotta do with making a frame but that's about it. If anyone can steer me towards similar codes or even offer a mockup I could work with, I'd appreciate it!
I think you need to explain what it is you want to do a bit more clearly.

What I'm getting is that the player can make text inputs that are randomly placed on a board that is divided in 3x3 squares. As I understand it Tic, tac, toe has nothing to do with this, except for the shape of the board.

If that is correctly understood it might help if you explained a bit further what the purpose of this is.

If it is not correctly understood it might help if you explain what it is actually meant.

User avatar
bluebirdaerie
Newbie
Posts: 4
Joined: Fri Aug 29, 2014 4:24 pm
Organization: Ambushed Gamer, GamingforAdoption, Indiegamestand
Tumblr: bluebirdplays
Skype: live:bluetweets
Location: USA
Contact:

Re: user input on 3x3 tic tac toe board?

#3 Post by bluebirdaerie » Tue Feb 11, 2020 11:07 pm

Basically, I want for the player to make 9 different text inputs before being presented with a screen that has randomly assigned those variables to spaces on the board.

When the player completes the variable in the game, the area where said variable was located will be crossed out.

So as an example:

I'm making a board for building habits.
As an artist, I want to spend time drawing more.
I input my projects + time I want to spend on it.

Draw 1 Minute
Draw 2 Minutes
Draw 3 Minutes
Draw 4 Minutes
Draw 5 Minutes
Draw 6 Minutes
Draw 7 Minutes
Draw 8 Minutes
Draw 9 Minutes

These inputs become variables that are then randomly placed on a 3x3 square and each will be crossed out when I've completed 'said task for that amount of time.

That's pretty much the gist of it, I just don't know where to get started on how to properly code what I envision.

User avatar
Per K Grok
Miko-Class Veteran
Posts: 673
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1
Projects: Defenders of Adacan Part 2
itch: per-k-grok
Location: Sverige
Contact:

Re: user input on 3x3 tic tac toe board?

#4 Post by Per K Grok » Wed Feb 12, 2020 1:21 pm

bluebirdaerie wrote:
Tue Feb 11, 2020 11:07 pm
Basically, I want for the player to make 9 different text inputs before being presented with a screen that has randomly assigned those variables to spaces on the board.

-----
OK, I'm still unsure where you are going with this, but I can give you something to start with. The code below will let you enter 9 tasks and then displace those tasks in a random order on a 3x3 board.

Code: Select all


default v0="0"
default x=0
default numb=1

default list1=["v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9"]
default list2=[]


screen tictac():

     grid 3 3:
         text list2[0]
         text list2[1]
         text list2[2]

         text list2[3]
         text list2[4]
         text list2[5]

         text list2[6]
         text list2[7]
         text list2[8]



label start:

    $ v0= renpy.input("Enter task [numb]")    ## enter tasks
    $ list1[numb-1]=v0
    $numb+=1
    if numb<10:
        jump start

label tic:

    while x<9:                                                               ##make the order random
        $ numb= renpy.random.randint(0, len(list1)-1)  
        $ v0= list1.pop(numb)
        $ list2.append(v0)
        $ x +=1

    show screen tictac

    pause



Where you want to go with this I still don't get.

User avatar
bluebirdaerie
Newbie
Posts: 4
Joined: Fri Aug 29, 2014 4:24 pm
Organization: Ambushed Gamer, GamingforAdoption, Indiegamestand
Tumblr: bluebirdplays
Skype: live:bluetweets
Location: USA
Contact:

Re: user input on 3x3 tic tac toe board?

#5 Post by bluebirdaerie » Sat Feb 15, 2020 2:51 pm

Thank you, this is a good start :)

Post Reply

Who is online

Users browsing this forum: Google [Bot], Imperf3kt, rayminator