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

#81
THanks for all of the input.  I still haven't had a chance to plug anything in yet but as soon as i can i will experiment with what you guys have suggest and i'm sure i can get it working. 

However, i believe in all of the discussion one of my questions was overlooked.  So i'll ask again:

Is there a way to set a maximum character length for a text box?

#82
ah i see. it makes sense now.  thank you very much.  tomorrow i will try out this new information and let you know what happens.  thanks again.
#83
Thanks. I'll try that out.

Another question I have:

Is there a way to set a maximum character length for a text box?

EDIT:

Okay, I put the custom function into the global script then in the global.ash i used the import function code so the room could access it.  I put the
Code: ags

int VAR=CheckConvertText(txtUserInput.Text);
if (VAR==-1) Display("Input only a value between 1 & 100.");


in the room script (in rep exec).

I got a parse error in the global script.asc on the line:
Code: ags

if (tempstr.Chars[ii])<'0'||tempstr.Chars[ii])>'9') return -1;  //"illegal" character

PE04: Parse error at '<'

Another thing - i read the String.AsInt file but i'm having a little trouble interpreting how to convert txtUserInput.Text into an int with it.
#84
I realize there may be several ways to do what i'm about to ask but seeing as how i've never used the text box option before i wanted to ask around for what may be the best solution so i don't end up with any bugs.  So let me go ahead and ask the question so you get the idea:

I have a GUI text box on a gui (obviously) and what i would like to be able to do is something like this:

I want the player to type in a number (from 1-100) and then i want that number to be converted to an integer so that AGS can use it in a mathematical equation in the script.
i.e. something like:  
Code: ags

int VAR = txtUserInput.Text;


Now the problems i'm foreseeing are things like what if the player types in numbers that are above 100 or below 1?  Or even worst, what if they type in letters?  My ideal situation is that if they type in something that is not 1-100 i want to display a message that says something like "Input only a value between 1 & 100." or something like that.

Any suggestions?  
#85
General Discussion / Re: chess?
Sun 18/07/2010 18:17:12
Quote from: TerranRich on Thu 15/07/2010 03:47:05
If you want to create a minigame where two human players can go at it, that's actually relatively easy. It's all about restrictive movement, tracking whose turn it is, etc.

But if you want to introduce a computer AI? You'd have to literally be a major in computer science in order to even begin to grasp the concept of such a thing.

i actually disagree ... i believe you would need a lot of coding background yes - but more importantly you would need to be a chessmaster.
#86
General Discussion / Re: Star Trek fans???
Sun 18/07/2010 06:28:06
Quote from: blueskirt on Sun 18/07/2010 05:07:33
Quote from: DrewCCU on Sun 18/07/2010 04:11:09goto www.letmewatchthis.com ... click the TV Series option ... then type in Star Trek in the search box.  And behold ...

Thanks for the link, it will sure be handy when I'll get a better internet connection, mine's stupidly limited to 20GB of bandwidth per month.

'No problem.  But yeah - its always better own it on DVD anyway.  But i submit that a faster connection is cheaper than buying the DVDs ...
#87
General Discussion / Re: Star Trek fans???
Sun 18/07/2010 04:11:09
Quote from: blueskirt on Sun 18/07/2010 00:52:17
I was a kid when I got into Star Trek. My first ever experience was with Interplay's Judgment Rites game. A couple months later Wrath of Khan was aired and like all kids that age, I recorded it and watched it religiously every weekends. Later I did it with Star Trek 1-6. I somewhat disconnected when the TNG crew took over, not knowing who was who.

Years later I remembered I used to be a total fan when I discovered Space Quest 5's main source of inspiration was Star Trek, I also got around to watch all 4 TNG movies and figure out who was who. A couple years ago I watched half the first, all the second and nearly all of the third seasons of TOS, which I loved, I also used that opportunity to replay the Star Trek adventure games.

I'm an hardcore Star Trek fan, but like superhero comics, I have trouble with their business model. TV stations are never airing the seasons I'm looking for. When I wanted to watch TOS, they aired TNG, now that I want to start with TNG, they airs Voyager and Enterprise, DVDs costs an arm and leg, I can't afford to download a TV series on my current internet connection, and with its kabillion episodes, the show is also getting too close to soap opera to me. I know I'll watch the whole thing one day, it will just take a very long time.

