4 registered members (ozgur, Ayumi, VHX, monarch),
1,161
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Need help with idea for text window in rpg game.
[Re: paracharlie]
#338297
08/16/10 23:29
08/16/10 23:29
|
Joined: Jul 2008
Posts: 1,178 England
MrGuest
Serious User
|
Serious User
Joined: Jul 2008
Posts: 1,178
England
|
slight edit
#include <acknex.h>
#include <default.c>
int int_logPos;
TEXT* txt_log = {
layer = 10;
strings = 10;
flags = SHOW;
}
void logger(STRING* str){
int i;
if(int_logPos < txt_log.strings){
str_cpy((txt_log.pstring)[int_logPos], str);
int_logPos++;
}else{
for(i = 0; i < txt_log.strings-1; i++){
str_cpy((txt_log.pstring)[i],(txt_log.pstring)[i+1]);
}
if(str){
str_cpy((txt_log.pstring)[txt_log.strings-1],str);
}else{
str_cpy((txt_log.pstring)[0],"");
}
}
}
#define waiter -0.5
void logger_startup(){
int i;
for(i = 0; i < txt_log.strings; i++){
(txt_log.pstring)[i] = str_create("");
}
wait(waiter);
logger("THIS");
wait(waiter);
logger("IS");
wait(waiter);
logger("HOW");
wait(waiter);
logger("IT");
wait(waiter);
logger("WORKS");
wait(waiter);
logger("JUST");
wait(waiter);
logger("KEEP");
wait(waiter);
logger("SENDING");
wait(waiter);
logger("logger(\"input\")");
wait(waiter);
logger("UNTIL");
wait(waiter);
logger("YOU");
wait(waiter);
logger("GET");
wait(waiter);
logger("BORED");
wait(waiter);
logger(":)");
wait(waiter);
}
will now start from line 1(0), then scroll for everything else...
#define chattable skill80
void mouse_rightClick(){
if(mouse_ent){ //if hit entity
if(vec_dist(mouse_ent.x, player.x) < 100){ //if player in range of clicked target
if(mouse_ent.chattable){ //skill set on entity so you can't talk to trees and terrain etc...
set(pnl_chatBG, SHOW); //rename for your chat BG
logger("Pumpkin Pie sir?);
//do however you're handling chat here...
}
}
}
}
void main(){
//...
on_mouse_right = mouse_rightClick;
//...
}
*totally untested*
|
|
|
Re: Need help with idea for text window in rpg game.
[Re: MrGuest]
#338298
08/17/10 00:07
08/17/10 00:07
|
Joined: Mar 2009
Posts: 146 USA
paracharlie
OP
Member
|
OP
Member
Joined: Mar 2009
Posts: 146
USA
|
Yes it works! I cant thank you enough for making my idea a reality. Thank you very much for taking the time to do this. This is exactly the way I envisioned it working.
At the same time I just learned alot from your code on using pstrings. This has been a very foggy area for me for awhile, but I have learned a great deal by looking at your code, thank you.
Now to add text to a panel for the purpose of being able to drag a panel about I can still do something like this since its a function.
logger(str_cpy(npc_message,"Pumpkin Pie sir?")); and that appears to be working also.
Last edited by paracharlie; 08/17/10 01:20.
A8 Commercial
|
|
|
Re: Need help with idea for text window in rpg game.
[Re: paracharlie]
#338315
08/17/10 05:24
08/17/10 05:24
|
Joined: Jul 2010
Posts: 127 Germany, Herford
Ditje
Member
|
Member
Joined: Jul 2010
Posts: 127
Germany, Herford
|
@ MrGuest: Yeah - I`ve learned something about handling strings, too. THX Ditje
|
|
|
Re: Need help with idea for text window in rpg game.
[Re: Ditje]
#338494
08/18/10 15:22
08/18/10 15:22
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
For what its worth, seeing as MrGuest has beaten me again, HERE is a little something I put together in the last few days. It may be of interest to you guys, even if its too late to be useful....
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Need help with idea for text window in rpg game.
[Re: EvilSOB]
#338552
08/19/10 00:13
08/19/10 00:13
|
Joined: Mar 2009
Posts: 146 USA
paracharlie
OP
Member
|
OP
Member
Joined: Mar 2009
Posts: 146
USA
|
I've already started plugging into my rpg and I have to say everything now looks so much more professional with my combat windows, message windows just like the pro's. HUGE contribution to the community, cant thank you guys enough. I hope others see the power, ease and flexibility of these (plugin's) basically, I guess you could call it.
A8 Commercial
|
|
|
|