Menu

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.

Show posts Menu

Messages - bx83

#181
Here's what I have:

Code: ags
function room_Load()
{
  Timer *MyTimer;
  MyTimer = Timer.StartLocalRT(12.0, eTimerPause, eOnce);
}


Overlay* ovTimer;

function room_RepExec()
{
  if (ovTimer != null && ovTimer.Valid) {
    ovTimer.Remove();
  }
  ovTimer = Overlay.CreateTextual(80, 80, 200, eFontNormal, 51520, String.Format("%f", MyTimer.RemainingSeconds));   <---mytimer has no scope, no capitalisation, 'undefined symbol'

}
#182
This is 4 years too late to ask, but: could you give a brief example of a global timer? These are great and I just want to be able to recreate a few like AGS standard timers (but checkable as they run, which these are).
I can't even get this thing to work as a local timer - the timer variable doesn't have scope in the rooms RepExec() ... :/

I'm using AGS 3.5.0.29 but I doubt this will matter?
#183
I just want a named variable - as in, create ThisIsAVar, then use it later. indexes are a bit impersonal and I'll likely make a mistake.

Is there any way to have named global variables? (other than named arrays with just pure indices)
#184
'Background' meaning room background, overwritten dynamically by animated objects and background animation.
Graphic Overlays sound useful - I will investigate.
The last chance I got, I used one to display a timer on-screen (take value of time left, write it out, pace on. overlay, put on screen top-left) -- BUT it crashed after 40 loops with 'too many overlays', and I gave up.
Do you know of a good tutorial?
#185
I have a picture. I can turn it into a dynamic sprite, and draw it wherever I want.
But I can't delete it, as it's burnt into the background.
I can take a square of background from before drawing and re-apply it to hide the sprite - but if it's the background is being animated at the time I take the copy, this will write back the wrong image.
What do I do? Is there any way of showing/hiding an image without just using the GUI/Object 'Visible' method?
#186
....Aaaand I'm a moron. It was replacing the GUI not attaching to it. I created a new one with ZOrder=999, and it worked :)

Now - is there a way to get rid of the tail?
#187
Okay, ignore that, made no sense.

I've made some progress...

Code: ags
void SayAtBubble(this Character*, int x, int y, String message, GUI* bubbleGui)
{
  if(message == null) return;
  if(!game.bgspeech_stay_on_display)
    _stopAllBackgroundBubbles();
  if((Speech.VoiceMode == eSpeechVoiceOnly && hasVoiceClip(message)) || message == "...") {
    this.SB_sayImpl(message);
  } else {
    DynamicSprite* bubbleSprite = this.renderBubble32(message, true);

.....
		} else {		
			x = this.x - GetViewportX() - bubbleSprite.Width/2;					//BLR
		}
		
		x = _clampInt(x, 0, System.ViewportWidth - bubbleSprite.Width);   // /2);
		
    if (DescribeItemInv) {
      cJulius.realSayAtBubble(1, 1, message, gInventory, null);
    } else {
      this.realSayAtBubble(x, y, message, bubbleGui, null);
    }
  }
}


DescribeItemInv is a switch I set up to say 'the inventory is showing'. Don't ask me why, I'll clean it up later.

Anyway - it now:
1. Instantly removes the gInventory GUI
2. Does the speech bubble
3. Prevents you from ever bringing the gInventory GUI up again

:/


