Story System

STORY SYSTEM for OpenBoR 2.1

No permission to download
I'm helping nsw25 to debug a serious bug in Urban Lockdown. The message from the log was this:

Code:
...
Script function 'free' returned an exception, check the manual for details.
 parameters: #196608032,  
 
********** An Error Occurred **********
*            Shutting Down            *

There's an exception while executing script 'endlevel' Total Ram: 1546768384 Bytes
...

After some tests, I discovered that the free function referred by the log is from memory clearing by story mode scripts in endlevel.c

Code:
#include "data/scripts/story/story_clear.c"

void main()
{
    clearStory();
    setglobalvar("zoomentity", NULL());
    changeopenborvariant("slowmotion", 0);
}

Unfortunately I don't know what else to check for errors in story system scripts which could cause the error above :(. Anybody can give me a hand?
 
long scr=getglobalvar("scr");

should be:

void scr=getglobalvar("scr");

Do not know if this will fix your issue but as far as I am aware openbor does not support long find any other story related scripts and change any "getglobalvar("scr")" to void rather then long and see if that helps if not I do not know what else it could be.

as a quick test try replacing your [font=verdana, arial, helvetica, sans-serif]story_clear.c file with this:[/font]

Code:
//Story System for OpenBOR
//Original by Volcanic; Modifications by CRxTRDude


//story_clear.c
//Function to clear the variables as the level
//ends.


//Call clearStory(); in endlevel.c so that this function
//can clear the variables, especially the global vars that
//could not be converted to indexed vars just yet.


#include "data/scripts/story/story_define.h"


void clearStory()
{
	if (getglobalvar("scr")){
		free(getglobalvar("scr"));
		setglobalvar("scr",NULL());
	}


	if (getindexedvar(story_back)){
		free(getindexedvar(story_back));
		setindexedvar(story_back,NULL());
	}


	if (getindexedvar(story_back2)){
		free(getindexedvar(story_back2));
		setindexedvar(story_back2,NULL());
	}


	if (getindexedvar(story_back3)){
		free(getindexedvar(story_back3));
		setindexedvar(story_back3,NULL());
	}


	if(getglobalvar("story.pic")){
		free(getglobalvar("story.pic"));
		setglobalvar("story.pic",NULL());
	}


	setindexedvar(story_switch,0);
	setglobalvar("story.posy",NULL());
	setindexedvar(story_backfile,NULL());
	setindexedvar(story_backfile2,NULL());
	setindexedvar(story_backfile3,NULL());
	setglobalvar("oldtick",NULL());
	setindexedvar(story_switch,NULL());
	setindexedvar(story_msg1,NULL());
	setindexedvar(story_msg2,NULL());
	setindexedvar(story_msgName,NULL());
	setindexedvar(story_msgPortrait,NULL());
	setindexedvar(WHITE,NULL());
	setglobalvar("white.alpha",NULL());
}
 
@nsw25
I found your bug it is in this story script if you use too many words in one sentence it will crash openbor cut down your wording to test if it is ok spawn the story cut scene then play it through without skipping then press start and end game if it ends without crashing that story scene is OK but if it crashes cut down the words and try again.

hope that helps.
 
I am guessing this is due to the 64 character limit DC applied to openbor text objects your only option with this system is to stay within the limit and add more pages of text to run through.


I have my own story system that supports 3 lines but it is still affected by the character limit and its not easily ported to other mods. I am working on a way to port it to other mods and add features like setting a text box picture rather then a plain one and to set where players are displayed.
 
Malik is on point. There is a limit to the text object by default and to increase the limit means a complete overhaul. Nevertheless, the only thing to fix the StorySystem is to basically rewrite it with better programming and stuff.

It's been a while though so I might not be up to task of doing so, but if someone else would want to give a shot at it, I'm all ears. Besides the old files and the mechanism behind it is still with me and if you search deep enough I explained how Volcanic did all those stuff.
 
msmalik681 said:
I am guessing this is due to the 64 character limit DC applied to openbor text objects your only option with this system is to stay within the limit and add more pages of text to run through.

Two points:

  1. I did not place the 64 character limit on text - that was Utunnels, and he didn't do it arbitrarily. It had to do with memory allocation at the time.
  2. As I have posted several times now, this entry explains everything you need to know about OpenBOR variables - including strings. The most important part for you, is that the 64 character limit was eliminated a while ago.
 
@DC
I am sorry I wrongly accused you. Having that limit lifted is amazing i cant wait to test this when I get home.
 
my tests show that a "char" or string value can now hold 126 characters much more then the prior 64 character limit but still limited here is the code I used in updated.c to conduct my test:

Code:
void main()
{
char text = "gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggh";
settextobj(0, 0,  80, 3, 9999999999,strright(text,strlength(text)-1)); //display the last character it should be a "h"
}


Tell the truth the character limit on a sting is not the issue the character limit is on a text object and that is still restricted to 64 characters I have thought of another way around this issue but its a bit complicated I will try it with my new story system.
 
Nevertheless, the only thing to fix the StorySystem is to basically rewrite it with better programming and stuff.
Or people just break their text into smaller pieces (sentences), with is way easier and it's not a game breaker.
 
Hello I'm having some trouble with the story system

1. When I use _back to load a background image, the game readily accepts 8bit PNG or gif file. However, it cannot load a 24bit PNG which works when loaded as a background normally. The game does not crash, it simply does not load the image and continues.

2. When using an indexed PNG or Gif, the game is currently treating BOTH the green and black colors of my images as completely transparent (pls see image). The green should be transparent, but not the black in the hair i circled.

Hope someone can help.

Capture.GIF
 
thanks for the reply!

is there a quick, automated way to ensure that there is no pure black in my images? There are tons of areas here and there in my images that turn out to be pure black, I can't find them all by hand

edit: I found a way to find and replace all instances of black in gimp. but damn thats so annoying I gotta remember to do this every time


unknown.png
 
Last edited:
also, I dont think it's the entire engine's setting, just story system, because i can use pure black other places and it does fine.
 
Hey there! I've actually been using this system for my current project - Helluva Brawl. What I wanted to ask was this real quick: if I just wanted to make a cutscene via just using a level dedicated to the dialogue (aka, just a still image/fglayer, then dialogue between characters, then transition into the next level/scene), would I make it progress to the next level/scene after the dialogue ends?

Here's what I have thus far:

Code:
music        data/music/kofx.ogg

panel        data/bgs/training/bg.png none none
frontpanel    data/story/bgs/defeattex.gif
order            a
settime         0
notime          1
nopause        1
nolife 1
type 2
spawn    story
alias    TexDefeat
at        0

spawn    stop
coords 1 1
at        0

wait
at 0
 
I've tried running short level with same setting minus stop spawn and the level doesn't end on its own after story is played out. Disabling type 2 allows the level to end on its own.
 
I've tried running short level with same setting minus stop spawn and the level doesn't end on its own after story is played out. Disabling type 2 allows the level to end on its own.
It works for me, my only remaining issue is that the HUD is now visible and the "GO" sound for the progression arrow keeps playing
 
Go comes from cleared Wait so you could remove Wait to solve that.
As for visible HUD, hmmm.... type 2 would be needed and these:
Code:
spawn    Story
alias    TexDefeat
coords    800 500
at    0

spawn    delay
health    5
coords    800 500
at    0

group    1 1
at    0

spawn    delay
@script
void main()
{
    jumptobranch("Nex", 1);
}
@end_script
health    5
coords    800 500
at    0

The first delay will allow the story to play out before script in second delay ends the level.
I don't know the purpose of stop so I didn't include it there.
 
Back
Top Bottom