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 - suicidal pencil

#141
Thanks!

Works perfectly now. I didn't realize that I had to do that  :P
#142
gah.

On one of the many GUIs in my game, only one has text that has a variable in it. The text in question is supposed to show an integer value, but I can't even get it to compile. Even copy/pasting from the Help comes up with this error:

GlobalScript.asc(118): Error (line 118): Parse error in expr near '"Cash: %d"'

Here's the code:

Code: ags

  //set the cash monitor to the current amount of cash on hand
  ShopGuiCashMonitor.Text = ("Cash: %d", Cash);
  //display the now correctly formatted shop GUI
  ShopGuiBuy.Clickable = false; // The buy button is not visible, since nothing has been selected.
  Shop.Visible = true;


ShopGuiCashMonitor is a label. It works perfectly until I try to toss a variable at it.
#143
Beginners' Technical Questions / Re: Menus!
Fri 13/03/2009 01:16:06
Jakerpot is correct. Reading the manuals, while boring, is very useful. You can also make use of 'F1' while developing. That saves lots of time.

But to make it drop down from the top of the screen, you can just fiddle with some of the settings when creating the GUI. (Right-click 'GUI' in the tree, click 'new GUI', and mess with the settings.)
#144
Quote from: KhrisMUC on Wed 17/12/2008 22:06:00
Is this some kind of contest now?

What gives you that idea?

I'm just giving suggestions on how primitive could optimize the experience needed.
#145
I looked into some websites that had a non-flash game, and here's the web page source.

Code: ags

<p><applet code="PyroSandMain2" archive="PS.jar"  width="600" height="500">
          <param name="width" value="600">
          <param name="height" value="500">

          </applet>
      </p>
    </div></td>


That's from the Pyro version of The Falling Sand Game.

Notice how it says archive="PS.jar". .jar is a Java Archive. I tried to run a .exe from a browser on my computer, but it doesn't work.
#146
I'd like to see this code. AGS compiles to .exe, and browsers (at least, to my knowledge) do not run them. It would have to be a Java application, and I do not think AGS can do that
#147
Quote from: PrimitiveUser on Wed 17/12/2008 17:24:00
Start out with level 1, I kill 1 monster, I level up to 2, I kill 5 monsters to geto level 3, I kill 10 monsters to get level 4, and so on by 5's(The freaking exp is going up by 5's!)

You just described a Geometric sequence turning into an arithmetic sequence, which, depending how you code it, can get very messy

I'd recommend just using a geometric sequence for the experience.

So, level one would take 1 xp
Level two would take  5 xp
level three would take 25 xp
level four would take 125 xp
level five would take 625 xp
and so on.

The formula representing this would look like this:

tn = as(n-1)

where tn is the amount of experience, (n-1) is the level, a is the first number in the series (so, in this case, 1), and s is the common ratio.

So for level twenty, you will need tn = (1)(5)(20-1) experience, or...

tn = (1)(5)(20-1)
tn = (1)(5)(19)
tn = (1)(19073486328125)
tn = 19073486328125

It seems like a serious amount, but if you raise the experience that the monsters you fight in the late game give you, it doesn't see too harsh.

And personally, I think that level 20 should be your max if you decide to use this method, for the amount of experience needed would be about 3.1554436208840472216469142611311x1068, or 3, followed by about 68 zeroes.

Just create a function to do it, and you'll be fine for the rest of your game.

note: You don't have to use 5 as the common ratio.
#148
Beginners' Technical Questions / Re: Questing
Mon 15/12/2008 23:15:33
DoUn2u is absolutely correct. (nice name, (Matthew 7:12))

You learn much more by solving problems yourself, rather than having someone else do it for you.

But, in response to your question, you simply need to use two Boolean variables, as Dualnames put it in the code.

A good example of it would be the code I used to put a character into a 'stealth' mode

Code: ags

if (keycode==83){
    if (STEALTH_S == false){
      STEALTH_S = true;
      if (player.Moving == true){
        player.StopMoving();
        SPencil.ChangeView(2);
        SPencil.SetWalkSpeed(3, 3);
        player.Walk(mouseXloc, mouseYloc, eNoBlock, eWalkableAreas);
      }
      else if (player.Moving == false){
        SPencil.ChangeView(2);
        SPencil.SetWalkSpeed(3, 3);
        }
  }
    else if (STEALTH_S == true){
      STEALTH_S = false;
            if (player.Moving == true){
        player.StopMoving();
        SPencil.ChangeView(1);
        SPencil.SetWalkSpeed(6, 6);
        player.Walk(mouseXloc, mouseYloc, eNoBlock, eWalkableAreas);
      }
      else if (player.Moving == false){
        SPencil.ChangeView(1);
        SPencil.SetWalkSpeed(6, 6);
        }
}
}