ps. I have BTN_SB as a blank element in the gInventory GUI as a button. Should I leave it in?
#188
fir creating a bubble - you mean initialised with SpeechBubble *gInvBubble = SpeechBubble.Create(....  or..?
#189
To myself, it's good to have a plan, but I don't think I could implement this in 6months. Basically all I'll trying to do is display a speech bubble at x=20, y=30, and have it appear above the Inventory GUI (which has a solid background) for all speech connected to i[something]_look() functions.

But anyway - when do you think this feature will be coming out re ZOrder? Is in the next version or 5 months of bug-fixing away? Just trying to get an idea.
#190
How can I display a Speechbubble so that it is on top of all GUIs? ie. Make it's ZOrder=1000 -- despite the fact it has no ZOrder and no obvious way of doing this... :/
#191
ZOrder doesn't exist for DynamicSprites, but here me out...
I'm using the SpeechBubble module, and want to alter it so that a speech bubble appears above the Inventory GUI (ZOrder=2) when it appears. This way, speechbubbles are not covered up by the GUI, which has a solid background.
However, I don't know how I can do this?
#192
Have it turned on - doesn't work.

It's not so much the dialog options code - this is easily enough to get into. It's the code on the dDialog page - there is nowhere in here where I can do a repexec()

Extraneous but: is there any way to animate in a non-blocking way?
If I try eNoBlock for an animation, it doesn't run on-screen. If I proceed t with a blocking event or Wait(1), it *does* work -- but I'm trying to run code in a repeatedly_execute_always(), so it doesn't allow blocking code :/
#193
I've tried in repeatedly_execute() and repeatedly_execute_always() - doesn't matter, it seems to go to a place that exists only in the dDialog. I have debugging in the global script under repexec(), it simply stops checking when it enters a dialog (dDialog.Start() )
I have something which detects the current speech frame a character you're talking to is on; I can't access the character.
#195
Rather than:
Code: ags
int NewGlobalIntVar=5;    GVInt[1]=NewGlobalIntVar;
int SomeOtherVariable=7;  GVInt[2]=SomeOtherVariable;
#196
Is there anything that will save an array of 'anyType' or you have to have an array for each individual type?
How can I more simply set global variables array up?
#197
'no cigar' is en English phrase which means "you tried, but unfortunately it didn't go that way. Try an alternate stratagem."

Basically I just want this:

anyType GlobalVars[] = new Dictionary;

GlobalVars[VariableName]=5;
GlobalVars[aFloatVar]=7.2;
GlobalVars[StringVar]="hello";

export GlobalVars;

New, VariableName (or GlobalVars[VariableName], etc.) is a global variable, capable of being accessed by everyone. Adding new indexes to GlobalVars does not break save-game compatibility. That's it. Not sure how to do this - have been experimenting for an hour.

I have this now:

script:
Code: ags
// new module script

int                           GVInt[];
String                        GVStr[];
float                         GVFloat[];
bool                          GVBool[];
AudioChannel                  *GVAChan[];
AudioClip                     *GVAClip[];
Button                        *GVButton[];
Camera                        *GVCam[];
Character                     *GVCharacter[];
DateTime                      *GVDateTime[];
Dialog                        *GVDialog[];
Dictionary                    *GVDict;
DynamicSprite                 *GVDynamicSpr[];
File                          *GVFile[];
GUI                           *GVGui[];
GUIControl                    *GVGuiControl[]; 
Hotspot                       *GVHotspot[];
InventoryItem                 *GVInvItem[];
InvWindow                     *GVInvWindow[];
Label                         *GVLabel[];
ListBox                       *GVListBox[];
Object                        *GVObj[];
Overlay                       *GVOverlay[];
Point                         *GVPoint[];
Region                        *GVRegion[];
Set                           *GVSet[];
Slider                        *GVSlider[];
TextBox                       *GVTextBox[];
TextWindowGUI                 *GVexWindowGUI[];
ViewFrame                     *GVViewFrame[];
Viewport                      *GVViewport[];


function game_start()
{
  GVInt = new int[999];
  GVStr = new String[999];
  GVFloat = new float[999];
  GVBool = new bool[999];
  GVAChan = new AudioChannel[999];
  GVAClip = new AudioClip[999];
  GVButton = new Button[999];
  GVCam = new Camera[999];
  GVCharacter = new Character[999];
  GVDateTime = new DateTime[999];
  GVDialog = new Dialog[999];
  GVDict =  Dictionary.Create();
  GVDynamicSpr = new DynamicSprite[999];
  GVFile = new File[999];
  GVGui = new GUI[999];
  GVGuiControl = new GUIControl[999];
  GVHotspot = new Hotspot[999];
  GVInvItem = new InventoryItem[999];
  GVInvWindow = new InvWindow[999];
  GVLabel = new Label[999];
  GVListBox = new ListBox[999];
  GVObj = new Object[999];
  GVOverlay = new Overlay[999];
  GVPoint = new Point[999];
  GVRegion = new Region[999];
  GVSet = new Set[999];
  GVSlider = new Slider[999];
  GVTextBox = new TextBox[999];
  GVexWindowGUI = new TextWindowGUI[999];
  GVViewFrame = new ViewFrame[999];
  GVViewport = new Viewport[999];
  
  GVDict[TestVariable]="hello";
  GVDict[AnotherVariable]=5;
  
  int NewGlobalIntVar=5;
  GVInt[1]=NewGlobalIntVar;
  
  int SomeOtherVariable=7;
  GVInt[2]=SomeOtherVariable;
  
  
}


export GVInt;
export GVDict;


header:
Code: ags
import int GVInt[];
import Dictionary GVDict[];


error:
GlobalVars.asc(14): Error (line 14): Attributes of identifier do not match prototype
on this line in script:
Dictionary                    *GVDict;

????

I give up :/
#198
Okay, I've come up with this in a new script which always appears at the top:

GlobalVars.asc:
Code: ags
int                           GVInt[];
String                        GVStr[];
float                         GVFloat[];
bool                          GVBool[];
AudioChannel                  GVAChan[];
AudioClip                     GVAClip[];
Button                        GVButton[];
Camera                        GVCam[];
Character                     GVCharacter[];
DateTime                      GVDateTime[];
Dialog                        GVDialog[];
DialogOptionsRenderingInfo    GVDialogRenderInfo[];
Dictionary                    GVDict[];
DrawingSurface                GVDrawingSurface[];
DynamicSprite                 GVDynamicSpr[];
File                          GVFile[];
GUI                           GVGui[];
GUIControl                    GVGuiControl[]; 
Hotspot                       GVHotspot[];
InventoryItem                 GVInvItem[];
InvWindow                     GVInvWindow[];
Label                         GVLabel[];
ListBox                       GVListBox[];
Object                        GVObj[];
Overlay                       GVOverlay[];
Point                         GVPoint[];
Region                        GVRegion[];
Set                           GVSet[];
Slider                        GVSlider[]
TextBox                       GVTextBox
TextWindowGUI                 GVexWindowGUI[];
ViewFrame                     GVViewFrame[];
Viewport                      GVViewport[];

function game_start()
{
  GVInt = new int[999];
  GVStr = new String[999];
  GVFloat = new float[999];
  GVBool = new bool[999];
  GVAChan = new AudioChannel[999];
  GVAClip = new AudioClip[999];
  GVButton = new Button[999];
  GVCam = new Camera[999];
  GVCharacter = new Character[999];
  GVDateTime = new DateTime[999];
  GVDialog = new Dialog[999];
  GVDialogRenderInfo = new DialogOptionsRenderingInfo[999];
  GVDict = new Dictionary[999];
  GVDrawingSurface = new DrawingSurface[999];
  GVDynamicSpr = new DynamicSprite[999];
  GVFile = new File[999];
  GVGui = new GUI[999];
  GVGuiControl = new GUIControl[999];
  GVHotspot = new Hotspot[999];
  GVInvItem = new InventoryItem[999];
  GVInvWindow = new InvWindow[999];
  GVLabel = new Label[999];
  GVListBox = new ListBox[999];
  GVObj = new Object[999];
  GVOverlay = new Overlay[999];
  GVPoint = new Point[999];
  GVRegion = new Region[999];
  GVSet = new Set[999];
  GVSlider = new Slider[999];
  GVTextBox = new TextBox[999];
  GVexWindowGUI = new TextWindowGUI[999];
  GVViewFrame = new ViewFrame[999];
  GVViewport = new Viewport[999];
  
  export GVInt[];
  
  GVInt[NewGlobalIntVar]=5;  
}



GlobalVars.ash:
Code: ags
import int NewGlobalIntVar;


NewGlobalIntVar on the last line of GlobalVars.asc is me making a new int, which will be global and accessible by all other scripts. I can create as many of these as I like without breaking save-game compatibility. Is this correct?

However, it gives an error of:
GlobalVars.asc(7): Error (line 7): Cannot declare local instance of managed type

for line 7 of GlobalVar.asc:
AudioChannel                  GVAChan[];

I try putting
AudioChannel*                  GVAChan[];
but no cigar.

What am I doing wrong?

#199
I feel stupider even saying this, but how is this possible?

Code: ags
function GetString()
{
  String s;
  switch(Random(2)) {
    case 0: s="this is text"; break;
    case 1: s="This is also some text"; break;
    case 2: s="some more text"; break;
  }
  return s;
}


"Error (line 9): Type mismatch: cannot convert 'String*' to 'int'"

I'm missing something. Do people actually using callback arguments for this?
#200
Solved it. Had the problem in the code, for SayAtBubble().

Had
x = _clampInt(x, 0, System.ViewportWidth - bubbleSprite.Width/2);
instead of
x = _clampInt(x, 0, System.ViewportWidth - bubbleSprite.Width);

Not that it matters, but all good now :)
SMF spam blocked by CleanTalk