November 27, 2021, 07:47:10 am

The Gang Garrison 2 Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

NOTICE: Due to a rise in bot activity, new posters need to be approved before posting.

Join the community Discord server!

Pages: 1 2 [3] 4 5 ... 10

Author Topic: PrOF's programming questions  (Read 12970 times)

Phantom Brave

  • All Hail Classicwell
  • Moderator
  • *****
  • Karma: 70
  • Offline Offline
  • Posts: 12701
  • Another one --
Re: The incompetent's cry for help
« Reply #30 on: March 30, 2017, 08:52:34 am »

Let's say you want to make a string that contains the text:

function('otherfunction("my text")')

Because this text contains both ' and ", you can't put it in a string literal, because you can only make strings with ' or " on the outside, and can only have " or ' (respective) on the inside.

The easiest way to work around this is to build the string out of smaller strings instead of making one long string.

string = "function(" + "'" + "otherfunction(" '"' + "my text" + '"' + ")" + "'" + ")"

This is overkill, but I broke it up in to small parts so you can see what's going on switching between ' and " strings. In practice you don't have to get this convoluted, but I wanted to show switching between ' and " strings because it's probably the first say you're going to approach fixing this.
Logged

http://steamcommunity.com/id/wareya/
ladies and gentlemen i would like to announce that the fact of the matter is up that the fact of the matter is a fact and it matters

PrOF

  • Full Member
  • ***
  • Karma: 43
  • Offline Offline
  • Posts: 597
  • Sometimes a dev. Only sometimes
Re: The incompetent's cry for help
« Reply #31 on: March 30, 2017, 10:01:47 am »

Nope. Not understanding, sorry tried a lot on gml but without success.
I guess I won't need a menu anyway...
Logged

PrOF

  • Full Member
  • ***
  • Karma: 43
  • Offline Offline
  • Posts: 597
  • Sometimes a dev. Only sometimes
Re: The incompetent's cry for help
« Reply #32 on: March 31, 2017, 07:51:57 am »

Now I'm not really a core developer for this game, but
Code: [Select]
___________________________________________
ERROR in
action number 2
of Create Event
for object __newobject852:

In script menu_addedit_num:
In script menu_get_var:
Error in code at line 3:
   return execute_string("return "+item_var[argument0]);
                                   ^
at position 34: Wrong type of arguments to +.

I don't think this is my fault, seeing that it's an in-game script
Logged

Phantom Brave

  • All Hail Classicwell
  • Moderator
  • *****
  • Karma: 70
  • Offline Offline
  • Posts: 12701
  • Another one --
Re: The incompetent's cry for help
« Reply #33 on: March 31, 2017, 08:03:06 am »

Post the code that calls menu_addedit_num.
Logged

http://steamcommunity.com/id/wareya/
ladies and gentlemen i would like to announce that the fact of the matter is up that the fact of the matter is a fact and it matters

PrOF

  • Full Member
  • ***
  • Karma: 43
  • Offline Offline
  • Posts: 597
  • Sometimes a dev. Only sometimes
Re: The incompetent's cry for help
« Reply #34 on: March 31, 2017, 08:19:05 am »

