Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Oct 20 22:59
    @dockimbel banned @SmackMacDougal
  • Dec 03 2017 05:53
    @PeterWAWood banned @matrixbot
  • Sep 28 2016 12:19
    @PeterWAWood banned @TimeSeriesLord
  • Aug 13 2016 03:23
    @PeterWAWood banned @Vexercizer
GiuseppeChillemi
@GiuseppeChillemi
Ok, so we are parsing a block instead of text
nedzadarek
@nedzadarek
@lepinekong_twitter as fair I remember, he said to check help for while and if. You can see that if takes cond [any-type!] and while, cond [block!].
If you are new (or used different languages) you may be confused about usage of () and []. An expression inside() is evaluated (e.g. a: ( 1 + 2) a; 3) and an expression inside [] is not evaluated (not sure if this is proper term). So you should use () for grouping code to run it immediately. You should use [] to pass some code/data.
ps. helps for both functions are wrong about true. It should be "true-thy value" or something like this.
ps2. I was very succinct about this description - I could miss something. I just didn't want to confuse you with unnecessary things.
Toomas Vooglaid
@toomasv
@GiuseppeChillemi You are welcome! :smile:
GiuseppeChillemi
@GiuseppeChillemi
This message was deleted
I have a VIEW button which uses as DATA an "area" name, referencing the whole object ( @toomasv , yes, it is based on your code). If I define the area BEFORE the button in the VID BLOCK, everything works fine. If I define it AFTER the word is undefinied at runtime. Is it correct ?
Vladimir Vasilyev
@9214
@GiuseppeChillemi you can't directly reference something that doesn't yet exist.
view [
    b: button extra 'a [probe get in get face/extra 'text]
    a: area "this is an area text"
]
GiuseppeChillemi
@GiuseppeChillemi
@9214 Being a dialect it is different than the main program code loading...
Vladimir Vasilyev
@9214
@GiuseppeChillemi not really.
GiuseppeChillemi
@GiuseppeChillemi
I am used to define object at the botton of the code and being able to access it since the very first lines...
@9214 I could understand this but changes the coding schemas you have in mind.
Vladimir Vasilyev
@9214
@GiuseppeChillemi you can't do that directly, without storing referring words in a block or using lit-word!s instead.
GiuseppeChillemi
@GiuseppeChillemi
It is beacuse all objects are created and you can reference them ?
*is it beacuse all objects have already been created and you can reference them all ?
Vladimir Vasilyev
@9214
As I said, you can't reference something that doesn't exist.
Palaing
@Palaing
I needed replace/all which is not in Red's version of replace, I tried Rebol's version (got from source replace), it works great, and it even allows to give a function as third argument. Any reason why this is not integrated in Red ?
Vladimir Vasilyev
@9214
@Palaing red/REP#18
Palaing
@Palaing
@9214 Oh yes thanks. Now I will know where to make such remarks :)
GiuseppeChillemi
@GiuseppeChillemi

@9214 A simple "" made me crazy....
I have a bunch of dynamically created buttons
Their face/data content refer to dynamically created areas objects

    foreach [tag name] buttons [
        keep compose [
            (to set-word! name) area 300x50 (copy "") wrap
      ]
    ]

The function executed when I hit one of the buttons pass the face/data, which is <areaname> ,and then I print <areaname>/text....

I always had the same printed result despite the button I hit....

Four hours to discover that tiny "" had to be changed to (copy "") !

nedzadarek
@nedzadarek

Does anyone knows the Logo? You can play with it here.
I want to mimic Logo's functionality. What I need is to keep a) current pen position and b) rotation. shape sub-dialect keeps pen position but it does not know about rotation. I have found out that I can rotate over some point (rotate <degree> <point>). However I am rotating using values computed by me. Here is an example. I want to draw square.
The Logo code:

; just so we can start as Red's shape
right 90 

forward 40
right 90
forward 40
right 90
forward 40
right 90
forward 40

and here is the Red's code:

