narfi's Forum Posts

  • 7 posts
  • It's been on our todo list a while. It was an oversight when we originally implemented global variables - for now a number being 0 or 1 should do.

    Is there an easy way to toggle a number between 0 and 1 as though it was a boolean?

  • Hmm for organization is there any way to put global variables in a group while still allowing the other groups access to them?

    Part of what I am trying to learn now is organization and keeping things grouped so that I can focus on one thing at a time.

    It may not be a problem though, it will be nice to have variables that are only within certain groups, but would be nice to have a collapsible group for the global ones shared by all the groups as well.

    *edit* It also seems you cant set Global Variables as Boolian?

  • Just found out i can Right click in the events list and create global variables. This will be a lot simpler for a lot of the things I want to do. It gives me a 'visual' reference to look at as well which is nice.

    narfi

  • Yes it seems like dictionary may be the simplest thing for me to use at least during the learning stages.

    What is the best way to pre-populate values in either the Dictionary or arrays?

    With Dictionary I think maybe just have an event Dictionary is Empty and then enter everything that way. It should populate it all when the program first starts, and then unless I clear the dictionary it wont do it again, correct?

    I suppose I could do something similar with an array as well.

    thanks,

    narfi

  • Hm, the thing is, you're not really using Arrays here. You just put some instance variable on the array and use these.

    Every object can have instance variables. It's not really what arrays are for (:

    Also, I think that your expression could be simplified this way:

    newPrice = round(formerPrice * random(0.85,1.20))

    Thanks, that is a much simpler expression. (I am assuming that random(0.8,1.2)will give me any range between those 2 numbers?)

    And about arrays and variables, yes I am starting to see that now and not sure what is the best for what I want to do.

    Dictionary sounds like a nice way to store info, and instance variables have been what I have been using, but what is best for storing a table of numbers?

    I still don't really know how to use the array in a way that is easy for me to keep straight in my mind.

    For example I want to store a table of base prices for things which vary by market. (for example 10 items and 6 markets.) And I would like to be able to easily get the value from for instance Item3 Market5.

    In my mind i can visualize 2 and 3 dimensional arrays, but I think of them with labels for each row, column and depth. Is it possible to work with arrays that way, or can they only be used by number references?

    Also what is the advantages and disadvantages to using Dictionary vs instance variables for storing variables?

    Thanks for he help,

    narfi

  • If the BuyValues is supposed to be 110% higher than the SellValues, shouldn't we see "Set MaterialBuyValue to int(Array.MaterialsSellValue*1.1)" ? The strange thing is that you got it right with ItemsBuyValue... <img src="smileys/smiley17.gif" border="0" align="middle" />

    Bingo!!!

    Thanks, I knew it had to be something simple.

    I just made the changes and going to run it a few minutes to test, but I am sure that's what it was.

    My next steps in the learning process are to clean/tidy up what I've done so far. (separate background, main game, and HUD layers instead of all on one layer which is turning into a bit of a mess of having to do so much of the same thing over and over for each layout)

    Then I want to learn how to work with the arrays better. I will want to break down the Materials, Ores, Items into multiple sub-types of each one as well as have differing base prices depending on which market they are in. (so 6 markets * 3types * 10 (sub-types each) * 2(buy/sell) = 360 variables or a 4 dimensional array?

    I think though that since the player can only be in one market at a time I only need to store the base buy price and then have a new array for the 'local market' which gets its info from the big one and adds its own modifiers as needed.

    Is this a good way to approach it, or is there a cleaner simpler method?

    Also is there a visual way to view the array sort of like a spreadsheet? I am still having a little trouble getting a good mental picture of how It is working.

    Thanks again,

    narfi

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Trying to teach myself and ran into some math issues, was wondering if anyone could point out what I did wrong.

    <img src="http://lostrenegades.net/ET/timer.JPG" border="0" />

    The program as far as I have gotten it, (don't laugh I'm learning :P )

    lostrenegades.net/ET/index.html

    The buy values are supposed to be 110% higher than the sell values so that in any 60 second cycle a player cant just buy and sell an imbalanced item over and over for fast cash.

    The sell values are randomly changed every 60 seconds by a rate of 80-120% of their former value.

    When it starts out everything looks right, 10/11, 20/22, 30/33, but as time goes on you can see that while the values do randomly change, the ratios do not stay with buy price at 110% of the sell price.

    If anyone can point out what I did wrong, I would appreciate it.

    thanks,

    narfi

    ps. is there a tutorial on how to have objects placed dynamically to fit the screen instead of at a set coordinates from the upper left corner?

  • 7 posts