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

#1
We can't really help unless you tell us the exact error message(s), and the line(s) mentioned.
"There is a parse with" doesn't really mean anything, but if you give us examples of the actual errors and code you use, we should be able to tell you where you're going wrong.

Make sure you've checked the manual, BFAQ and search the forum for working code examples before you ask, though.
#2
OK, here's the most obvious problem with that code:
Code: ags

player.ActiveInventory=InventoryItem.GetAtScreenXY(mouse.x, mouse.y);
character[EGO].AddInventory(player.ActiveInventory);
Mouse.Mode=eModeUseinv;


Remember, you can't set as Active an Item the player doesn't have, which is what you're still trying to do. You need to add the Item THEN set it as active. Try:
Code: ags

Item *Clicked = InventoryItem.GetAtScreenXY(mouse.x, mouse.y);
character[EGO].AddInventory(Clicked);
player.ActiveInventory = Clicked;
// Cursor mode automaticaly changed to eModeUseinv when ActiveInventory is set


Also:
* Do you really want to set the newly-added Item as active? You don't have to, to 'select' the Item from the shop, is there some other reason you're doing it?
* Is there no check for "Are you sure you want to buy (whatever)?" (or even whether the player can afford the item)?

There was a Coding Contest about Trading as well, maybe you could get some ideas from there?
#3
By default, AGS treats a eModeInteract click on an Inventory Item as 'set this as the Active Inventory' - and you've discovered what happens if you try to set as Active an item the player does't have. The most obvious solutions would be: change the Cursor mode to someting other the eModeInteract (and stop the player being able to change back while the shop GUI is open) or make the Merchant character the player Character while you're in the shop.

Quote
I haven't so far found a way to assign script on an inventory box click

Do a forum search for 'Handle Inventory clicks in script'. The manual is a bit vague, but it's been dealt with enough times that you should be able to find a decent description somewhere. (But just not using eModeInteract is much easier...)
If you've already got 'handle inv clicks in script' checked and didn't realise (e.g. from some template/tutorial), you should be able to edit the on_mouse_click function to react to what GUI is open, so it doesn't generate the error you're getting

Quote
but that way i wouldn't be able to just have one GUI and only give the Merchant different goods in each room, i would have to design many GUI's

Not quite true. You could set up conditions to change the Button graphics before opening the GUI (changing the 'stock' of the store), and within the Button Control functions to sell different items based on some other variable (Room number, Button graphic, etc), so it'd behave in a similar way to using an Inventory window. The Inventory method would be a LOT easier, though...

