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 / Tier 2 Equivalent of #insert and #include?

Author
Message
Tobias_Ripper
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 22nd Nov 2017 09:37
Currently converting the Tier 1 project to Tier 2.

In AppGameKit I wrote a heftty block of code in a separate file and used the #insert function to insert it into the main loop. I can't seem to figure out how to now include that file in Visua Basic and also Insert it into the code. Am I going to have to copy the code and physically paste it in?

PS: remember that #include pastes the code exactly where you've written that command in while #insert pastes the code at the end of the document (in AGK)
Eisenstadt Studio: Eisenstadtstudio.com
Composers Page: Milesthatch.net
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 22nd Nov 2017 12:06 Edited at: 22nd Nov 2017 14:15
look for the .h file in c++
#include "template.h"
AGK (Steam) V2017.09.25 : Windows 10 Pro 64 Bit : AMD (17.11.2) Radeon R7 265 : Mac mini OS High Sierra (10.13)
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 22nd Nov 2017 13:35
A couple of things...

Tier 2 does not use Visual Basic. It is C++.
You have your explanation of #include and #insert the wrong way around

In a non-procedural language, you tend to call out to blocks of code as functions or methods. Your #insert would most likely become a method, but you need to consider whether this needs access to variables in a different scope (ie private variables).
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 22nd Nov 2017 14:13 Edited at: 22nd Nov 2017 14:14
#insert came later in agk because include put the data an the end of main file the compiler gave error that types are not found.
but a normal include should insert a file where the include row is.
so the #insert usage is better in agk basic.

if you are using a function collection each file in tier1 its often similar a class/object.
something like player.agc hiscore.agc config.agc
in c++ i would encapsulate player.agc in to a player class , in file system its ok to have a extra player.cpp
AGK (Steam) V2017.09.25 : Windows 10 Pro 64 Bit : AMD (17.11.2) Radeon R7 265 : Mac mini OS High Sierra (10.13)

Login to post a reply

Server time is: 2024-11-24 05:40:03
Your offset time is: 2024-11-24 05:40:03