I loved the latest movie but I understand that it rubs lot of fans in the wrong way, it's one thing to do as if the other stuff never existed, it's another to explicitly say it no longer exist like they did in the movie, when I watched it and I saw how they retconned it, there was this voice in my head that went "Oh shit, this is gonna piss off lot of people". I can't wait for the sequels, but do worry about its future. Too many people in Hollywood have issues with third sequels, and unless they make a TV series to continue it, they'll revert back to the main canon and the reboot will become a spin off.

Also, don't worry about TOS aging badly. Sure, some episodes are slightly "so bad it's good", but there's also many others episodes where you don't give a damn about the campy stuff because the plot is so excellent because it talks about delicate subjects. I think TOS will be just as fun to watch in 20 years as it is now.

goto www.letmewatchthis.com ... click the TV Series option ... then type in Star Trek in the search box.  And behold ...
#88
General Discussion / Re: Star Trek fans???
Sat 17/07/2010 18:31:28
ProgZmax ...you know everyone says that but the truth is Enterprise was canon re visioning.  Yes - some things got contradicted and somethings were effected ... but the truth is it helped build a larger history base - which i myself loved.  I have accepted the fact that some things had to be refitted in the canon but it doesn't really upset me ... i'm not one of those to dread change TOO much. (however, i did think the whole alternate reality they created with the new movie was kind of dumb.  And it actually upset me more than the entire series of Enterprise did.  However, i don't see this whole alternate reality kick lasting too long and besides the old reality is still in existence and can still be expanded upon. I mean, alternate realities/parallel universes have been a part of Star Trek for a long time so there's no reason to get too upset over this.)

As far as what Pinback said earlier ... i actually did some research:

"Jonathan Archer was played by Scott Bakula in all 98 episodes of Star Trek: Enterprise. Bakula stated (half-jokingly) that he thought that Archer's middle name was Beckett, in reference to Dr. Sam Beckett, the character Bakula portrayed on the TV series Quantum Leap."
#89
General Discussion / Re: Star Trek fans???
Sat 17/07/2010 16:39:41
Quote from: Pinback on Sat 17/07/2010 10:58:13
Hehe, did you know that Scott Bakula wanted Cpt. Archer to be a decendant of his character in Quantum Leap, as part of Star Trek canon?


that wouldve stupid ... i mean dont get me wrong i loved quantum leap but that wouldve just been stupid.
#90
General Discussion / Star Trek fans???
Sat 17/07/2010 06:41:47
Hey guys ... just something random i want to throw out there to any other Trekkies we may have on these boards:

If you really are a Trekkie then you should know that Jonathan Archer was president of the United Federation of Planets from 2184 - 2192. I thought it'd be cool to photoshop something together of what he might look like at this time.

#91
works like a charm ... i'd never experimented with labels much before - but i'm glad you introduced me to them. thanks.
#92
I need a textual overlay (or something similar) to appear on TOP of a GUI.  Something like:

Code: ags

int Power = 100;

Overlay* myOverlay = Overlay.CreateTextual(50,80,120, Game.SpeechFont, 15,"Power is at %d%", Power);


Obviously, this would display a textual overlay that says "Power is at 100%"

However, it is important that this overlay appears ABOVE a GUI.  Now, to my knowledge an overlay does not have a zOrder so can not be placed above a GUI.  I can't use a GUI button because you can't use string formatting when editing a button's text.

Also, i don't want to use the Display function obviously because it would pause the script - and that can't happen here.

This may not be possible but if it is at all i would prefer to keep the necessary coding inside the room script ... if possible.  If not - oh well.  But yeah, i need something like this but it needs to be over a GUI.

Any suggestions?
#93
Hello everyone.  If you're American I hope you had a happy Independence Day.  If you're not American, I hope your July 4th went well. LoL.

Anyway ...

I have looked through the help files and read up on Floats and Ints and FloatToInt and IntToFloat and all of that stuff.  So i know what a float is versus an int.  But i still don't fully understand how you use these in AGS.  Up to this point I've learned to use ints and floats enough to get by in AGS without fully understanding how they operate within AGS.  But i've come to the point where i need to know how they work inside the program.

What i need is something like this:

float GP = Game.SpriteHeight[frame.Graphic] / 1.1888888888888888888888888888889

The only way i can get something similar to this to work is:

int GP = Game.SpriteHeight[frame.Graphic]/FloatToInt(1.1888888888888888888888888888889);

Which turns the non whole number into an int which ends up rounding it.  And it's affecting the calculation so i'm not getting the desired result because i'm getting a number thats been rounded.  Not an exact number which is what i need.  If this makes no sense then let me know and i'll try to clear it up. thanks.

EDIT:
Does the following code account for scaling or is it simply the default graphic size??

