Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Oct 20 2019 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
Toomas Vooglaid
@toomasv
@temperfugit I meant series inside series.
temperfugit
@temperfugit
@9214 Thanks for your help, I'm going to have to read up on deep-reactor. drawCurve is redundant here because I stripped out most of its functionality to isolate the odd behavior to post here. In my test program it takes vertex data from other blocks (passed as an argument) and puts them in the draw block, while another function (I've yet to implement) will export the same blocks as svg. It's something I've been doing with Lua and Love2d, but I'm messing around a bit to see if it would be easier in Red.
temperfugit
@temperfugit
@toomasv Thanks for the clarification. Hopefully I'll get a chance this evening to go through
all the code examples and force some of this extra knowledge into my head.
lepinekong
@lepinekong_twitter
@nedzadarek I can't see what's he's pointing at: there's nothing in help about if or while :)
Is it possible to avoid this jaggeg effect for fonts and pictures ? https://i.imgur.com/agzzanj.png testing https://github.com/hako/lines
GiuseppeChillemi
@GiuseppeChillemi
@9214 @toomasv Thanks for you help
Now I have more knowledge about working of RED VID.A special thank to @toomasv as I am building from your code.
Now another request:
GiuseppeChillemi
@GiuseppeChillemi

Is I have a list like:

button-list: [field1 "aaa" field2 "bbb" field3 "ccc" ]

How could I dynamically create a GUI with those 3 fields ?

Somethig like:

Red []

view/no-wait [
    field1: field 70 hint "aaa" [probe face/text]]
    field2: field 70 hint "bbb" [probe face/text]]
    field2: field 70 hint "ccc" [probe face/text]]
]
Vladimir Vasilyev
@9214
@GiuseppeChillemi
list: [field1 "aaa" field2 "bbb" field3 "ccc"]

view collect [
    foreach [tag text] list [
        keep compose [
            (to set-word! tag) field 70 hint (text) [probe face/text]
        ]
    ]
]
GiuseppeChillemi
@GiuseppeChillemi
@9214 another lesson to study !
Keep and Compose are the target
I don't understand the reason for to set-word! Tag instead of Tag
Vladimir Vasilyev
@9214
@GiuseppeChillemi well, remove to set-word! and check how the output of collect changed with probe.
GiuseppeChillemi
@GiuseppeChillemi
We are inside a dialect so I expect the code to be text
Vladimir Vasilyev
@9214
We are not inside a dialect.
GiuseppeChillemi
@GiuseppeChillemi
No ? Isn't the generated text passed to vid with view ... ?
(could try Tomorrow)
Vladimir Vasilyev
@9214
Then I don't get what you mean by "I expect the code to be text".
GiuseppeChillemi
@GiuseppeChillemi
I expected the "view" argument to be text. Then the dialect code interprets It.
Vladimir Vasilyev
@9214
It's not a text, it's a VID block which collect returns.
GiuseppeChillemi
@GiuseppeChillemi
Like "sell 10 shares at 50"
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