Code: [Select]
//Menu in Plugin Options while in-game
if !variable_global_exists("pluginOptions") {
    global.pluginOptions = object_add();
    object_set_parent(global.pluginOptions,OptionsController); 
    object_set_depth(global.pluginOptions,-130000);
    object_event_add(global.pluginOptions,ev_create,0,'   
        menu_create(40, 140, 300, 200, 30);
   
        if room != Options {
            menu_setdimmed();
        }
   
        menu_addback("Back", "
            instance_destroy();
            if(room == Options)
                instance_create(0,0,MainMenuController);
            else
                instance_create(0,0,InGameMenuController);
        ");
    ');
   
    object_event_add(InGameMenuController,ev_create,0,'
        menu_addlink("Plugin Options", "
            instance_destroy();
            instance_create(0,0,global.pluginOptions);
        ");
    ');
}

object_event_add(global.pluginOptions,ev_create, 0, '
menu_addedit_num("Volume", global.warnVolume, ' + chr(39) + '
gg2_write_ini("Plugins", "duhSpoilerz", argument0);
' + chr(39) + ', 1);
');
The same but with one menu layer less and escaped ' (Thanks btw)
Logged

Derpduck

  • 2011 Haxxy Finalist
  • *
  • Karma: 42
  • Offline Offline
  • Posts: 5770
Re: The incompetent's cry for help
« Reply #35 on: March 31, 2017, 10:48:38 am »

You need to have quotes around every individual non-numerical argument in the menu option scripts, so you should have quotes around global.warnVolume.

PrOF

  • Full Member
  • ***
  • Karma: 43
  • Offline Offline
  • Posts: 597
  • Sometimes a dev. Only sometimes
Re: The incompetent's cry for help
« Reply #36 on: March 31, 2017, 03:25:55 pm »

That makes sense, thank you :smiley16: :c8:
Logged

PrOF

  • Full Member
  • ***
  • Karma: 43
  • Offline Offline
  • Posts: 597
  • Sometimes a dev. Only sometimes
Re: The incompetent's cry for help
« Reply #37 on: April 10, 2017, 04:23:43 pm »

so your naming your Chat version Prof_Chat right?
Nah, I'm basically just adding to Lorgan's code so that wouldn't be right
It'll probably be something like chat_v2_update by Lorgan (minor modifications by PrOF) as I did with the k/d ratio scoreboard by Lord Ceraptor
TO BE CONTINUED IN THE THREAD "The incompetent's cry for help"
Coming soon near your backyards!
Indeed.

Chat_v2_pr almost complete
I fixed rendering issues for all of the resolutions except for 5:4, which doesn't want to work
Also added some nice stuff too, if you want to see the differences, https://text-compare.com/
The development was easier for the second half, because I wrote a handy ANT to zip the new file without doing it by hand

I need help for the 5:4 issue, but other suggestions are appreciated :angel:
Logged

Spazz

  • Seasoned Member
  • *****
  • Karma: 44
  • Offline Offline
  • Posts: 1933
  • Almost too much seasoning.
Re: The incompetent's cry for help
« Reply #38 on: April 10, 2017, 05:40:52 pm »

Guessing the reason to uploading an "almost complete" is bug testing only?
Logged

<3 Bustatunez

PrOF

  • Full Member
  • ***
  • Karma: 43
  • Offline Offline
  • Posts: 597
  • Sometimes a dev. Only sometimes
Re: The incompetent's cry for help
« Reply #39 on: April 10, 2017, 11:57:22 pm »

Yep
Although since the code is basically Lorgan's original with various fixes there probably won't be any. So it's just to see if anyone can help for the 5:4 resolution :c1:
Logged

PrOF

  • Full Member
  • ***
  • Karma: 43
  • Offline Offline
  • Posts: 597
  • Sometimes a dev. Only sometimes
Re: The incompetent's cry for help
« Reply #40 on: April 12, 2017, 02:29:12 pm »

So when any of you code a server-sent plugin do you use any program to make the zipping and renaming faster? If yes, what do you use?
Just curious since I use Apache Ant
Logged

[FR]YB

  • 2013 Haxxy Award Winner
  • *
  • Karma: 28
  • Offline Offline
  • Posts: 642
  • There are 11 people playing holy sh
Re: The incompetent's cry for help
« Reply #41 on: April 12, 2017, 02:32:50 pm »

So when any of you code a server-sent plugin do you use any program to make the zipping and renaming faster? If yes, what do you use?
Just curious since I use Apache Ant
I just right-click compress the whole folder.
Before you ask, yes, it IS a pain when I have to debug stuff.

PrOF

  • Full Member
  • ***
  • Karma: 43
  • Offline Offline
  • Posts: 597
  • Sometimes a dev. Only sometimes
Re: The incompetent's cry for help
« Reply #42 on: April 14, 2017, 01:46:06 pm »

Update 1.1
-Gave credit where credit is due in the main menu
-Added a really cool bug that I don't know how to fix, see you in the incompetent's cry for help

So, when the game starts it correctly changes background, but shows "Aftermath" by Natsu
Logged

Derpduck

  • 2011 Haxxy Finalist
  • *
  • Karma: 42
  • Offline Offline
  • Posts: 5770
Re: The incompetent's cry for help
« Reply #43 on: April 14, 2017, 02:16:37 pm »

When the game gets the backgrounds it also gets a string (global.backgroundTitle) with the name and artist.

PrOF

  • Full Member
  • ***
  • Karma: 43
  • Offline Offline
  • Posts: 597
  • Sometimes a dev. Only sometimes
Re: The incompetent's cry for help
« Reply #44 on: April 14, 2017, 02:27:05 pm »

When the game gets the backgrounds it also gets a string (global.backgroundTitle) with the name and artist.
I know that, it doesn't help :z8:
I assign another value to global.backgroundTitle bug ot only shows when yhe background gets reloaded. Also overwriting the Create event in MainMenuController would be hard as there are both ' and " in the code. Not impossible, hard
Logged
Pages: 1 2 [3] 4 5 ... 10
 

Page created in 0.035 seconds with 36 queries.