Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (7th_zorro), 1,390 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Working on scrollin log #267066
05/21/09 17:16
05/21/09 17:16
Joined: Feb 2008
Posts: 36
Pesaro, Italy, Europe
MaximilianPs Offline OP
Newbie
MaximilianPs  Offline 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.. frown

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 Offline
Senior Expert
Quad  Offline
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 Offline OP
Newbie
MaximilianPs  Offline 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 Offline OP
Newbie
MaximilianPs  Offline 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
P
Phonech Offline
Newbie
Phonech  Offline
Newbie
P

Joined: Feb 2009
Posts: 38
Germany
Take a look at the code below. You can scroll the text by using the arrow keys.

Code:
///////////////////////////////////////////////////////////////
#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:

Quote:
Alvssa casts melf's acid arrow.
Bla bla bla bla.
Show me your moves!
It's over 9000!


I hope that helps.

Re: Lost with string filling dumb [Re: Phonech] #267214
05/22/09 14:57
05/22/09 14:57
Joined: Feb 2008
Posts: 36
Pesaro, Italy, Europe
MaximilianPs Offline OP
Newbie
MaximilianPs  Offline OP
Newbie

Joined: Feb 2008
Posts: 36
Pesaro, Italy, Europe
thnx a alto smile
i wish to update the screen first, and in a second step i will write the log on a text file, btw, this clear my mind a bit smile

Scrolling Log [Re: Phonech] #271993
06/16/09 00:09
06/16/09 00:09
Joined: Oct 2008
Posts: 513
Carlos3DGS Offline
User
Carlos3DGS  Offline
User

Joined: Oct 2008
Posts: 513
Thanks for the info


"The more you know, the more you realize how little you know..."

I <3 HORUS
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=401929&page=1

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1