Posted 02 January 2014 - 09:27 AM
Hello, people!
I've recently been working on my driving simulator for a custom map, which I shall post here too, of course, when I tripped over a problem. I've never actually understood how to properly work with tables, and I found that I didn't quite know how to overcome this.
I've got a serialised table in a separate file, which has a string associated to a number, and that string is to be shown in the chat via command blocks, but only when the user surpasses the required distance, which is the previously mentioned number.
I think I could do it up to this point, but, obviously, once the user has surpassed this distance, I do not wish the message to be shown forever after this. Also, there is a precision problem, because the distance is updated every 0.05 seconds, and it is almost impossible for the distance to be exactly the required one in this point.
So, we've got imprecise distance measurement that has to be higher than the value of the needed chat line, but we need that, after it has been shown, it will never do so again, with support for as many lines as I need to implement changing only the external file (which would be as simple as
I've recently been working on my driving simulator for a custom map, which I shall post here too, of course, when I tripped over a problem. I've never actually understood how to properly work with tables, and I found that I didn't quite know how to overcome this.
I've got a serialised table in a separate file, which has a string associated to a number, and that string is to be shown in the chat via command blocks, but only when the user surpasses the required distance, which is the previously mentioned number.
I think I could do it up to this point, but, obviously, once the user has surpassed this distance, I do not wish the message to be shown forever after this. Also, there is a precision problem, because the distance is updated every 0.05 seconds, and it is almost impossible for the distance to be exactly the required one in this point.
So, we've got imprecise distance measurement that has to be higher than the value of the needed chat line, but we need that, after it has been shown, it will never do so again, with support for as many lines as I need to implement changing only the external file (which would be as simple as
f=fs.open("chat/dialog","r")
jander=f.readAll()
f.close()
table=textutils.unserialize(jander)
that, although probably the variable names would change). ¡Thanks for your help!Edited on 02 January 2014 - 08:27 AM