Undefined token 'ProcessClick' with LW_BASS_V2 template

Started by kookaburra, Tue 25/09/2018 13:59:53

Previous topic - Next topic

kookaburra

I'm starting a game from scratch and have chosen the LW_BASS_V2 template. If I run the empty project immediately after creation (I haven't added any rooms etc yet other than what's set up by default) I get the error :
"Error (line 35): Undefined token 'ProcessClick'" in TwoClickHandler.asc
Can anyone shed some light here please?

The relevant code chunk is
Code: ags
	
function on_mouse_click(MouseButton button)
{
	// when mouse is clicked, text label is cleared
	lblActionText.Text = "";
	
	// when game is paused, clicks aren't processed
	if (IsGamePaused())
	{
		return;
	}
        else if (button == eMouseLeft)
	{
		if (GetLocationType(mouse.x, mouse.y) != eLocationNothing)
		{
			if (player.ActiveInventory == null)
			{
				ProcessClick(mouse.x, mouse.y, eModeInteract);
			}

This issue is in both the latest stable release, and 3.5.0.1
Thanks!

Crimson Wizard

#1
That might be an outdated version of template. Did it come with the installation? (I could swear I we had this updated, but may be mistaken)
ProcessClick is replaced with Room.ProcessClick since AGS 3.4.0. The best course of action is to update all instances of this name.
Alternatively you need to both set the "Script Compatibility level" switch in General Settings to older version and probably also disable "Enforce object oriented scripting" for this particular case to make ProcessClick enabled again.

I also recommend referring to "Upgrading to AGS X.X.X" topics in the manual, they tell what functions or variables were renamed, for example:
http://www.adventuregamestudio.co.uk/manual/ags94.htm#UpgradeTo34

kookaburra

#2
Thanks Crimson Wizard! Changing the references fixes it.
I'm pretty sure that came from the 3.4.1 (either that or 3.5 as I've copied 3.5 over the top of 3.4.1). I went to look at the github code to submit a pull request, but it appears .agt is a compiled format, and from my forum searches I can't find out how you uncompile/edit a template. So as much as I tried to help and contribute to the project, I'm sorry that I couldn't.

Danvzare

Quote from: Crimson Wizard on Tue 25/09/2018 14:05:24
That might be an outdated version of template. Did it come with the installation? (I could swear I we had this updated, but may be mistaken)
I'm 90% certain that this got fixed in an update too. Could it have been accidentally reversed?
It should be easy to check though.

Crimson Wizard

#4
Quote from: kookaburra on Thu 27/09/2018 12:57:17I went to look at the github code to submit a pull request, but it appears .agt is a compiled format, and from my forum searches I can't find out how you uncompile/edit a template. So as much as I tried to help and contribute to the project, I'm sorry that I couldn't.

We have separate repository for the template sources: https://github.com/adventuregamestudio/ags-template-source
But it has completely new version of BASS template there with correct ProcessClick.

The template that comes with 3.4.1 is relatively old, but normally AGS is supposed to detect that and have "script compatibility level" set to make it work, so idk what exactly happened, maybe something went wrong during import.

RE how to uncompile/edit template: AGS does hard part for you, you create a game from template, edit the game project then do File -> Create template with same name.

kookaburra

Thanks for the help Crimson Wizard and for the clarification on how to work with the templates.

SMF spam blocked by CleanTalk