+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12

Thread: Console screens help

  1. #1
    Lifetime Supporter
    Nikita will become famous soon enough Nikita's Avatar
    Join Date
    May 2009
    Posts
    676

    Unhappy Console screens help

    Although I know how console screens work, I failed at every attempt to make them work. Either there would be extra spaces, or double characters, or XY of the char randomly changing, or nothing displaying, or even my text appearing backwards!

    I know this isn't a place where people would do your work for you, but could someone please show me the right way to make an expression2 connecting a keyboard and a console screen? So that what you type appears on the screen, rows automatically change, enter and backspace keys work as intended?

  2. #2
    Wire Sofaking SpectreCat will become famous soon enough SpectreCat's Avatar
    Join Date
    Mar 2008
    Location
    Snoqualmie, Washington
    Posts
    508

    Default Re: Console screens help

    Here is how I usually do it

    if(KeyBoard & ~KeyBoard) {String += toChar(KeyBoard)}
    S:writeString(String,0,2,90)
    Last edited by SpectreCat; 07-09-2009 at 09:38 PM.

    New to the E2? Try my Tutorial:
    A Beginners Guide to Expression 2



    ***Please send a PM before you add me to friends***

    Quote Originally Posted by chinoto View Post
    E2 is not complicated, but many of the people who use it do complicated things with it.

  3. #3
    Wire Sofaking Officer Tibbles has a spectacular aura about Officer Tibbles has a spectacular aura about Officer Tibbles has a spectacular aura about Officer Tibbles's Avatar
    Join Date
    Aug 2008
    Location
    Barnus Philbert Boulevard
    Posts
    813

    Default Re: Console screens help

    That always adds spaces between the characters whenever I do that.

    :|

  4. #4
    Wirezard

    Matte is just really nice Matte is just really nice Matte is just really nice Matte is just really nice Matte is just really nice Matte's Avatar
    Join Date
    Jan 2009
    Location
    Norway
    Posts
    3,151

    Default Re: Console screens help

    Code:
    S:writeCell(Cell+1,1000999)
    if(~Mem&Mem&Mem<127&Mem>31){
    S:writeCell(Cell,Mem)
    S:writeCell(Cell+1,999)
    Cell+=2
    if(Cell>=958){
    S:writeCell(2038,1)
    S:writeCell(2046,1)
    Cell = 900
    }
    }
    
    This is what I basically use. It uses memory cells, and only writes if it's a writable character (127 > writable chars > 31). Also if you write to the second to last line, it scrolls the text upwards. I have not taken enter and backspace into account here, I just posted this example to give you the general idea of how it's usually done. This is not tested, but it should work.
    "If anybody says he can think about quantum physics without getting giddy, that only shows he has not understood the first thing about them."
    -- Niels Bohr


    Wire FPGA

  5. #5
    I think I think too much

    -HP- has a spectacular aura about -HP- has a spectacular aura about -HP- has a spectacular aura about -HP-'s Avatar
    Join Date
    Feb 2009
    Location
    Behind you with a very sharp knife.
    Posts
    2,239

    Default Re: Console screens help

    Here's mine. It allows you to backspace, enter, and hold down keys.

    Code:
    @name Console Screen Writer, by -HP-
    @inputs Keyboard Scr:wirelink
    @persist String:string X Y LineLength:array Timer:string
    
    if (first()) {
        X = 0
        Y = 0
        Scr:setNumber("Clk",1)
        Scr:setNumber("Reset",1)
        LineLength = array()
    }
    
    if (clk(toChar(Keyboard))) {
        timer(toChar(Keyboard),100)
        Timer = toChar(Keyboard)
    } elseif (~Keyboard) {
        stoptimer(Timer)
        timer(toChar(Keyboard),500)
        Timer = toChar(Keyboard)
    }
    
    if (clk(toChar(Keyboard)) | ~Keyboard) {
        if (Keyboard >= 32 & Keyboard <= 126) {
            if (X == 29 & Y == 17) { exit() }
            Scr:writeString(toChar(Keyboard),X,Y)
            X++
            LineLength:setNumber(Y,X)
            if (X == 30) {
                Scr:writeString(" ",X,Y,0,0,0)
                X = 0
                Y++
            }
            String = String + toChar(Keyboard)
        }
        
        if (Keyboard == 13) {
            Scr:writeString(" ",X,Y,0,0,0)
            Y++
            X = 0
            String = String + " "
        }
        
        if (Keyboard == 127) {
            Scr:writeString(" ",X,Y)
            if (X == 0 & Y > 0) {
                Y--
                X = LineLength:number(Y)
            } elseif (X > 0) {
                X--
                LineLength:setNumber(Y,X)
            }
            Scr:writeString(" ",X,Y)
            String = String:sub(1,String:length()-1)
        }
    }
    Scr:writeString(" ",X,Y,999,0,1)
    

    if you sign up using my link you get extra space!

    also this

  6. #6
    Wirererer warrior08 is on a distinguished road warrior08's Avatar
    Join Date
    Feb 2009
    Posts
    210

    Default Re: Console screens help

    Hy, a simple example

    Code:
    @name Console screen simple
    @inputs Button
    @outputs 
    @persist
    @trigger all
    
    runOnTick(1)
    
    if(Button){Screen:writeString("Hello world!",1,0,999)}
    



    Ps: Screen:writeString("..Text.."),Enable/Disable (1/0),Line,color

    good bye
    Last edited by warrior08; 07-10-2009 at 05:50 AM.

  7. #7
    Lifetime Supporter
    Nikita will become famous soon enough Nikita's Avatar
    Join Date
    May 2009
    Posts
    676

    Default Re: Console screens help

    Quote Originally Posted by -HP- View Post
    Here's mine. It allows you to backspace, enter, and hold down keys.
    Awesome! This works perfectly. Up to this moment I didn't even know there was scr:writeString function! Despite re-reading E2 wiki many times...
    Do you mind if I use this in my projects? Or should I make my own?

  8. #8
    Wirererer warrior08 is on a distinguished road warrior08's Avatar
    Join Date
    Feb 2009
    Posts
    210

    Default Re: Console screens help



    no problem

  9. #9
    I think I think too much

    -HP- has a spectacular aura about -HP- has a spectacular aura about -HP- has a spectacular aura about -HP-'s Avatar
    Join Date
    Feb 2009
    Location
    Behind you with a very sharp knife.
    Posts
    2,239

    Default Re: Console screens help

    Quote Originally Posted by Nikita View Post
    Awesome! This works perfectly. Up to this moment I didn't even know there was scr:writeString function! Despite re-reading E2 wiki many times...
    Do you mind if I use this in my projects? Or should I make my own?
    I don't mind if you use this in your projects, just make a tiny comment saying "Using -HP-'s Console Screen Writing system" or something like that

    Also I should be improving this, I'll PM you with a better version.

    Quote Originally Posted by warrior08 View Post


    no problem

    if you sign up using my link you get extra space!

    also this

  10. #10
    Wire Sofaking Donkie is on a distinguished road Donkie's Avatar
    Join Date
    May 2008
    Location
    Sweden
    Posts
    1,181

    Default Re: Console screens help

    Warrior fails extremly :P Also what the heck is that memory thing? -.-
    Hurr

+ Reply to Thread
Page 1 of 2 1 2 LastLast

Similar Threads

  1. Console Screens & strings
    By AndyDLP in forum Technical Support
    Replies: 14
    Last Post: 06-14-2009, 11:18 AM
  2. I cant see Screens
    By samwilki in forum Technical Support
    Replies: 3
    Last Post: 10-21-2008, 09:25 PM
  3. More Variety for Screens
    By -=Fox=- in forum Ideas & Suggestions
    Replies: 8
    Last Post: 04-11-2008, 03:56 PM
  4. Screens
    By Hysteria100 in forum Ideas & Suggestions
    Replies: 8
    Last Post: 02-26-2008, 10:10 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
proceed-collector
proceed-collector
proceed-collector
proceed-collector
linguistic-parrots
linguistic-parrots
linguistic-parrots
linguistic-parrots