view [base 300x300 red draw [

  shape [ move 100x100 ]
  shape [ 'line 40x0 ] 

  rotate 90 140x100
  shape ['line 40x0]

  rotate 90 180x100
  shape ['line 40x0 ]

  rotate 90 220x100
  shape ['line 40x0 ]
 ]
]

Is there some function or word that keeps current pen position? I want to use it like rotate 90 _pen-position_ instead of hard-coded rotate 90 220x100.

Vladimir Vasilyev
@9214
@nedzadarek can't you just keep turtle's position and heading, emitting Draw code from compiler?
ne1uno
@ne1uno
relative position? '
Vladimir Vasilyev
@9214
@nedzadarek instead of mashing Draw code by hand, you can write Logo compiler/interpreter which will track turtle's coordinates with rotation angle and produces a Draw block automatically, by reading Logo commands.
nedzadarek
@nedzadarek

@9214

can't you just keep turtle's position and heading

Right! I'm too tired to remember most obvious things: shapes command uses end-point (pen position). So, as you said, I can just keep that 2 values.
Thank you.

GiuseppeChillemi
@GiuseppeChillemi
Is there any good Reading example in vid faces positioning ? I wish to have a Windows with Two orizontal Lines of buttons on the top, then a big area just below them on the left and many small areas spread vertically on the right. Each area should have a tittle just on the top of It.
I am going Crazy on this
Vladimir Vasilyev
@9214
GiuseppeChillemi
@GiuseppeChillemi
Needs articles and examples
view [
    style small: area 30x30

    button button button return
    button button button return
    area below small small small
]
GiuseppeChillemi
@GiuseppeChillemi
Small should be on the right of 300x500
area
Vladimir Vasilyev
@9214
Okay, now go on and fix it :wink:
GiuseppeChillemi
@GiuseppeChillemi
@9214 I'll look at It in few minutes. Those were my last words before falling asleep , written in my bed.
I still have bit seen the result of your examples
*still not seen
ne1uno
@ne1uno
@GiuseppeChillemi you can use a group-box to make some layout simpler, I don't think you can turn off the border though
GiuseppeChillemi
@GiuseppeChillemi
@9214 I have tried and it works. Now I have started experimenting.
It seems when you draw a face the cursor is moved just after it. So, if you write BELOW and you have draw the last on as ACROSS, then you have CURSOR LEFT - DRAW - CURSOR DOWN DRAW
GiuseppeChillemi
@GiuseppeChillemi
Is there a way to TRIGGER the default event connected to a face ?
GiuseppeChillemi
@GiuseppeChillemi
@toomasv @9214
Thanks for your help. I have just published the first working version: https://github.com/GiuseppeChillemi/textsplithelper.red/blob/master/TextSplitHelper.red
Attribution inside
This my first ever code published on GITHUB.
I will use this software to catalog all my notes.
But has many other applications when splitting text lines to corresponding categories
(user defined inside the script, visually on newer releses)
Toomas Vooglaid
@toomasv
@GiuseppeChillemi :+1:
@nedzadarek My turtle here:
turtle
Or is it bug?
nedzadarek
@nedzadarek
@toomasv are you trying to draw a square and are you using my (edited) code? If yes then it should work for square because after each line we rotate by 90 degree so <center> parameter ( (optional) center of rotation (pair!)) doesn't matter. We should calculate <center> parameter other way.
Toomas Vooglaid
@toomasv
@nedzadarek Neither. It's my code and turtle is drived by arrow-keys where-ever needed.
nedzadarek
@nedzadarek
@toomasv so what's the bug? It seems to move correctly (we don't know the key-presses) and it just goes off-screen (that's normal).
Toomas Vooglaid
@toomasv
@nedzadarek Sorry, I meant that it looks rather like a bug. But on closer inspection it is clearly not a bug. :smile:
nedzadarek
@nedzadarek
@toomasv oh :D Well, to me it looks like a turtle. It walks (slowly) as a turtle... so it must be a turtle.