Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Moga

Pages: 1
1
Ask a Question / Re: How do you use CS dialog checkpoints?
« on: July 04, 2011, 12:22:53 pm »
I'd like to know about this too, because I tried the same thing as you- with the same results.



2
Ask a Question / Creating A Shove Action
« on: July 02, 2011, 10:13:55 am »
I'm trying to construct a shoving motion in a game using 4 way movement. The shoving motion in it's ideal form should work automatically when the main character interacts with a enemy character when a button is held down- shoving the enemy character in the opposite direction or at least out of the way for a bit.

I'm running into trouble though with:
A. setting off the action with a button when the collision occurs
B. getting the animations to play that correspond to the direction of the collision
C. getting the enemy actor pushed in that direction.

At present the behavior is only on the player actor, used to interact with all actors.
I tried the core pushing actions without problem 'A' involved, but still ran into problems 'B' and 'C'.
Also, it seems to randomly play but usually when it does the player actor is pushed into blocks that do not have a collisions set- which means I get thrown from the territory I'm supposed to walk in.
I'd be glad to upload a active example, but here's what the pushing code looks like at present.

3
Journals / Re: What are you working on?
« on: June 20, 2011, 09:51:50 pm »
'Kay. I'll bite.
I'm working on porting a bad rpgmaker2k3 story-heavy dream game I made a couple demos of called May, to stencyl with added story and action features- and with a little luck a more expansive set of areas to dream through. Stencyl-visioning it made much more sense to me than continuing development on a limited support platform, with the added bonus that I could do about anything visually that I care to try pretty much.
And that's pretty much it, my art gallery/job run got completely screwed over so I decided to construct May until I get it done in a obsessive way.
links to thread at uboachan for the curious about previous builds, which is where the main topic for it lives since it uses a lot of yume nikki mechanics- or at least did until I switched from rpgmaker2k3: http://uboachan.net/fg/res/1997.xhtml
I'll take the link down if it's not allowed to drop links.
Much thanks to those that have helped me so far with this system, they've been very nice and welcoming.

4
I just tried what you requested- and initially it seemed to work!
Then I saved, closed out of Stencyl, restarted Stencyl, then tried to test it again to make sure.
It failed yet again.

Though this time I poked around some more, and found that the class referenced above the super on line 95 didn't seem to reference the classes inside the code, I guess?

So I added in the DialogBoxCore_255_255_255_255_255, and it started working again- at least so far after two to three restarts of Stencyl and some saves.
I'm not exactly sure it's solved yet, at least until I get some dialog on the screen and working. I might have broken something else, non-syntax related.

Thanks for your help getting this far Greg!

5
What I've been pestering people around here a lot is about dialogue, so I did as Justin suggested and downloaded the Cutscene example and played with it until I was confident in how it worked. Then I uploaded as a private file the cutscene package used in the example game to the Forge, downloaded it, then intergrated it into my game.
I did a test run with the neccessary behaviors to engage a Dialogue cutscene.
Then I was greeted with the same error I have gotten with all the dialogue behaviors, packages, and demos I downloaded:
Quote
Building... Dialog Box Core



Behavior: DialogBoxCore_255_255_255_255 at line 95
A super statement can be used only inside class instance constructors.
      super(actor, scene);

---------------------------------
Done. Took 2428 milliseconds to build.

I took a bit to poke around inside this core, but most of what I did seemed to break it in other ways I don't quite understand how to fix.
Any suggestions on a possible work around/fix?

