|
Post by megamushroom on Feb 16, 2005 4:14:48 GMT -5
hey ive realised my dialog sustem isnt as good as I want (it uses draw_text_ext still). So i want to make a better one. BUT, im not sure where to start. I was thinking, count up to the hundereth character, if it isnt a space, count backwards until you find one? Thanks if any one can help Todd Oh, and no code, please, just ideas, i like to figure out code myself
|
|
|
Post by IsmAvatar on Feb 16, 2005 12:31:08 GMT -5
i think you have the best concept. Count down for a space or a hyphen. If you don't find one, just break it at the 100'th position. My codes all just break it at the 100'th position, i think. I have no real concern about it. My main concern is to enable the user to type in the # sign and not produce a newline, and be able to delete it without having to delete a magic "\" when you delete it the first time Good luck. Oh, also, if you're concerned about executing it every step, my method is that it will submit it broken up. Like as soon as the user hits enter, it breaks it up into the pieces and submits each one as a new line. This way it doesn't have to keep breaking it up every step. You're welcome to look at the dialog examples on my site (I have a few, not all under similar names)
|
|
|
Post by shad0w on Feb 16, 2005 23:13:50 GMT -5
I do it sorta like that, but instead of counting back down from 100, i get it to remember the last available splitting spot on the first count.
|
|
|
Post by megamushroom on Feb 17, 2005 3:04:51 GMT -5
cheers guys. At the moment I have text_length that counts back from a hundered, then when it finds a space, it reaks it off into my array. Then it counts again but a hundered plus text_length, and so on.
One thing im not sure on though, is im going to have 4 lines in my text box, but if I go over those four lines, should i use another page, make the top line dissapear, or just make sure I dont. At the moment im undecided.
Thanks
Todd
|
|
|
Post by IsmAvatar on Feb 17, 2005 12:05:55 GMT -5
400 characters... I'm sure you get the picture from that
|
|
|
Post by megamushroom on Feb 17, 2005 18:01:09 GMT -5
so pages is a good idea then ;D
|
|
|
Post by shad0w on Feb 17, 2005 22:41:36 GMT -5
Ive tried the pages system before- gets buggy :S
|
|
|
Post by megamushroom on Feb 19, 2005 19:00:03 GMT -5
this is hard im not doing bad so far though. Its been so long since ive used gm, the manual has become my best friend, lol. anyway, up to now I have got 4 arrays, (one for each line), but then i thought, why dont I just insert a # so gm automatically inserts a new line! is this better, or are individual lines better do you think?
|
|
|
Post by IsmAvatar on Feb 20, 2005 9:37:14 GMT -5
I prefer arrays for a few reasons. 1) because it's not hard to loop through them. 2) allows for a history (and scroll buttons, to see what's been said in the past). And 3) # is hard to handle if the user actually wants to type in a # symbol, because then you have to distinguish between which ones are program-inserted and which ones are user-inserted.
|
|
|
Post by megamushroom on Feb 22, 2005 17:28:57 GMT -5
im confused, its really simple, but im confused. string_delete gives me the string with the bit deleted right? so: text = string_delete(text,0,i) should give me my string, with the bit for the first line gone? it doesnt, this is my code: if string_char_at(text,text_length) = " "{ text_line[0]= string_copy(text,0,text_length) text =string_delete(text,0,text_length) }else{ for(i=text_length;i>=0;i-=1){ if string_char_at(text,i) = " "{ text_line[0]= string_copy(text,0,i) text = string_delete(text,0,i) break; } } }
for (i=0;i<=3;i+=1){ draw_text(100,10*i+100,text_line[i]) } draw_text(100,200,text)
i cant find any problems? any help? Cheers Todd Ps, im only doing it with one line, so i can test the process and blah blah blah, so dont point that out
|
|
|
Post by Nailog on Feb 22, 2005 18:38:46 GMT -5
One thing you will have to keep in mind when messing with strings is that the first index in a string is 1, not 0.
|
|
|
Post by megamushroom on Feb 23, 2005 2:59:20 GMT -5
when i change it to one, it royally messes up, and only shows the last part of the text varibale
|
|
|
Post by Nailog on Feb 23, 2005 4:22:35 GMT -5
Well, you did design the script to erroneously use 0 as the starting point. Simply changing all the 0s to 1s would have a very small chance of working.
And, if you think I'm in error about the starting index, read some of the function descriptions in the Help file, namely ...
string_pos(substr,str) : Returns the position of substr in str (0=no occurrence).
Now, if 0 was the starting position of a string, this would imply that "no occurence" would tell you that the substring is at the beginning of the string. This would be very bad design, and I'm sure you could see the mess that would result if that were true.
Luckily, Mark is smarter than that. However, instead of using -1 as no occurrence, and 0 as the start index, he made 0 no occurence and 1 the start index.
Also note that the count variable (used in the copy and delete functions) should never be 0. The count directly correlates with the number of letters to be copied, or deleted. It doesn't refer to index in any way.
So string_copy(string, 1, 1) will copy the first letter in the string.
|
|
|
Post by megamushroom on Feb 23, 2005 12:52:16 GMT -5
hey, i wasnt tring to offend you, i just simply said what happened.
I figured out what was wrong anyway, the break was breaking the if function, not the for loop ;D cheers for your help nailog.
|
|
|
Post by Nailog on Feb 23, 2005 13:14:24 GMT -5
No offense at all. I was just covering all the bases, and making sure you didn't think I was trying to mess you up somehow.
(Having a string start at 1 and not 0 does go against every other data type using indices. I actually had someone tell me they didn't believe me.)
|
|