Notice the way I used the variable STEALTH_S (which stands for Stealth_switch). When it is equal to true, it immediately sets itself to false, and takes the player out of stealth mode. Same thing when it's false. It sets itself to true, and puts the player into stealth mode.

You can use the same idea and method to control almost everything in the game. Just use your imagination.

Note: just in case your confused, the mouseXloc and mouseYloc are variables that were declared that immediately saves the (x,y) coordinates of every click the player makes.
#149
Terrible. Just terrible.
#150
Primitive, there is no need to be overly pedantic.

Now that we've chastised him, I think we should just move on.
#151
Ah! thanks.

Works perfectly.

#152
In the game I'm currently creating, when the user presses 's', their character will go into 'stealth' mode.

In stealth mode, their speed will decrease.

I already know that changing character speeds require that they are not moving. But, Instead of stopping them entirely, I want them to stop, change views, decrease speed, then continue on to where they were headed.

I've got everything down, except having the character continue on. I'm trying to save the x and y locations to two different variables, but I don't quite know how.

Here's the code, and where I'm having issues is marked by a triple asterisk (***).
What I added to existing code will be preceded by (&&&)

GlobalScript.asc
Code: ags


***int mouseXloc = mouse.x;
***int mouseYloc = mouse.y;
.
.
.
.
.
.
.
.

.
if (keycode==83){
    if (STEALTH_S == false){ //where STEALTH_S is a global variable
      STEALTH_S = true;
      if (player.Moving == true){
        player.StopMoving();
        SPencil.ChangeView(2);
        SPencil.SetWalkSpeed(3, 3);
        player.Walk(mouseXloc, mouseYloc, eNoBlock, eWalkableAreas);
      }
      else if (player.Moving == false){
        SPencil.ChangeView(2);
        SPencil.SetWalkSpeed(3, 3);
        }
  }
    else if (STEALTH_S == true){
      STEALTH_S = false;
            if (player.Moving == true){
        player.StopMoving();
        SPencil.ChangeView(1);
        SPencil.SetWalkSpeed(6, 6);
        player.Walk(mouseXloc, mouseYloc, eNoBlock, eWalkableAreas);
      }
      else if (player.Moving == false){
        SPencil.ChangeView(1);
        SPencil.SetWalkSpeed(6, 6);
        }
}
}
.
.
.
.
.
.
.
.

.
function on_mouse_click(MouseButton button) // called when a mouse button is clicked. button is either LEFT or RIGHT
  {
  if (IsGamePaused() == 1) // Game is paused, so do nothing (ie. don't allow mouse click)
    {
    }
  else if (button == eMouseLeft) 
    {
    ProcessClick(mouse.x,mouse.y, mouse.Mode);
    (&&&) mouseXloc = mouse.x;
    (&&&) mouseYloc = mouse.y;
    }
  else // right-click, so cycle cursor
    {   
    mouse.SelectNextMode();
    }
  }
.
.
.
.
.
.
.

#153
As ghost said, coordinates are stored in mouse.x and mouse.y.

Using them to draw on a chalk board isn't too hard.

Just need to use a hotspot, and a new sprite.

the code would look something like this:

Code: ags

function HOTSPOT1_AnyClick()
{
***Create 'sprite001' at 'mouse.x' and 'mouse.y' 
}



Not sure what the command will be to create a new sprite, but that's the basic shell of what it might be.
Please note that it is pseudo-code.
#154
Quote from: Trent R on Mon 08/12/2008 01:48:19
:'( I'm gonna go slit my wrists now :(


~Trent

Now now, no need for that. Just think of the mess the janitor will have to clean...

But, if you want to make it so that the arrow keys do not move the player, follow these super simple, yet sarcastically pedantic steps.

1) Open the script that will contain the relevant information (possibly GlobalScript.asc)
2) look for these numbers: 372, 375, 377, 380
3) replace them with these numbers: 371, 373, 376, 381
4) Get some coffee
5) Fall into a pit of arrogance, and smartly remark to this set of instructions not working.
6) Hit alt-F4 to send a virus to my computer
7) Get more Coffee
8.) Throw your router through a window, and smash it to bits with your computer.
9) Congrats! problem solved.

Basically, instead of having the arrow keys move the player, completely different keys will make him move (I believe they are Pg.Up, Pg.Down, End, and Home.
#155
I still don't know the full extent of what the scripting language can do, and I didn't think that it could.

Thanks for the answer. Knowing that I can do it will make life sooooo much easier for me.
#156
Two part question, all about functions.

part A) Can you have a recursive function (Have the function call itself)?

and

part B) Can you have a function call another function? (having 'function DoThis()' use 'function DoThat()', then continue on)?

SMF spam blocked by CleanTalk