ViewFrame *frame = Game.GetViewFrame(cEgo.NormalView, 0, 0);

in other words, does getting this particular frame account for this frame being scaled in the room?  Or is it only the size that the graphic was imported (therefor, nothing else - not even scaling - would effect the outcome)

#94
Quote from: tzachs on Sun 27/06/2010 19:13:05
You can do it (to a degree) by saving the time when you set the timer.
Something in the lines of:

Code: ags

int lastTimerExpiredTime; //Here we will save the time we last set the timer.
int timerTimeout = 100; //How many ticks for the timer (100 just an example)?
int timerId = 1; //Select the timer id (1 just an example)

//Use that instead of the regular SetTimer
function MySetTimer()
{
   DateTime *dt = DateTime.Now;
   lastTimerExpiredTime = dt.RawTime;
   SetTimer(timerId, timerTimeout);
}

//And then, the function you want will be:
int GetNumberOfTicksLeft()
{
   DateTime *dt = DateTime.Now;
   int currentTime = dt.RawTime;
   int timeFromPreviousExpiredInTicks = (currentTime - lastTimerExpiredTime) 
                                                 * GetGameSpeed();
   
   return (timerTimeout - timeFromPreviousExpiredInTicks);
}


Thanks guys.  That's using your noggin right there tzachs.  But i think it may be easier to do it the what Khris was talking about.  Anway, thanks you guys.
#95
I was wondering if there was a way to get what "tick" a timer is at?

Like you have SetTimer where you can set say:
SetTimer(1,80);

And then you have IsTimerExpired?

But i would like to have a way to be able to have some piece of code where you can see where the timer is ... like:

X = GetSetTimer;

where the result may be something like:

x = 40  (which would mean the timer isn't expired at 0 but only 40 cycles have expired ... and it still has 40 to go ...

if this makes sense? if not let me know what i should explain better.
#96
Quote from: Ryan Timothy on Fri 25/06/2010 04:55:14
Also with this, a Degree of 0 is the same as 360.  Just so ya know. :P

Yeah but if i'm using the random function then i would need to use 360 because then i would get random numbers between 0 and 360 ... if i used 0 then ... well im not sure what would happen - or if the function would even run properly ... but properly it would act as if there was no line of code at all or as if degrees=0.

anyway. thanks for your help. :)
#97
Ryan Timothy,

So to make sure i get this:

In order for the "dog" to appear as those he's moving in a random pattern inside this invisible circle around the player i need to randomize the degrees value and the radius value; otherwise, the "dog" will just be in one place at all times (in relation to the player)?

So in order to randomize the degrees and radius i would have something like:
int degrees = Random(360);
int radius = Random(100); (or whatever the radius will end up being)

then to plug them into the x and y like so:

int x = FloatToInt(Maths.Cos(Maths.DegreesToRadians(IntToFloat(degrees)))*IntToFloat(radius));
int y = FloatToInt(Maths.Sin(Maths.DegreesToRadians(IntToFloat(degrees)))*IntToFloat(radius));

is this correct?
#98
Quote from: Khris on Thu 24/06/2010 23:01:25
Did you read the manual entry for Character.FollowCharacter?

It even mentions a dog as an example:
QuoteAs a special case, setting DIST=0 and EAGERNESS=0 makes CHARID behave as if it is chasing CHARTOFOLLOW - it will try and get there as quickly as possible. Setting EAGERNESS=0 also tells the character not to stop when they reach CHARTOFOLLOW, but instead to randomly wander around the character - useful perhaps for a very energetic dog or something.

yes i have read the manual and i meant to mention that in my original post.  So allow me to do it now:  the follow character command is great but it's not exactly what i need in this case - close, but not close enough.
#99
try checking out Mouse Functions and Properties in the AGS help file.  Theres a lot of things in there that you may find useful.
#100
-So having an NPC move in a random patern in a given area is pretty easy.
-Having an NPC follow the Player is pretty easy also.

However, I am trying to figure out a way to combine the two.  I want the NPC to move at random inside a circle with a radius of (lets say) 100 pixels.  But that's not all, I also want the center point of that circle to move (in actuality, the center point of the circle is going to be the Player).

So imagine it this way:

Lets say your walking your dog on a leash.  The leash is a length of 100. And your dog is wild so he's running randomly and crazily all around you ... up to you ... back away from you, to the other side of you ... so on and so forth ... but he can never go more than a distance of 100 away from you (in any and every possible direction aka-a circle).

For some reason i can't wrap my head around how to effectively do this one.  A little push in the right direction could help.
SMF spam blocked by CleanTalk