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 - Knox

#581
I cant seem to get transparency with a png alpha working correctly on a slider handle's graphic aswell...Ggrrr!!
#582
Ok so I created two dynamic sprite variables...one thats the original size and one that is shrunk down.

I got it to work like I want to!

Thanks once again guys!


ps: Is there a way to know if there is a dynamic sprite in the ram "by accident"...as in, lets say I forgot to delete it somewhere within my script?

If a sprite is carried in the ram for no reason, what happens? What can go wrong, etc...
#583
Hi,

Im not too sure if this makes sense but now Im at the stage of implementing something probably easy for the most of you but hard for me :P

Ok, right now my savegame saves a screenshot 320x240, but I resize it to 120x90 to fit my button in the previewGUI. I was thinking that when I click on this button, I could "restore" the 320x240 image by simply resizing it "back" to its "original" 320x240 resolution. I was wrong.

Right now it seems resizing is destructive, as in, when I restore the resized image back to its original size, its all pixelated.

Is there a way I can resize a large savegame screenshot, resize it for previewing purposes, but once clicked on, the "full-res" version gets displayed...without having to save 2 versions of the screenshot, of course :P

(ps: I guess as a work-around I might have to save a low-res and hi-res version of each savegame screenshot, right?)
#584
Hi Gilbet

Ok Ill give this a shot and keep you posted, thanks!

**EDIT**

Cool I got it to work!! I had to modify how my screenshots were saved/displayed though since now I have a dummy list to refer to.
#585
Hi guys,

I currently making it so I save the date+time inside a savegame...here is what I wrote, it works:

Code: ags

function saveWithDateTime(int iTrunc,)
{
  //suffix date+time to savegamefile
  dt = DateTime.Now;
  sSaveGameTextDateTime = String.Format("%s%02d%02d%04d%02d%02d%02d",saveGameText, dt.DayOfMonth, dt.Month, dt.Year, dt.Hour, dt.Minute, dt.Second);
  //Display("%s", sSaveGameTextDateTime);
  iLengthSaveGame = sSaveGameTextDateTime.Length;
  iTruncateNum = (iLengthSaveGame - 14); //length of the savegame input minus the 14 characters of the date + time
  sSaveGameTruncated = sSaveGameTextDateTime.Truncate(iTruncateNum);
  sSaveGameTruncatedUpper = sSaveGameTruncated.UpperCase();
  //Display("%s", sSaveGameTruncatedUpper);
  if (iTrunc == 0) saveGameText = sSaveGameTextDateTime; //means we want the date time saved 
  else if (iTrunc == 1) saveGameText = sSaveGameTruncatedUpper; //means we want to display the name without the date + time
}


The problem I have though is Im like 95% of the way there, and I dont know how to get that last 5%. Where Im stuck is Ive got a way to save the date+time info within the savegame text, and I know how to write a String variable that shows the savegaem name WITHOUT the date+time info...if I use "Display" command.

What I dont know how to do is when I get to this point (lstSaveGames.FillSaveGameList)...how to convert the savegame list (FillSaveGameList) so that I can use the variable to make sure I dont see the date+time : the string that "hides" the date+time info--> String sSaveGameTruncatedUpper

#586
Well I found a way to get around the problem, not exactly what I wanted but its a close second.

I just put in rep_exec if the mouse is over the input box to enable it, if it isnt, disable the textbox...so pressing "return" will work like I want as long as the mouse isnt over the text input box  :P

#587
Well I actually created a listbox with all the possible options so when you select an item in that box, it updates the textbox in my radio screen...so for now I decided to disable the textbox for user-input :P
#588
Hi,

I have the exact same question as this person "rich" (check link below), way back in 2005. Its about how to divert keypresses away from a textbox so it can be used to simulate a mouse click instead.

Its for the savegame GUI, I have a savegame button and a textbox. Since the textbox is always visible, when you press the "return" key, the textbox processes the key press, however, Id rather the return key simulates clicking on the "savegame" button on the GUI.

http://www.adventuregamestudio.co.uk/yabb/index.php?topic=20141.0

"Rich" in the thread above found the solution to the same problem Im having, however, if Im not mistaken, it seems to be pointing to something that is now obselete.

I tried setting the
Code: ags
txtBox.enabled = false 
upon pressing the return key in on_key_press but of course the textbox absorbs that key press before I can disable it so I cant disable the txtBox when the return key is pressed. :P

I have to admit Im not quite sure what function/process I can use to get around this (if its impossible, I can live without it I guess...just would be nice!)
#589
Ah ok! Well, this works...thanks SSH!
:)
#590
Im not sure but I think I ran into a bug(?) with this module:

In a dialog, if I use the standard "Say", this works:
Code: ags

