3 registered members (Ayumi, Akow, AndrewAMD),
1,505
guests, and 9
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Working on scrollin log
#267066
05/21/09 17:16
05/21/09 17:16
|
Joined: Feb 2008
Posts: 36 Pesaro, Italy, Europe
MaximilianPs
OP
Newbie
|
OP
Newbie
Joined: Feb 2008
Posts: 36
Pesaro, Italy, Europe
|
this things drive me crazy, 'cause i suppose that the langue was a C/C++ based but it isn't so easy :P STRING myLog = "here we start"; myLog += "\n this isn't a new piece of the string ?"; and also, if i need to attach a value ? myLog = "Hey you got an healbottle ! ("+ my.skill1 +" of Energy)"; i think that's a realy basic stuff to learn, but i'ven't found any reference about that (maybe i'm searching the worng stuff) but what i' need to do is a scrolling text with a sort of log that explane what is happening to the player while the game is running, and i'm stucked on this thing from a pair of days..
Last edited by MaximilianPs; 05/22/09 07:59.
|
|
|
Re: Lost with string filling dumb
[Re: MaximilianPs]
#267067
05/21/09 17:22
05/21/09 17:22
|
Joined: Oct 2007
Posts: 5,210 İstanbul, Turkey
Quad
Senior Expert
|
Senior Expert
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
|
what you are trying to is possible in c# i think but not in C.
STRING* mystr = "asdasd"; str_cat(mystr," string to append");
or
str_cpy(mystr," string to replace");
or
char mystr[500]; sprintf(mystr,"Hey you got an healbottle ! %d of Energy",_INT(my.skill1));
3333333333
|
|
|
Re: Lost with string filling dumb
[Re: MaximilianPs]
#267074
05/21/09 18:15
05/21/09 18:15
|
Joined: Feb 2008
Posts: 36 Pesaro, Italy, Europe
MaximilianPs
OP
Newbie
|
OP
Newbie
Joined: Feb 2008
Posts: 36
Pesaro, Italy, Europe
|
i was wondering if there is any easy way to made the text inside the TEXT* to scroll up. [code] TEXT* scoll_txt = { layer = 999; pos_x = 19; pos_y = 729; size_x = 987; size_y = 36; font = "Tahoma#12"; string(txtLog); flags = OUTLINE | SHOW; } [code] did you remember eye of beholder? on the bottom of the screen the text scroll up... that's exactly what i'm trying to do. so my wish is to have the text on the variable txtLog but to show just a some lines.
|
|
|
Re: Lost with string filling dumb
[Re: MaximilianPs]
#267144
05/22/09 07:57
05/22/09 07:57
|
Joined: Feb 2008
Posts: 36 Pesaro, Italy, Europe
MaximilianPs
OP
Newbie
|
OP
Newbie
Joined: Feb 2008
Posts: 36
Pesaro, Italy, Europe
|
ok, what i shoul do is: read the variable, look for \n cause that will identfy the new line, so once i know how many lines there are on my variable, i should remove every hidden lines, and leave just the last 3. this can be a solution.
the best way could be using an Array but i didn't see anything about it on the manual. so i suppose that i can't store each line on an array ?
any other suggestion ?
Last edited by MaximilianPs; 05/22/09 08:40.
|
|
|
Re: Lost with string filling dumb
[Re: MaximilianPs]
#267177
05/22/09 10:36
05/22/09 10:36
|
Joined: Feb 2009
Posts: 38 Germany
Phonech
Newbie
|
Newbie
Joined: Feb 2009
Posts: 38
Germany
|
Take a look at the code below. You can scroll the text by using the arrow keys.
///////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>
///////////////////////////////////////////////////////////////
FONT* arial_font = "Arial#14";
FONT* arial_font2 = "Arial#50";
///////////////////////////////////////////////////////////////
STRING* text_str = "#40";
STRING* temp_str = "#40";
///////////////////////////////////////////////////////////////
var filehandle;
var i = 0;
var counter;
var k = 0;
///////////////////////////////////////////////////////////////
typedef struct
{
STRING* text;
} AGENTS;
///////////////////////////////////////////////////////////////
AGENTS taskforces[10000];
///////////////////////////////////////////////////////////////
function read_data(); //loads the TextLog
function info_startup();
///////////////////////////////////////////////////////////////
PANEL* output_pan =
{
digits (6, -3, 1, arial_font, 1, text_str);
flags = VISIBLE;
layer = 10;
red=0;blue=0;green=0;
}
function read_data()
{
filehandle = file_open_read("text_sample.txt");
while (i < 10000)
{
taskforces[i].text = str_create("");
if (file_str_read(filehandle, taskforces[i].text) == -1) // reached the end?
{
break;
}
else
{
i++;
}
}
file_close(filehandle);
}
void main()
{
video_switch(0,0,2);
vec_set(screen_color,vector(255,255,255));
read_data();
wait (1);
}
function info_startup()
{
wait (-1); // wait until all the data is loaded
while (1)
{
if (key_cud)
{
while (key_cud) {wait (1);}
counter++;
k = 0;
}
if (key_cuu)
{
while (key_cuu) {wait (1);}
counter--;
k = 0;
}
counter = clamp(counter, 0, i-1);
str_cpy(text_str, taskforces[counter].text);
wait (1);
}
}
Don't forget to create the text file named text_sample.txt wich could look like this: Alvssa casts melf's acid arrow. Bla bla bla bla. Show me your moves! It's over 9000! I hope that helps.
|
|
|
Scrolling Log
[Re: Phonech]
#271993
06/16/09 00:09
06/16/09 00:09
|
Joined: Oct 2008
Posts: 513
Carlos3DGS
User
|
User
Joined: Oct 2008
Posts: 513
|
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|