ID:175047
 
This could very well be a bug, but I'm going to post this here because it could be an error in my implementation.

In my work-in-progress game, I have text that scrolls up 16 pixels (half a tile) at a time. I am using screen objects to show the text on the player's window. Then to scroll, I have a for loop to go through every screen object that is attached to that player's client. This for loop checks to see if its text (I use a separate layer to make this easier) and if it is, then it takes the current location and changed the y coordinate in the screen_loc variable so that it reappears 16 pixels (half a tile) above its old location.

The idea I have works...in fact it works 70% of the time flawlessly. The other 30% of the time, DreamSeeker doesn't redraw the object in the correct location...so one letter (an object per letter) will be in its original location whereas everything else is correct. If I scroll again, then the misplaced object(s) will move to where it is suppose to be that time around (appearing correctly) while others may "forget" to move that time around.

Any suggestions on how to fix this and/or go about another way of making this work?
You might want to add some debugging text to make sure each screen object is being hit in the loop, sometimes it will skip them for an unknown reason (this might be a bug), if they are, you should add a double check to make sure they moved correctly, maybe some proc attached to the object that checks its location, and if the given location is not correct force it to move.
In response to Nadrew
I might try this tonight when I'm sitting in front of the code again...but I assume that it is changing them all being that on the next scroll, the text that was misplaced is once again in the correct location (which would then be one tile above where it was when it was mislocated)
In response to Nadrew
The data is being updated properly. This problem seems to be releated to lag. Here are my test cases thus far:

Case 1
  • Server is running on a remote Linux box (400MHz Pentium II)
  • Client (450MHz Pentium III) running Windows 98 and is connected to the internet via a 28.8k dialup connection
Result: frequently messes up


Case 2
  • Hosting locally in DreamSeeker on a Windows 98 machine using a 450MHz Pentium III processor
Result: occasionally messes up


Case 3
  • Server is running on a remote Linux box (same server as in case 1)
  • Client (933MHz Pentium III) running Windows 98 and is connected to the server via a 100mbps network connection
Result: no problems noted
In response to CableMonkey
Here is a screenshot from Case 1:
http://richland.k12.la.us/~dhogan/messedup.png

On the above screen, I am being prompted to select YES or NO. At that time, the cursor is at YES. I pushed the down button to move the cursor to NO. This involved deleting the arror and creating a new one beside NO. Nothing else was done to the screen objects; however, the screen now look like it does in the following image:

http://richland.k12.la.us/~dhogan/noprob.png
I have ripped the code out of the game and made a demo of it. The code can be downloaded here as source code or as a binary. Below is the code that moves the text:
for (var/obj/window/i in usr.client.screen)
if (i.layer == 16)
ty = ycoord(i.screen_loc)
tx = xcoord(i.screen_loc)
switch(ty)
if ("5:16")
del(i)
if ("5")
i.screen_loc = "[tx],5:16"
if ("4:16")
i.screen_loc = "[tx],5"
if ("4")
i.screen_loc = "[tx],4:16"
if ("3:16")
i.screen_loc = "[tx],4"
if ("3")
i.screen_loc = "[tx],3:16"
if ("2:16")
i.screen_loc = "[tx],3"
if ("2")
i.screen_loc = "[tx],2:16"

...and the xcoord and ycoord functions...
proc
xcoord(txt as text)
var i
for (i=1; copytext(txt, i, i+1) != ","; i++)
return copytext(txt, 1, i)

ycoord(txt as text)
var i
for (i=1; copytext(txt, i, i+1) != ","; i++)
return copytext(txt, i+1)
In response to CableMonkey
I replaced the entire system and am using /image instead. Works flawlessly now.