1. How can I work with a user type array in Euphoria ???

I'm new in Euphoria and I have a doubt:

        I did a game in Visual Basic 4.0 that has a global array defined at
this way:

Type MyType
       Cell as single
       Item as single
End Type

Global MapVar(1 to 100,1 to 100) as MyType

        Then, I use this variable to store the map data, for example, if I
want to say that in 2 (vertical cordinate) ,3 (horizontal cordinate) there
is a Cell number 3 and an item number 4, I write:
        MapVar(2,3).Cell=3
        MapVar(2,3).Item=4

        So this is my problem: How can I make the same thing in Euphoria
using that sequences method ?

        I would appreciate any help.

Thanks,
---
Ricardo Niederberger Cabral
Command & Conquer World: Files, Links, Tactics, News ...
http://www.geocities.com/TimesSquare/1210

new topic     » topic index » view message » categorize

2. Re: How can I work with a user type array in Euphoria ???

Ricardo Niederberger Cabral wrote:
>
-------
>
>         I'm new in Euphoria and I have a doubt:
>
>         I did a game in Visual Basic 4.0 that has a global array defined at
> this way:
>
> Type MyType
>        Cell as single
>        Item as single
> End Type
>
> Global MapVar(1 to 100,1 to 100) as MyType
>
>         Then, I use this variable to store the map data, for example, if I
> want to say that in 2 (vertical cordinate) ,3 (horizontal cordinate) there
> is a Cell number 3 and an item number 4, I write:
>         MapVar(2,3).Cell=3
>         MapVar(2,3).Item=4
>
>         So this is my problem: How can I make the same thing in Euphoria
> using that sequences method ?
>
>         I would appreciate any help.
>
> Thanks,
> ---
> Ricardo Niederberger Cabral



 Hi,

    One way could be:


constant cell = 1
constant item = 2

sequence mapvar

mapvar = repeat(repeat({0,0},100),100)

mapvar[2][3][cell] = 3
mapvar[2][3][item] = 4



   Regards,

   Norm

new topic     » goto parent     » topic index » view message » categorize

3. How can I work with a user type array in Euphoria ???

13/3/97, You wrote:

Poster:       Ricardo Niederberger Cabral <rnc at INFOLINK.COM.BR>
Subject:      How can I work with a user type array in Euphoria ???
---------------------------------------------------------------------------
----

        I'm new in Euphoria and I have a doubt:

        I did a game in Visual Basic 4.0 that has a global array defined at
this way:

Type MyType
       Cell as single
       Item as single
End Type

Global MapVar(1 to 100,1 to 100) as MyType

        Then, I use this variable to store the map data, for example, if I
want to say that in 2 (vertical cordinate) ,3 (horizontal cordinate) there
is a Cell number 3 and an item number 4, I write:
        MapVar(2,3).Cell=3
        MapVar(2,3).Item=4

        So this is my problem: How can I make the same thing in Euphoria
using that sequences method ?

        I would appreciate any help.

Thanks,
---
Ricardo Niederberger Cabral

Ciao Ricardo,

In Euphoria, what you ask is quite simple:

-- Mapvar.ex

-- First declare your sequence:
global sequence MapVar
-- Constants for your convenience (not really necessary, as you will
see)(-:
global constant Cell = 1, Item = 2

-- Now initialize the sequence with zeroes:
MapVar = repeat(repeat({0, 0}, 100), 100)               -- creates the map

-- And you are ready to fill your map:
MapVar[2][3][Cell] = 3
MapVar[2][3][Item] = 4

-- Even easier, without using the constants:
MapVar[2][3] = {3, 4}

-- To see the results, (the first 2 rows):
? MapVar[1..2]

I hope this answers your questions. Lots of success with translating your
game from VB.

Greetings,

Ad.

Regards

new topic     » goto parent     » topic index » view message » categorize

4. How can I work with a user type array in Euphoria ???

Hello to all,

How can it happen that an answer I posted on the 13th is only displayed on
the 15th? This of course is out of time. The answer to the question is
allready given by several people.
I only want you all to know that I'm not out of time, but maybe there was
something wrong at the ListServer.

Apologies for bothering,

Ad.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu