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

Topics - Knox

#41
Viewframe.Speed is read-only...I checked around and it seems nothing much can be done with this...
(example)
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=42696.0

Is there a "dirty" hack-way I can change this on the fly? Ive got a loop where I'd like the randomize the last frame's delay (without creating more loops if possible).

If this isnt currently possible, I'll add a request to making viewFrame.Speed not read-only if/when the engine goes open-source.  :)
#42
Ok, I've been working on this on my own and so far so good, but I've run into a problem I've ran into before...I'm sure Khris you'll see its the same kind of problem I run into often in AGS (because I still have a hard time undoing my old ways of seeing variables). Here is what I have, it's a system to update item quantities and playing random messages when the player has reached the maximum amount for that item:

Code: ags
void randMaxMessage(String sThisItem)
{
  int iRand = Random(4);
  if (iRand == 0) Display("You've got as many %s as you can possibly carry...", sThisItem);
  else if (iRand == 1) Display("You can't hold anymore %s...", sThisItem);
  else if (iRand == 2) Display("That's enough %s...", sThisItem);
  else if (iRand == 3) Display("You dont' need to carry any more %s...", sThisItem);
  else if (iRand == 4) Display("You've got enough %s...", sThisItem);
}
  
void setMaxQuantity(int iItemQVar, int iMaxQuantity, int iThisAmount, String sItem)
{
  if (iItemQVar <= iMaxQuantity) iItemQVar = iItemQVar + iThisAmount;
  else randMaxMessage(sItem);
}

void AddInventory_Quantity(this InventoryItem*, int iAmount)
{
  //Display("Current clipQuantity is: %d...add %d to that number", iClipQuantity, iAmount);
  if (this == iPatrolClip) setMaxQuantity(iClipQuantity, 8, iAmount, "magazine clips");
  else if (this == iTaserCartridge) setMaxQuantity(iTaserCartridgeQuantity, 8, iAmount, "cartridges");
  else if (this == iAlcoholPrepPad) setMaxQuantity(iAlcoholPrepPadQuantity, 8, iAmount, "prep pads");
  else if (this == iBenzalkoniumWipe) setMaxQuantity(iBenzalkoniumWipeQuantity, 8, iAmount, "wipes");
  else if (this == iBusinessCard) setMaxQuantity(iBusinessCardQuantity, 8, iAmount, "business cards");
}

int Quantity(this InventoryItem*)
{
  if (this == iPatrolClip) player.InventoryQuantity[this.ID] = iClipQuantity;
  else if (this == iTaserCartridge) player.InventoryQuantity[this.ID] = iTaserCartridgeQuantity;
  else if (this == iAlcoholPrepPad) player.InventoryQuantity[this.ID] = iAlcoholPrepPadQuantity;
  else if (this == iBenzalkoniumWipe) player.InventoryQuantity[this.ID] = iBenzalkoniumWipeQuantity;
  else if (this == iBusinessCard) player.InventoryQuantity[this.ID] = iBusinessCardQuantity;
  
  iQ = player.InventoryQuantity[this.ID];
  return iQ;
}


The problem area is when I reach this line:  iItemQVar =  iItemQVar + iThisAmount;
I want to set my global variable (that is "inside" a variable iItemQVar) to its amount plus a new iThisAmount...

The problem is, of course, iItemQVar doesnt store the name of  the global variable, it would be the same as saying "8 = 8 + x"...how do I do it so I can store the value of the global variable (ex, iPatrolClipQuantity) AND its name so it can be used in that fashion? grrrr. I wish I could use variables in AGS this way, sniff sniff  :'(

I still have trouble grasping this concept, so be please be easy one me...it'll eventually sink in! :P
#43
I created a custom property (a bool), and the default is "0". How do I change that value on the fly? I cant seem to find a "SetProperty"?

//pseudo code
Code: ags

bool bB = this.GetProperty("Hidden"); //should return false (default setting)

//later, in some block of script:
if (blah blah) 
{
  if (bB == false) bB = true;
}
#44
I was wondering if there was some sort of module (or if its even possible) to have layers on characters so an endless amount of variation is possible for faces, hair, clothes, etc...

