Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / [SOLVED] INCLUDE/INSERT Bug? Or am I clueless?

Author
Message
Golelorn
7
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 12th Jun 2020 23:31 Edited at: 12th Jun 2020 23:33
If you use #include and try to set a variable like:


The variables are not set. You have to use #insert.

Is it suppose to be like that?

The author of this post has marked a post as an answer.

Go to answer

blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 12th Jun 2020 23:40
#include will add the source code to the END of the file no matter where the #insert statement is
#insert will add the source code at the LINE the #insert code is at
Bengismo
6
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 12th Jun 2020 23:42
This post has been marked by the post author as the answer.
Its supposed to be like that.

The help even says:
Quote: "Be aware that included source code is appended to the end of the program, so if you #include any code that isn't part of a function it will be run if your main program reaches the end of its source code."


So your lines where you set the values arent actually run unless your code is allowed to reach those lines which are added at the end of the file (typically after your do loop)

Easiest way to fix it is just to define the global variables and set their values on one line

global camera_Zadjust = 45//adjust camera to be in front or behind
global mouse_MoveSpeed as float = 0.24

This then works with either #insert or #include
Golelorn
7
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 12th Jun 2020 23:46
Thanks. I didn't know that was possible... haha. Learn something new all the time.

Login to post a reply

Server time is: 2024-04-25 01:47:03
Your offset time is: 2024-04-25 01:47:03