// Dialog script file
@S  // Dialog startup entry point
  player.Say("I am saying this code: %s", sSayCode);
  cDispatch.Say("Im a dispatcher responding negatively to code: %s", sSayCode);
return

@1
  endConvo();
stop


...but if I run the same as above but using "GSay" instead of "Say", I get this error:
Code: ags

Dialog 10(3): Error (line 3): Type mismatch: cannot convert 'String*' to 'int'
#591
Ah ok...well atleast the trunc works.

So Im guessing its probably impossible too to disable just "some" keypresses when a textbox is enabled and visible, while enabling just the others? Right now I think its a "disable" or "enable" kinda deal, no exceptions, huh...
#592
Hi,

Probably another simple 1 question/1 answer deal, but Ive been searching for a solution to this for a while without luck.

Im aware you can simulate mouse clicks within GUI buttons, but what about simulating actual keyboard buttons within GUI buttons? What Im trying to do is I have a button that Id like to simulate the "Backspace" key so that when the player clicks on that button, it will act as if the actual Backspace key was pressed and deletes characters in a text box. I know I can just press the actual "Backspace" key, but Id rather it be called not by pressing the actual keyboard in real life but by clicking the "fake" keyboard button within the GUI I created.

Something like this (which doesnt work, of course):
Code: ags

function btnRadio_Delete_OnClick(GUIControl *control, MouseButton button)
{
  on_key_press(eKeyBackspace);
}


I tried to get around that with the truncate command with the string in the text box, and I guess I can get that to work with a hack but I thought it would be easier to just somehow tell AGS that when that particular button is pressed, pretend it acts like the actual keyboard "backspace" key.
#593
hehe...this I got to play!
#594
Hey thanks! This post combined with extra help from Ryan got the job done :)
#595
I found this thread about the problem Im trying to solve, and I was wondering if there was any other way, or is this the best way to "replace" Wait() so its non-blocking?

http://www.adventuregamestudio.co.uk/yabb/index.php?topic=40783.0

What Im doing is when a player receives damage, the health goes down and I display this change by changing the health bar sprite. Im making the bar go down in increments of 1, so say you lose 5 points, it goes down by 1 bar, 5 times...I decided to use Wait(5), seems to be the nicest wait time between sprite changes. The only down-side to this is that wait blocks, and I see my wait cursor flicker cause its constantly waiting and chaning sprites while in the function's loop. I could just render the cursor invisible duing the short Wait(5), but it would be even better to get around this another way all together.

So what Im asking is...what would some other options be (if any)?

#596
aw shucks guys I missed that in the manual...:-[

Ok Im going to see what I can do with it, thanks!
#597
Hi,

I just want to be able to display a player's health in percentage using floats. I tried with int's at first hoping (somehow!) it would convert automatically to a 1 decimal float...anyways, I tried this by placing 1 decimal for my initial floats:

Declared at top of global script:
Code: ags

float playerHealth = 18.0;
float playerHealthPercent = 100.0;

In a custom function:
Code: ags

function playerModifyHealth(float fHealthAmount)
{
  playerHealth = (playerHealth + fHealthAmount);
  playerHealthPercent = ((playerHealth/18.0)*100.0);
}

When player is clicked on:
Code: ags

cEgo.Say("My health is %f percent", playerHealthPercent)


However, the float percentage gets displayed with 6 decimal points...I thought of "truncate" but it seems to be for strings only. Is there a way outside of using a module or converting the numbers to strings to truncate the 6 decimal precision on floats to 1 decimal, as in...95.5%, or 1.5%...?

If not, is there a way to round off the float to the nearest number so that 93.4% would give me 93% ?
#598
Hi RickJ,

That works great.

Thanks!  ;D
#599
Ok, Ive asked many questions lately so this should be my last one for a while, dont want to piss anyone off :P

Im sure its pretty simple but how can I break up a very long "display" text so that I dont have to scroll all the time in the window? Im not talking about using the "]" character to break lines in the game... For example, from this:
Code: ags

Display ("Hi, Im a super long text that makes me have to scroll all the way in AGS editor.");

To something like this?
Code: ags

Display ("Hi, Im a super long text that makes 
me have to scroll all the way in AGS editor.");


Hope its not a stupid question :P
#600
AHHHHHhh!! (The Light turns on)

Well that works! Ok, so NOW I get it: CursorMode enumerates things in a list so its called an "enum", GUI or BUTTON are "objects". Wow, ok, that clarified a lot actually. Now I know how to use that :P

I just noticed I could have also have done:
Code: ags
 function cursorAnimOnOff(int iMode, int iXcursor, int iAnimView, int iNoAnim )

but then Id have to remember the numbers of different modes instead of its name so the once you gave is much better.

Thanks once again Ryan :)
SMF spam blocked by CleanTalk