Globale oder lokale Variable? Wann sind doppelte Namen erlaubt und welche Werte beinhalten sie?

  • #1, by MachtnixTuesday, 01. December 2015, 23:32 9 years ago
    Für das Rohrspiel habe ich meine 26 Charaktere einfach dupliziert und nur ID und Position und Links ausgestauscht. In jedem Wertebereich habe ich dieselbe Variable "Klick" definiert und auf einen Wert gesetzt. Hier bei Rohr01 und Rohr02.
    Diese wird in den Aktionen abgefragt und offensichtlich funktioniert es. Das heißt, obwohl die Namen identisch sind, versteht Visionaire die 26 Klick-Variablenwerte als 26 verschiedene mit unabhängigen Werten?

    Manchmal jedoch motzt Visionaire und akzeptiert keine doppelten Namen. Hängt das davon ab, an welcher Stelle die Variable deklariert wird? Nebeneinander, also auf derselben Hierarchie, geht nicht.

    Alles, was UNTER einem bestimmten Level festgelegt wird, gilt nur für diesen Level und alle Unterlevel, aber nicht für den darüber? Also: wenn ich bei den Kulissenwerten eine Variable einführe, ist die global für z.B. alle Kulissenelemente? Oder wie läuft das genau ab?

    Wenn ich nicht 26mal die Werte und Animationsnamen ändern müsste, die auf das Kulissenpbjekt oder die -Person beschränkt bleiben - es also egal wäre, ob ein Name doppelt vorkommt -, dann wäre ich echt glücklich. Ist nämlich eine MORDSarbeit.

    Machtnix

    http://abload.de/thumb/klick4hu0j.gif

    Thread Captain

    1097 Posts


  • #2, by afrlmeTuesday, 01. December 2015, 23:46 9 years ago
    The safest path is always direct linking as opposed to going down the global access route.

    Let's take a value attached to a scene for example...
    game.CurrentScene.SceneValues["val"].Int -- access any value belonging to the current scene, should also allow access to values inside of objects in the scene.
    
    game.CurrentScene.SceneObjects["obj1"].ObjectValues["val1"].Int -- access a value inside of a specific object belonging to the current scene.
    


    As you can see there are methods of keeping your code kind of global so you don't have to manually type out the name of everything. You can do this for any of the fields containing current under game in the data structure.

    P.S: sorry if I'm completely off the mark. Not 100% understanding the translation bing gave me.

    Imperator

    7278 Posts

  • #3, by tristan-kangTuesday, 01. December 2015, 23:53 9 years ago
    I'm surprised you're trying to make mini Pipe game in your game.

    https://www.youtube.com/watch?v=Y_C-xzSKg-k

    It'd be great these kind of puzzles can be visualised in VS!

    Great Poster

    267 Posts

  • #4, by MachtnixWednesday, 02. December 2015, 00:03 9 years ago
    Thanks. To think about my problems in English and write it down takes more time as solving the problem for myself and I don't know if I have describe my problem in English as correctly as in German...
    I'm not sure about your script meaning. I have no idea what exactly this "game.CurrentScene" construction is. I haven't work with scripts yet and I'm a goof in object scripting. I don't know what happens "inside" Visionaire, behind the scenes. I only understand: both cases are possible if I chose the right construction for global and local values. Thats nice for scripting.

    Machtnix

    Thread Captain

    1097 Posts

  • #5, by MachtnixWednesday, 02. December 2015, 00:10 9 years ago
    @DEshini: it's not possible with the Vis editor. I have to learn Lua. That's it. So it could take a lot of months to understand how to script, maybe. If I want.

    I prefer German, that's the reason I wanted to work with Visionaire. Now it seems it's only English here, like unity, wintermute, ags, flash,... I should look around for the most powerful engine now - I have to learn the same and they are all in English... :-)

    Thread Captain

    1097 Posts

  • #6, by tristan-kangWednesday, 02. December 2015, 00:25 9 years ago
    What funny thing is I thought VS was made in Netherlands. Probably I mistook Deutschland as part of something like Dutch so that thing happened before I realised it stands for German. lol

    Great Poster

    267 Posts

  • #7, by afrlmeWednesday, 02. December 2015, 00:29 9 years ago
    All engines are mostly in English. All code formats are in English. I'd say if you want to learn game dev, then time is probably better spent learning English as opposed to C# & so on. No idea why it's like that, but that's how it is. wink

    One of the ex-members on here told me about the Game school he went to over in Sweden (Future Games) & he said even they do classes (or at least some of them) in English. I think the reason is because your biggest target is probably US & other English speaking countries anyway (well maybe except for Russian, big gamers are the Russians from my understanding). Also a lot of people you would meet if you were to actually work commercially in the game industry would probably be speaking English in some form or another. Yes, for some reason English is classed as the global language as opposed to the local language. Why it is so, or how it came about, I have no bloody idea.

    My script examples were just a demonstration of accessing a value directly but with a more global approach. As for values, conditions & actions for your scenes, I recommend creating them in the scene tabs instead of inside of objects because it's a lot faster to access them than trying to remember which value, condition etc is where & what it is for.

    Imperator

    7278 Posts

  • #8, by tristan-kangWednesday, 02. December 2015, 00:37 9 years ago
    Yes, for some reason English is classed as the global language as opposed to the local language.


    That's why international company can be existed. smile

    Great Poster

    267 Posts

  • #9, by MachtnixWednesday, 02. December 2015, 01:15 9 years ago
    Das ist mir alles sehr wohl bewusst. Ich habe auch nichts gegen English als Programmiersprache. Ich habe aber nicht vor, Games professionell zu entwickeln, sondern probiere Visionaire aus, weil es verspricht, ein Game OHNE Programmierkenntnisse machen zu können. OK, das stimmt, wenn man sich nicht weit aus dem Fenster lehnt. Der Editor bietet die gesamte Oberfläche in Deutsch an und es gibt viele Möglichkeiten. Das hat mich gereizt.

    Aber sehr schnell reichen die Standard-Funktionen nicht aus und man ist gezwungen, DOCH zu programmieren. Und hier scheiden sich die Ansprüche, denn ob ich nun Actionscript oder Lua neu lernen muss, bleibt sich gleich. Es ist in jedem Fall ein riesiger Schritt. Deshalb ist es zu einer neuen Qualität geworden: ich muss mir klar werden, wieviel Zeit und Energie ich reinstecken möchte, um 1.Programmieren überhaupt zu lernen, also das richtige "Denken", 2. eine Programmiersprache zu lernen, 3. Visionaire zu lernen und dann noch 4. nebenbei ein Spielkonzept, die Grafik und alles weitere zu erstellen. Nebenbei git es ja auch reales Leben... Das bedeutet einen Zeitraum von zwei Jahren.

    Wenn ich also feststelle, dass so ein simples Rohrspiel nicht mal eben in einem Monat fertigwerden kann (ich hatte mir vier Wochen Vollzeit gesetzt), dann hat dieser Test gezeigt, dass es egal ist, ob ich Visionaire oder Flash oder was anderes benutze. Der Vorteil von Visionaire ist nämlich dahin. Nun muss es sich allen anderen Engines stellen. Jetzt ginge es nur darum, eine Engine zu finden, die am meisten anbietet. Programmieren, egal in welcher Scriptsprache, muss ich dann sowieso. Und dazu muss ich wissen, wie ich die anwende.
    Ohne eine fachliche Unterstützung oder eine Ausbildung oder einen Kurs wird das nichts. Autodidaktisch komme ich immer zu abstrusen Lösungen, die nur hier und nur einmal funktionieren, aber nicht für was anderes. Das ist so "dirty", dass sogar mir als Laie klar ist, wie schlecht das gebastelt ist. Bei dem Rohrspiel hab ich soviel getrickst und zurechtgebogen, dass ich schon selber nicht mehr durchsteige...

    Soviel dazu.

    Machtnix

    Thread Captain

    1097 Posts