Just for a reference, I'll add the entirety of the dialogue box core here as it appears in my game:
Code: [Select]
package scripts
{

import org.flixel.*;

import caurina.transitions.*;
import flash.display.BitmapData;
import flash.events.*;
import flash.net.*;
import flash.filters.*;
import stencyl.api.engine.*;
import stencyl.api.engine.actor.*;
import stencyl.api.engine.behavior.*;
import stencyl.api.engine.gui.Label;
import stencyl.api.engine.gui.Panel;
import stencyl.api.data.*;
import stencyl.api.engine.bg.*;
import stencyl.api.engine.font.*;
import stencyl.api.engine.scene.*;
import stencyl.api.engine.sound.*;
import stencyl.api.engine.tile.*;
import stencyl.api.engine.utils.*;


public dynamic class DialogBoxCore_255_255_255_255 extends ActorScript
{
public var bgImage:BitmapData;
public var portraitImage:BitmapData;
public var overflowActor:Actor;
public var portraitActor:Actor;
public var bgActorType:ActorType;
public var overflowActorType:ActorType;
public var portraitActorType:ActorType;
public var textList:Array;
public var currentFont:Font;
public var keywordFont:Font;

public var hasOverflow:Boolean;
public var isDisplaying:Boolean;
public var isFading:Boolean;
public var isTyping:Boolean;
public var playSounds:Boolean;
public var useBgImage:Boolean;
public var useFixedSize:Boolean;
public var useTypingEffect:Boolean;

     
public var fadeTime:Number;
public var typeDelay:Number;
public var dialogBoxAlpha:Number;

public var alignment:int;
public var bgCornerHeight:int;
public var bgCornerWidth:int;
public var currentHeight:int = 150;
public var currentChar:int;
public var currentPage:int;
public var currentWidth:int = 300;
public var currentXOffset:int;
public var currentYOffset:int;
public var fontHeight:int;
public var numChars:int;
public var numLines:int;
public var onChar:int;
public var overflowXOffset:int;
public var overflowYOffset:int;
public var panelHeight:int;
public var pagesNeeded:int;
public var portraitXOffset:int;
public var portraitYOffset:int;
public var txtBottomMargin:int;
public var txtLeftMargin:int;
public var txtRightMargin:int;
public var txtTopMargin:int;
public var xPos:int;
public var yPos:int;

public var dialogBoxColor:uint;

public var bgPanel:Panel;
public var txtPanel:Panel;

public var typingSound:SoundClip;
public var openSound:SoundClip;
public var nextSound:SoundClip;
public var closeSound:SoundClip;

public var curChar:String;
public var currentText:String;
public var defaultText:String;
public var lines:Array;

public function DialogBoxCore(actor:Actor, scene:GameState)
{
super(actor, scene);
}

override public function init():void
{
doesCustomDrawing();
  bringRootPanelToFront();
  bringRootPanelForward();    //make sure we can draw on top of the dialog box if needed
  //sendRootPanelForward();
 
textList = new Array();     //this will store all of our text

//make sure we have a default font to work with
if(currentFont == null) {
currentFont = Graphics.defaultFont;
}

if(keywordFont == null) {
keywordFont = currentFont;
}

currentText = "Default text";
dialogBoxColor = Util.RGBToHex(0, 0, 0);
dialogBoxAlpha = 1;
isDisplaying = false;
isTyping = false;
hasOverflow = false;
pagesNeeded = 1;
currentPage = 1; 
bgCornerWidth = 20;
bgCornerHeight = 20;                                                               
}

//This is where everything happens. It gets called each step of the game.
override public function update():void
{
if(txtPanel == null) return;    //we haven't created a panel yet

playSounds = false;
curChar = null;
onChar = 0;

if(isDisplaying)
{
getPosition();
bgPanel.moveTo(xPos + currentXOffset, yPos + currentYOffset, 0);
}

// check to see if we have more text than we can display on one page
if(isDisplaying && !isTyping && hasOverflow) checkOverflow();

// remove the overflow indicator if we don't have more text to show
if(overflowActor != null && (!isDisplaying || isTyping || !hasOverflow))
{
overflowActor.die();
overflowActor = null;
}

// remove our portrait actor if the dialog box is no longer displaying
if(portraitActor !=null && !isDisplaying && !isFading)
{
portraitActor.die();
portraitActor = null;
}

// check to see if the characters are typing to the screen, and if so - play the typing sound
     var displayChar:int = 0;
     var counter:int = 0;
     var l2:Label;
     
for(var i:int=0; i<txtPanel.getComponents().length; i++)
{
l2 = txtPanel.getComponents()[i];
    numChars = l2.getText().length;
    onChar = onChar + l2.getNumDisplayChars();
    if(l2.getNumDisplayChars() > 0) curChar = (l2.getText().charAt(l2.getNumDisplayChars()-1));
    if(txtPanel.getComponents()[i+1] == null)
    {
        if(l2.getNumDisplayChars() == numChars)
        {
            isTyping = false;
        }
    }
}

if(onChar > 0 && onChar != currentChar)
{
    currentChar = onChar;
    if(!(curChar == " ")) playSounds = true;
}

if(typingSound != null && playSounds) typingSound.play();
if(portraitActor != null)
{
if(isTyping) portraitActor.setAnimation("talking");
else portraitActor.setAnimation("idle");
}

}


/*
Main Entry point to display the passed in text.
*/
public function requestDialog():void
{
if(isFading) return;

// if we already have a dialog box open, handle that separately
if(isDisplaying)
{
handleOpen();
return;
}

//if the user specified a background image, use that and set the dimensions
          if (useBgImage) {
bgImage = getImageForActorType(bgActorType);
bgCornerWidth = 20;
bgCornerHeight = 20;
     if(useFixedSize)
     {
      currentWidth = bgImage.width;
      currentHeight = bgImage.height;
     }
        }     
        else
        {
//Create a default image background
var s:FlxSprite = new FlxSprite(0, 0);
s.createGraphic(currentWidth,currentHeight,dialogBoxColor,false,null)
s.solid = false;
s.antialiasing = true;
s.frame = 0;
s.alpha = dialogBoxAlpha;
bgImage = s._framePixels;
bgCornerWidth = 1;
bgCornerHeight = 1;
        }

     textList = [];

     //break up the current section of text into an array of lines
buildTextList(currentText);

currentText = textList[(textList.length - 1)];     //pop one off the top
ArrayUtil.removeAt(textList, textList.length-1);   //then remove it

if(textList.length > 0) hasOverflow = true;        //still more left?
else hasOverflow = false;

fontHeight = currentFont.font.height + (currentFont.font.height / 7);

        lines = wordWrap(currentText, currentWidth - txtLeftMargin - txtRightMargin, currentFont);
        numLines = lines.length;
        for(var i:int=0; i<lines.length; i++)
        {
        //print("line " + i + ": " + lines[i]);
        }

if(!useBgImage && !useFixedSize)
{
currentHeight = (numLines * fontHeight) + (txtTopMargin + txtBottomMargin) + 5;
var s:FlxSprite = new FlxSprite(0, 0);
s.createGraphic(currentWidth,currentHeight,dialogBoxColor,false,null)
s.solid = false;
s.antialiasing = true;
s.frame = 0;
bgImage = s._framePixels;
}

getPosition();

//create the Panels
bgPanel = createPanel(xPos + currentXOffset,
                      yPos + currentYOffset,
                      currentWidth,
                      currentHeight);

txtPanel = createMultilineLabel(currentFont, currentText, txtLeftMargin, txtTopMargin, ((currentWidth - txtLeftMargin) - txtRightMargin));

bgPanel.setBackground(bgImage, bgCornerWidth, bgCornerHeight);



if(openSound != null) openSound.play();
drawDialog();
}

public function getPosition():void
{
if(alignment == 1)
{
yPos = yPos - currentHeight;
if(xPos + currentWidth > getScreenWidth())
{
xPos = getScreenWidth() - currentWidth;
}
}
if(alignment == 3) xPos = xPos - currentWidth;
if(alignment == 4) yPos = yPos - currentHeight;
if(alignment == 5)
{
xPos = xPos - currentWidth;
yPos = yPos - currentHeight;
}
if(alignment == 6)
{
xPos = xPos - (currentWidth / 2);
yPos = yPos - (currentHeight / 2);
}

if(alignment == 7)
{
xPos = xPos - (currentWidth / 2);
}

if(alignment == 8)
{
xPos = xPos - (currentWidth / 2);
yPos = yPos - currentHeight;
}

}

public function drawDialog():void
{
if(isFading) return;

if(useTypingEffect)
{
typeText();
}

//var usePortrait:Boolean = true;
if(portraitActorType != null)
{
createActor(portraitActorType, (xPos + getScreenX() + portraitXOffset + currentXOffset),(yPos + getScreenY() + portraitYOffset + currentYOffset), 1);
               portraitActor = getLastCreatedActor();
               portraitActor.disableActorDrawing();
}

//add the Panel to the Root Panel to display it
if(!isDisplaying)
{
if(fadeTime == 0) fadeTime = getStepSize() / 1000;
bgPanel.fadeTo(0, 0, "linear",0)
bgPanel.fadeTo(256, fadeTime*1000, "linear",0)
}

getRootPanel().addComponent(bgPanel);
bgPanel.addComponent(txtPanel);

isDisplaying = true;
}

public function closeDialog():void
{
isFading = true;
if(fadeTime == 0) fadeTime = getStepSize() / 1000;

if(closeSound != null) closeSound.play();
bgPanel.fadeTo(0, fadeTime*1000, "linear",0)
          runLater(1000 * fadeTime, function(timeTask:TimedTask):void {
          bgPanel.removeComponent(txtPanel);
          getRootPanel().removeComponent(bgPanel);
                    isDisplaying = false;
                    hasOverflow = false;
                    isFading = false;
           });
}

public function handleOpen():void
{
if(isTyping)
{
endTyping();
return;
}

if(!hasOverflow)
{
closeDialog();
return;
}

if(useTypingEffect) isTyping = true;

currentText = textList[textList.length-1];
ArrayUtil.removeAt(textList, textList.length-1);

if(textList.length < 1) hasOverflow = false;

bgPanel.removeComponent(txtPanel);
getRootPanel().removeComponent(bgPanel);
txtPanel = createMultilineLabel(currentFont, currentText, txtLeftMargin, txtTopMargin, ((currentWidth - txtLeftMargin) - txtRightMargin));

if(nextSound != null) nextSound.play();
drawDialog();
}

public function typeText():void
{
var l2:Label;
var delay:int = 250;

var numChars:int;
isTyping = true;

var counter:int = 0;
for each(var l2:Label in txtPanel.getComponents())
{
    numChars = l2.getText().length;
    l2.setNumDisplayChars(0);
    l2.animateNumDisplayCharsTo(numChars, numChars * (typeDelay *1000), delay);
    delay = delay + (numChars * (typeDelay * 1000));
}
}


//Stop the typing effect and display the rest of the text
public function endTyping():void
{
var numChars:int = 0;
isTyping = false;
var counter:int = 0;
for each(var l3:Label in txtPanel.getComponents())
{
numChars = l3.getText().length;
l3.setNumDisplayChars(numChars);
}
}

public function buildTextList(fullText:String):void
{
if(!useFixedSize && !useBgImage)
{
    textList.push(fullText);
    return;
}

if(currentFont == null) currentFont = Graphics.defaultFont;
var height:int = currentFont.font.height + (currentFont.font.height / 7);
if((currentHeight-txtTopMargin-txtBottomMargin) < (height + 5)) currentHeight = (height + 5);

//determine how many lines we can fit within
//the height restriction
var linesPerPage:int = ((currentHeight-txtTopMargin-txtBottomMargin) / height);
var lines:Array = wordWrap(fullText, (currentWidth - txtLeftMargin - txtRightMargin), currentFont);
var pHeight:int = (lines.length * height) + 5;

//if our panel height is less than the user
//defined height, we're OK - quit out.
if(pHeight < currentHeight-txtTopMargin-txtBottomMargin)
{
textList.push(fullText);
return;
}

var counter:int = 0;
var count:int = 0;
var index:int=0;
var text:String = null;
var tempList:Array = [];
for(var i:int=0; i<lines.length; i++)
{
count++;
if(text == null) text = lines[i];
else text = text + " " + lines[i];
//print("text: " + text);
if(count >= linesPerPage || i == (lines.length-1))
{
tempList[counter] = text;
counter++;
count=0;
text = null;
}
}

for(var i:int=tempList.length-1; i>=0; i--)
{
textList.push(tempList[i]);
}
}

public function checkOverflow():void
{
if(overflowActorType == null) return;
if(overflowActor == null)
{
createActor(overflowActorType, (xPos + getScreenX() + overflowXOffset + currentXOffset + (currentWidth / 2)),(yPos + getScreenY() + overflowYOffset + currentYOffset + currentHeight), 1);
               overflowActor = getLastCreatedActor();
}

}

public function processKeyWords(fullText:String):Array
{
var returnText:Array = new Array("","");
var indexBegin:int = 0;
var indexEnd:int = 0;
var spLength:int = 0;

indexBegin = fullText.indexOf("[b]",i);
if(indexBegin == -1)
{
returnText[0] = fullText;
return returnText;
}

indexEnd = fullText.indexOf("[/b]",indexBegin);
if(indexEnd == -1)
{
returnText[0] = fullText;
return returnText;
}

for(var i:int = 0; i < fullText.length; i++)
{
indexBegin = fullText.indexOf("[b]",i);
indexEnd = fullText.indexOf("[/b]",indexBegin);
//print("index begin: " + indexBegin);
//print("index end: " + indexEnd);
if(indexBegin == -1 || indexEnd == -1)
{
returnText[0] = returnText[0] + fullText.slice(i,fullText.length);
for(var x:int = i; x < fullText.length; x++)
{
returnText[1] = returnText[1] + "-";
}
break;
}

for(var j:int = i; j < indexBegin; j++)
{
returnText[0] = returnText[0] + fullText.charAt(j);
returnText[1] = returnText[1] + "-";
}

indexBegin = indexBegin + 3;
indexEnd = indexEnd - 1;

for(var j:int = indexBegin; j < indexEnd+1; j++)
{
returnText[0] = returnText[0] + " ";
returnText[1] = returnText[1] + fullText.charAt(j);
}

i = indexEnd + 4;

}
returnText[1]=fullText;
//print("Exclude Special: " + returnText[0]);
//print("Include Special: " + returnText[1]);
return returnText;
}
//Uncomment this and handlesCollisions() if you want to receive collision events.
//One event is thrown for each Actor that is collided with.
/*public void collided(Collision event)
{
}*/

//Uncomment this and doesCustomDrawing() if you want to draw graphics.
//(0,0) represents the top left corner of the Actor's drawing space.
override public function draw(g:Graphics, x:Number, y:Number):void
{
if (portraitActor != null && isDisplaying && bgPanel.getOpacity() > 0)
{
          g.translateToScreen();
          g.setOpacity(Math.min(bgPanel.getOpacity(), 256));
          g.drawImage(portraitActor.getImage(), (xPos + portraitXOffset + currentXOffset), (yPos + portraitYOffset + currentYOffset));
        }

}

}
}


6
After I both confirmed that all the files that the console otuput said was missing was actually there, and that the lib.jar existed as well, I moved the entire file folder to my C:\.
And it just opened, and it's running flawlessly at the moment!
Thanks enormously to both Epic428 and Jon, you've done a wonderful job helping me rectify this problem.

7






I downloaded, and replaced the .exe with the console one you gave- and got this.
I tried just running several instances of SW also but I got the same results as usual.

8
Nothing happens in the taskbar. Here is a picture of what I see in the processes tab when I click the .exe file and the sw.jar file:


But, when I click the sw.jar file when I already have a instance of StencylWorks open like the above picture I get this:



9
Problem: When I open StencylWorks with Administrative Privledges in Microsoft Vista, it does not open correctly. Nothing shows up, but the Processes tab in the Microsoft Task Manager shows that it's operating.

I've already tried to restart my computer, reinstall StencylWorks, updated Java, tried opening the program without admin. privledges, and consulted a very helpful person in the official Stencyl chat to try to diagnose and correct the problem. 

So far nothing has worked, so I am wondering what else I could do to try to solve this problem.

Pages: 1