How to handle changing rounds... There're a couple of fighting game engines available already (e.g this one, Gord's Template a few posts up, or these Coding Contest entries) - they probably won't be exactly what you're after, but they should give you a few ideas.
#4
Mirek:
The only problem I have running that as-is (in 2.72), is that there's nothing that stops GI5 being more that GI8, so it just repeatedly levels up until I Alt-X out of the game. But that might be taken care of in another block of code.
You said the problem was gLevelup staying invisible - does that mean everything else (e.g. DisplayTopBar and updating the character stats) runs OK? As Gord said, check the positioning of your GUI, to make sure it's not just hidden behind something, or is off-screen, etc. If it's not running at all, insert some Display commands somewhere (e.g. on_key_press to make sure your GIs are what you think they are (that is, that GI5 actually is greater than GI8 - and remember that it won't currently run if GI5 = GI8).

Slightly off topic, I prefer to use custom variables for this sort of thing. if (exp >= neededexp) is much easier to read, IMO, than if (GetGlobalInt(8 ) < GetGlobalInt (5))

Gord:
Nice, thanks for releasing. Shame it uses old-style code and (going on the tutorial files) the Interation Editor though.
#5
If you just want stationary on-screen hands, that's easy - use a GUI background image. If you mean hands that animate with the action, like in (for example) Oblivion, or some FPSs? (Press the button to swing your sword, and the sword swings onscreen.) Doable, with a bit of coding. (Although also using GUI Backgrounds...)

'more items like armors' - more than what? Again, probably doable with a bit of coding. I think the Hidden Threat template used Inventory Items for spells, weapons, etc - it'd just be a case of adding more of them. If you're not using that template - what are you using? Ask a general question, get a general answer. Ask a more specific question, and you might get a reply that's more actual use.
#6
'Undefined token' errors mean just that - the thing you're refering to (in this case a Label called 'lblShowExp') isn't defined (i.e. doesn't exist). Try a forum search, if you want more info.

Did you name your Label 'lblShowExp', or did you not see the last line of the code block:
Quote
// replace 'lblShowExp' and 'lblShowMana' with whatever you names the Labels.
(And yes, 'names' was a typo.)

Name your Label(s) in the GUI Editor, then update the code with the actual Script-name.

I can't see why that'd generate a parse error, or why just moving it one line down would solve that - what's the surrounding code when you get the parse error? (It might not matter, if you've gone beyond that, but it's usually handy to know why errors happen, to avoid them in the future.)

And, there was no need to quote the whole post...

#7
Sorry, what? Previously made posts should be changed because the editor has moved on? If you read old posts, you're going to get old code - and issues with updating have been addressed many time before, if you look for them.

Perhaps you should read the manual, or just some newer posts on the forums, to see how to update it for yourself?
Code: ags

String exp = String.Format ("%d", GetGlobalInt (2));
String mana = String.Format ("%d", GetGlobalInt (1));
gui[0].Controls[1].Text = exp; // Look up 'Label.Text' and name the Label to make this easier.
gui[0].Controls[2].Text = mana;


Or, you could simplify that to:
Code: ags

lblShowExp.Text = String.Format ("%d", GetGlobalInt (2));
lblShowMana.Text = String.Format ("%d", GetGlobalInt (1));
 // replace 'lblShowExp' and 'lblShowMana' with whatever you names the Labels.


If you're getting Unexpected (whatever) errors, then you're probably putting the code in the wrong place (like outside of a functon) - the original post should tell you where to put it to avoid those errors. 'Undefined properties of SetWindowGUI' is a new one to me - what exactly was the error message, and what (and where) was the line that caused it?
#8
It looks like you just need to adjust the Item sizes for the GUI Inventory window. Select it in the GUI editor, and change the 'Item width' and 'Item height' properties to match your Inventory item size. (It's also settable in Script, but there shouldn't be any need for that, really).
#9
Sorry, don't quite understand the problem here.
So I'll make a suggestion based on what I think it is. Take a look at the optional addAtIndex parameter for Charatcter.AddInventory.  That should allow you to add new items at whatever position you want. (Looking at the code, it may use the old AddInvetory command which won't allow this - if so, just replace it.)
#10
The Onion AV Club reviewed 'The Shivah'. Does that count as 'in the media'?
#11
The Rumpus Room / Re: Happy Birthday Thread!
Tue 09/01/2007 01:56:38
Dang, a little late but: Happy Birthday Mark!

I'll owe you two pints, to cancel out the one you owe me...
#12
Well, in that example invitem and charid aren't actually pointing to anything so you might still get a 'null pointer' error from it.

From the original:
Code: ags

GiveInv(character[GetPlayerCharacter()].activeinv,GSlocid);


character[GetPlayerCharacter()].activeinv can be replaced with player.ActiveInventory.

GSlocid looks like it's still an int so you could probably replace that with:
character[GSlocid]

Also, from the new version:
Code: ags

if (player.ActiveInventory>=0)


I missed this before but since ActiveInventory is an InvItem pointer and not an int, that might need to be:
Code: ags

if (player.ActiveInventory.ID>=0)


Or:
Code: ags

if (player.ActiveInventory!=null)


Of course, if it works as-is, then don't worry about it.
#13
Code: ags

GiveInv(invitem, charid);

There's no obvious reason that shouldn't work, provided invitem and charid are both valid pointers of the right type. Except, there might be a problem using pointers with the same names as those used in the function declaration (the XXX is a global var, cannot use as name for a local error is a possibility). Unless that was just psuedocode?

Code: ags

if (player.ActiveInventory>=0) player.ActiveInventory.Name;

For this - you don't actually seem to be doing anything with player.ActiveInventory.Name, so it's no wonder nothing's happening. What about using:
Code: ags

if (player.ActiveInventory>=0) invname = player.ActiveInventory.Name;


invname is the string (old-style) used in the original example, change it if you've got a different name for the String (new style).
#14
This should work:
Code: ags

  else if (parameter==5){
    int counter=1;
    while (counter < MAX_PLAYERS){
      if (GUIControl.GetAtScreenXY(mouse.x, mouse.y) == gMaingui.Controls[Tposition[counter].smallpicbevelbutton]) return 1;
      counter++;
     }
    return 0;
  }


Unless you've made smallpicbevelbutton into a Button pointer, in which case you'd use if (GUIControl.GetAtScreenXY(mouse.x, mouse.y) == Tposition[counter].smallpicbevelbutton).
The other thing is MAX_PLAYERS - I guess that's #define'd in the script somewhere? You might be able to replace it with Game.CharacterCount - don't hold me to that as I'm not sure what it does.

Have you tried the manual, like I suggested? All the new commands you need are in there.
#15
Quote
I tried your shortened version of
...
and this gave an error stating NormalGraphic is not a member of "int". So I used your second version which seems to work.

Did you also change smallpicbutton variable (in the struct the Tposition refers to) into a Button pointer? If so, it makes no sense that the 'short' version doesn't work, and the 'long' version does. If not - there's your problem. There's no real need to do it that way, it'll just save a little bit of typing, and make the code look a little more OO-like.

Code: ags

My next problem is with this code
...
I've tried this code below, but I get a Parse error in expr near "Tmode"
...
I know I'm missing something but I cannot see it


It looks like you've got a stray ) at the end of the line - Tmode[counter].highlightedbutton[charid]);.

Quote
Also would I be right with changing
...
To this

Looks good, but:
Code: ags

  Tplayer[charid].topinvitem=MainInventory.TopItem;// MainInventory script name.

The original line uses GetPlayerCharacter, so shouldn't that be:
Code: ags

  Tplayer[player.ID].topinvitem=MainInventory.TopItem;// MainInventory script name.


And:
Code: ags

  character[player.ID].Clickable = 1;// Yes

Would work fine, but why not just:
Code: ags

  player.Clickable = 1;// Yes
#16
The error (as you can probably guess) means you're trying to use an old-style command (SetButtonPic) which is now obsolete. (Leaving 'Enforce object-based scripting' unchecked tells AGS it can still use the obsolete functions, but you're right that it's better to phase them out.)

You can use the manual to help you with this type of error - select the old command in the 'Index' tab, and you should be taken to the OO equivilant. In this case, there are three properties that replace it: Button.NormalGraphic, Button.MouseOverGraphic and Button.PushedGraphic, depending on the which parameter (the 3rd one) used in the SetButtonPic commands.
1 = NormalGraphic, 2 = MouseOver, 3 = Pushed.

Code: ags

SetButtonPic(MAINGUI,Tposition[counter].smallpicbutton,1,Tplayer[GetPlayerCharacter()].smallpic);


which = 1, so that would be:
Code: ags

gMaingui.Controls[Tposition[counter].smallpicbutton].AsButton.NormalGraphic = Tplayer[player.ID].smallpic; // 'GetPlayerCharacter()' is also obsolete


You might be better changing the Tposition[counter].smallpicbutton variable to a Button pointer, allowing the slightly shorter:
Code: ags

Tposition[counter].smallpicbutton.NormalGraphic = Tplayer[player.ID].smallpic;
#17
The colour/size limits in Sprite Jam are set by whoever sets the rules, so if you don't like 'em, win it and don't set any...

The rest of the suggestion sounds like the occasionally held (but not for quite some time) 'Artitude' activity (old example). If there was enough interest, no doubt another round of that could be organised.
(Note: I don't think this is the place to drum up that interest, though.)
#18
undefined token errors mean the thing you're trying to use (in this case the function SetMode) doesn't exist.
Are you using the template as-is, or have you copied some code over to another game? Since that's only line 76, I'd guess you're missing a whole lot of the template code before that point. NOTE: functions and variables have to have been created before - i.e. earlier in the script than - they're used, so if the declaration for SetMode is there, but starts at line 90, you'd still get that error.
#19
Quotesupposedly there's only 300 GlobalInts and 50 GlobalStrings. Correct? ...is there some way to expand this number?

Actually, I think it's 500 GlobalInts.

Although not RPG specific, this BFAQ entry deals with making Global variables, which will extend those limits nicely. (As well as allowing you to use the more intuitive Money = 3; instead of SetGlobalInt(437, 3);.)
Note that if you're using V2.7 or lower, you can't make global strings. You can however make a char array, that will work similarly. (char Name[30]; will give you the functional equivilant of a 30-character string.)

As for the maths, you could just fudge it, so it seems right to you - that's the joy of writing your own engine. Alternatively, Google up some sites relating to RPG engines, they'll probably have the formulae used somewhere in their resources.
#20
That looks like it could shape up to be a nice little resource. Perhaps an official anouncement in General Discussion would generate more interest? However, can we leave any further discussion of it to PM or - wacky thought - to it's own 'Suggestions' forum.  After I have my say, anyway:

Yurina, maybe you could put up a stripped down version of the engine? You know leave the basics intact for everyone to use but remove any 'personal' touches specific to your game.

Akumayo, should I add my trade & turn-based battle engines from the coding comps? Or you're welcome to add them yourself, if you want.

Now, let us never speak of it again. Here, at least.
SMF spam blocked by CleanTalk