With some help, Ive already got a nice system that already does that for my speech portraits ( which is pretty cool :) ), but Im realizing I would need this for the character's walking/running, picking up anims aswell (and any other anims of course).

Also, is this kind of thing "heavy", as in storing the variables, playing various animations at the same time, etc...is there a way to do it so that its 1 character for 3 layers: head, clothes and "props" (hat, glasses, facial hair)...
#45
Ive noticed that in the game settings you can specify in what size chunks you want the compiler to split the resource files, however is there a way to apply this to the acsprset.spr file aswell?

My sprite file so far (compressed) is about 400mb, i was just wondering if it would be useful in any way to split that up? Uncompressed, its uh...1 gig, heh  :P
#46
Hi,

I know there a few good programmers here that could help me with something. Someone started a while ago this thread:
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=37030.0

I was wondering if anyone here is capable + willing to write a plugin that uses the graphics card (so its not laggy)...it would simulate this effect more or less:
http://www.youtube.com/watch?v=7PNV09vPq8o&feature=related

Its for a full-screen 1024x768 "drunk" effect applied over everything in the game (gui's, characters, animations, etc), that I would later combine with other scripts (like a drunk-mouse that Im getting help with, and custom drunk-walk animations, etc)...is it possible to do this so that the FPS doesnt go below 30?

If someone is interested (with pay) please PM me!
Thanks!!
#47
I think this is going to be another easy one, I checked String Formatting in the manual + $SAVEGAMEDIR$ search in the forums without luck.

From a previous question (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=41294.0 ), I was able to query if a certain file existed, but how do I get Display to print out the actual save-game path as a variable? I tried these two lines without luck (I can't seem to be able to convert $SAVEGAMEDIR$ into a string variable):

Code: ags
    
                                      input = txtScreenshotInput.Text; 
                                      input = input.Append(".bmp");
        Solution A (failed): String sPath = "$SAVEGAMEDIR$";
                                      Display("Screenshot saved to: %s/%s", sPath, input);

        Solution B (failed): Display("Screenshot saved to: %s/%s", $SAVEGAMEDIR$, input);
#48
Is there any way to move the insertion point's position in a textbox? Id like to make a keyboard shortcut that when the player presses the left or right arrow key, the insertion point moves left or right by one character (like in any text editor)...

...I think the answer will be "no", though (I cant seem to find anything in the manual).
#49
Hi,

Is there anyway we can animate a slider's handle graphic with a view? I can use the .Animate on buttons, but not a slider's handle graphic. Basically I just want it so that when the handle of the slider is selected and as long as the mouse is held down, its view is animating.

If not, Im guessing I can always just put a gui of the animation behind the handle graphic...but I dont think I have access to the ZOrder of the handle graphic property (something like mySlider.HandleGraphic.ZOrder)...so how could one position an animated gui or button behing a slider's handle graphic but still over its background image?

#50
Im aware of various work-arounds with variables and rep_exec, but if this can be avoided, that would be great.

I cant seem to find a global event for 'Player enters room after fadein'  (I just see eEventEnterRoomBeforeFadein)...does it exist in another form (or way to do it hidden in the manual somewhere?)

If this doesn't exist, how come? And...is there a way I can add "custom" global events? Id really like to avoid having to add the same lines into each room's AfterFadeIn.
#51
Hi,

Ive got a question on if this is a good way to start for the following idea:

Id like to do something similar to the function "faceCharacter", as in I want to query the target and source characters' x,y coordinates, do a substraction on them, and depending on the results assign a string (or integer) to that result...its so that depending on where the target character is in relation to the source character, the source character will animate a certain "turning" animation before heading towards the target (Ive got lots of transition turn animation loops and I need to know which one to call depeding on the 2 characters' positions).

Lets say the source character I want to do the turning (to face another character) is "this"...and the "target" character I want "this" to face is the cChar:

Pseudo Code:
Code: ags

void TurnCharacterTowards(this Character*, Character *cChar)
{
  //get coordinates of cChar (b)
  int bX = cChar.x;
  int bY = cChar.y;

  //get current char coordinates (a)
  int aX = this.x;
  int aY = this.y;  

  //Substraction: cChar - current
  int cX = bX - aX;
  int cY = bY - aY;
  //depending on result, put loop number value...
  if (cX is only inside this boundary) int iLoop = 0;
  else if (cX is only inside this boundary) int iLoop = 1;
  etc...
}


The only thing is Im not sure if Im approaching this the right way. Also, Im not too sure how to get the boundaries I need. Look at this pic I did below:



Assume "this" is in the middle of the grid. If the "target" character (cChar) is inside the red boundary, for example, how do I write it so I can get "if cChar is in this boundary, cChar is to the left of "this", run loop 1".

I have a tendency to make life hard for myself so what do you guys think? Is there an easier way?
#52
Hi!

Ive got a weird one...right now Im using the following script to make the mouse cursor move/jitter randomly around:

Code: ags

void mouseDrunk(int iPixelsInitial, int iCounterInitial)
{
  iPixels = iPixelsInitial;
  iCounter = iCounterInitial;
  int iRand_a = Random(iPixels);
  int iRand_b = Random (1); //pos or neg
  int iCurrentPosX = (mouse.x);
  int iCurrentPosY = (mouse.y);
  int iDrunkPosX;
  int iDrunkPosY;
  if (drunkMouseCounter >= iCounter) //every 5 game loops
  {
    //substract random num
    //DisplayACL("%d", iRand_b);
    if (iRand_b == 0)
    {
      iDrunkPosX = (iCurrentPosX + iRand_a);
      iDrunkPosY = (iCurrentPosY + iRand_a);
    }
    else if (iRand_b == 1)
    {
      iDrunkPosX = (iCurrentPosX - iRand_a);
      iDrunkPosY = (iCurrentPosY - iRand_a);      
    }
    drunkMouseCounter = 0;
    mouse.SetPosition(iDrunkPosX, iDrunkPosY);
  }
  else drunkMouseCounter++;
}


The result is pretty good, but it seems too "linear", not "swooshy" enough. Do any of you geniuses know how I could have the mouse cursor follow an infinity symbol (horizontal figure-8), clock-wise and counter-clockwise? The cursor would move along this path randomly, but not too much so its choppy/jumps and also so that the infinity symbol is kinda evident (but not too much, ehehe)...more of a smooth swooshing with slight random jitter...

This is too tough for me!
#53
Hi,

This one is truly pissing me off! I really dont know why this is giving me weird results:

Ive got a GUI with a listbox that when you double click on an item, it executes a script (you send a radio message). Everything works fine if I dont select an item in that list first, pause, then double click...it works properly only if I use the double-click on the items within the list.

Example-->


Lets say I double-click on "Code-10", cool, it works...the main player radio's dispatch Code-10...BUT, if I select, say, "Code-9" with single click first, then double-click on "Code-10", Code-9 will be sent since there isnt enough time to switch the text to Code-10 (Im guessing?)

Here are the scripts Im using...Im not sure why its not behaving properly.
Code: ags

void doubleClick(eDoubleClickSpeed eSpeed)
{
  ViewFrame *frame0 = Game.GetViewFrame(VWAIT_FAKE, 0, 0);
  if (frame0.Graphic != 2061) frame0.Graphic = 2061;
  mouse.ChangeModeView(eModeWait, 54); //fake "Pointer-Wait" view...(waitMouseKey shows Wait View)
  mouse.ChangeModeGraphic(eModeWait, 2061);
  
  int iDoubleClick;
  int dc;
  if (eSpeed == eSlowClick) dc = 15;
  else if (eSpeed == eMediumClick) dc = 12;
  else if (eSpeed == eFastClick) dc = 9;
  
  iDoubleClick = (WaitMouseKey(dc) * mouse.IsButtonDown(eMouseLeft));
  if (iDoubleClick)
  {
    mouse.ChangeModeView(eModeWait, 14); //restore Default Wait view
    mouse.ChangeModeGraphic(eModeWait, 297);    
    //DisplayACL("Double click!");
    iExecuteDC = 1;
  }
  else iExecuteDC = 0; 
}


Code: ags

void on_event (EventType event, int data)
{ 
  overGuiControl = GUIControl.GetAtScreenXY(mouse.x, mouse.y);
  if (event == eEventGUIMouseDown && overGuiControl == lstRadioCode) doubleClick(eMediumClick);
}

Code: ags

//in rep_Exec
  ...else if (gRadio.Visible)
  { 
    if (overGuiControl == null || lstRadioCode.SelectedIndex == -1)
    {
      if (sldRadio_Channel.HandleGraphic != 1433) sldRadio_Channel.HandleGraphic = 1433; //reset
      else if (sldRadio_Frequency.HandleGraphic != 1421) sldRadio_Frequency.HandleGraphic = 1421; //reset
      clearLBL(lblRadioHotspot);
    }
    else 
    {  
      if (overGuiControl == lstRadioCode)
      {
        if (iExecuteDC == 1)
        {
          if (bReady == true)
          {
            btnRadio_Send_OnClick(btnRadio_Send, eMouseLeft);
            iExecuteDC = 0;
            bReady = false;
            return;
          }
        }
      } 


Code: ags

function lstRadioCode_OnSelectionChange(GUIControl *control)
{
  clearTXT(txtRadio_CodeInput); //first clear whats in the LCD
  String selectedItemText = lstRadioCode.Items[lstRadioCode.SelectedIndex];
  txtRadio_CodeInput.Text = selectedItemText;
  bReady = true;
}

I think it has something to do with iExecuteDC = 0 (if double-click is false)...cause thats when it seems it screws things up.
#54
I placed "SetRestartPoint()" in my game_start because Im having trouble with loading certain versions of my main character (I have a script that changes the age of the character).

To debug, I wrote this expecting to see "Debug Restart" displayed at the start of  the game. This happens on the 1st time, but if I press "restart", the next time the game loads, I dont see that message...meaning that game_start doesnt get passed after "Restart"?

So right now when I load the 1st time, my character appears in the right room with the right views, etc...but when I press restart, if the game doesnt pass "start_game", then my whole character swap script wont work...

Code: ags

function game_start()
{
  SetRestartPoint();
  Display("Debug Restart");
  Debug(4, 1);
  InitializeInterface();
  ...etc

#55
Ok, I found these threads but it didnt quite answer what Im searching for:

http://www.adventuregamestudio.co.uk/yabb/index.php?topic=40332.0
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=35864.0
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=11100.0

Is it possible (and not too laggy) to create a mouse trail effect "on the fly" with whatever the current mouse cursor graphic is? Im guessing the best and fastest way is with dynamic sprites, right? Is there any way I can do this without creating characters that follow the mouse? Id rather not create multiple individual characters or gui's for the trail effect (if possible).

I thought maybe have a timer + store the mouse cursor's position and then redraw the 4 trail cursors "1,2,3,4" at the main cursor's previous position "x" loops ago + then fading out that dynamic sprite x loops later...(and off-setting each trail graphic with different x or y values + opacities, depending on the mouse's direction)?

Im guessing (without trying it just yet) it might be too much...I have a tendency to over-complicate things, anyone have a simpler idea?
#56
Ive been doing an optimization pass recently on various things, and one of them I put on my "to-do" list consists of optimizing the way my cursor highlight system uses sprites.

Right now when my cursor is over an object, character or hotspot, it will play an animation from a view that loops. Ive made a different view for each cursor type, and now realize I could save sprite room if I just drew that animation under the current cursor's sprite. The current sprite also has a small animation, but its timing is different than the animation that is underneath...for example:

The look cursor gets a small animation of the eye blinking, while underneath that cursor there is a looping animation of a "storm cloud" moving/swirling around.

Ive got a vague idea how I can manage to just use 1 view of the looped cloud anim for every possible cursor I might have, even to be used for any inventory item aswell! (That would save me loads of views, sprites, and time!)

Could someone perhaps give me a nudge in the right direction? :)
#57
I looked up the textWindow properties and I could only seem to find background image, but nothing for the specific corner sprites...

How could I change a corner's bottom left-hand or right-hand graphic (in my case ID 1 or ID 3) with a script?

I could just create a new textWindow GUI with the appropriate sprites...but I wanted to know if it can be done by just switching the id's graphic.

Something like :
Code: ags

void processBubbleSide(string sSide)
{
  if (sSide == "Left") gTextWindow.TextWindowEdgeGraphic(1) = 45;
  else if (sSide == "Right") gTextWindow.TextWindowEdgeGraphic(3) = 46;
}


The number in the parenthesis would be the TextWindowEdge's ID (1 is bottom left corner, 3 is the bottom-right corner)

This will enable me to have a bubble-arrow on the appropriate side depending on where the character's portrait shows up.

ps: If this isnt possible, Ill just make a 2nd textWindow gui and switch between the 2 gui's instead :P
#58
Hi guys,

Well I was wondering if there was any difference for AGS displaying a sprite using magic pink for transparency vesus a png image using its alpha channel for transparency.

Im guessing it would be "faster" for AGS to draw the transparency with the magic pink, am I right?

If so, then does that mean for a fullscreen effect (a view with 20+ frames, 1024x768) with lots of areas that are transparent, its better to use magic pink for the transparency rather than have a huge png with the alpha channel making the transparency...right?

...or does this "not matter" since today's computers are good enough that the speed difference is negligeable...
#59
Im trying to get a "while" function to work, but Im missing something...

I have a list (lstRadioCode) and when the selection is changed in that list, the text in the radio's screen display gets updated with the text from the list...when this text is updated, I can then press a button "push to talk" and it will send the text that is in the radio's screen display to the dispatcher.

All works well except I added a doubleClick function...if the selection in the list is doubleClicked on, it will read what text is in the radio's screen display (txtRadio_CodeInput) and call the "push to talk" function. There is a delay in updating the text from the list to text box, so I decided to put a "while" in the script cause I want to make sure the text box gets the new text from the list before executing the "push to talk".

Here is what I tried, but at the "while" part, it just keeps on waiting, never exiting the loop...but I set the bool "Ready" to true AFTER the textbox gets updated:

Code: ags

void doubleClick(eDoubleClickSpeed eSpeed)
{
  ViewFrame *frame0 = Game.GetViewFrame(VWAIT_FAKE, 0, 0);
  if (frame0.Graphic != 2061) frame0.Graphic = 2061;
  mouse.ChangeModeView(eModeWait, 54); //fake "Pointer-Wait" view...(waitMouseKey shows Wait View)
  mouse.ChangeModeGraphic(eModeWait, 2061);
  
  int iDoubleClick;
  int dc;
  if (eSpeed == eSlowClick) dc = 15;
  else if (eSpeed == eMediumClick) dc = 12;
  else if (eSpeed == eFastClick) dc = 9;
  
  iDoubleClick = (WaitMouseKey(dc) * mouse.IsButtonDown(eMouseLeft));
  if (iDoubleClick)
  {
    //Display("Double click!");
    iExecuteDC = 1;
    mouse.ChangeModeView(eModeWait, 14); //restore Default Wait view
    mouse.ChangeModeGraphic(eModeWait, 297);
  }
  else iExecuteDC = 0;
}

void lstRadioCode_OnSelectionChange(GUIControl *control)
{
  bReady = false;
  clearTXT(txtRadio_CodeInput);
  String selectedItemText = lstRadioCode.Items[lstRadioCode.SelectedIndex];
  txtRadio_CodeInput.Text = selectedItemText;
  bReady = true;
}

void on_event (EventType event, int data)
{
  overGuiControl = GUIControl.GetAtScreenXY(mouse.x, mouse.y);
  if (event == eEventGUIMouseDown && (overGuiControl == lstRadioCode))
  {
    doubleClick(eMediumClick);
    if (iExecuteDC == 1)
    {
      if (gRadio.Visible)
      {
        while (bReady != true) fakeWaitCursor(1, 2091);
        Display("Ready!");
        //btnRadio_Send_OnClick(btnRadio_Send, eMouseLeft);
      }
    }
  } 
}


I dont quite understand why this isnt working!
#60
Hi,

Im pretty sure this will be answered fairly easily, but how do I convert an enum to a string so I can use "IndexOf" on it?
I tried to simply place a return inside a string variable, but this doesnt work:

 
Code: ags
 
  eFaceAnim currentFa = this.GetFaceAnim();
  Character* cChar = this;
  
  //if faceAnim is already the same as the change... dont save the backup
  //is the word eSad contained inside the string currentFa?
  
  String sCurrFa = return currentFa;
  int iResult = sCurrFa.IndexOf("Sad");
  Display("%d", iResult);
  
SMF spam blocked by CleanTalk