November 27, 2021, 07:45:02 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 ... 10

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

Spazz

  • Seasoned Member
  • *****
  • Karma: 44
  • Offline Offline
  • Posts: 1933
  • Almost too much seasoning.
Re: The incompetent's cry for help
« Reply #15 on: March 08, 2017, 11:13:16 am »

Use .wav files, GM8 can use them, but not recommended for song(s) as they're expensive

An example would be AJFs Can You Feel The Sunshine from /plugins
« Last Edit: March 08, 2017, 11:14:51 am by Spazz »
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 #16 on: March 08, 2017, 11:16:15 am »

Use .wav files, GM8 can use them, but not recommended for song as they're expensive
I am using a wav (switched from mp3) file for a short beep, it occurs every 45 frames
Logged

Spazz

  • Seasoned Member
  • *****
  • Karma: 44
  • Offline Offline
  • Posts: 1933
  • Almost too much seasoning.
Re: The incompetent's cry for help
« Reply #17 on: March 08, 2017, 11:19:13 am »

An example would be AJFs Can You Feel The Sunshine from /plugins
Weird, AJF also used a .mp3 if I unpack it, my bad

That might be a loop signal, how long is the duration of the sound file? Whoever added the new death sounds of 2.7 or whenever it was should be able to help you more
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 #18 on: March 08, 2017, 12:40:28 pm »

An example would be AJFs Can You Feel The Sunshine from /plugins
Weird, AJF also used a .mp3 if I unpack it, my bad

That might be a loop signal, how long is the duration of the sound file? Whoever added the new death sounds of 2.7 or whenever it was should be able to help you more

Found the cause: basically the media player(global.soundz = sound_add(soundPath, 3, 1); takes a long time to load
So don't use mp3s for short sound files :c1:
Logged

Pootis Powers

  • Full Member
  • ***
  • Karma: 4
  • Offline Offline
  • Posts: 228
  • Soap
Re: The incompetent's cry for help
« Reply #19 on: March 08, 2017, 06:48:29 pm »

I wish I knew how to script.
Logged
bam shock dodge again wow im on fire total skill.

Heapons

  • Junior Member
  • **
  • Karma: 6
  • Offline Offline
  • Posts: 128
  • Just a guy wandering on the internet.
Re: The incompetent's cry for help
« Reply #20 on: March 24, 2017, 06:03:40 am »

Logged

PrOF

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

Ok, something more complex now
Code: [Select]
object_event_add(global.pluginOptions,ev_create, 0, '
menu_addlink("Random Settings", "
menu_addedit_num('Volume', global.Volume, '
gg2_write_ini("Plugins", "RandomVolume", argument0);
', 1);

    ");
');


___________________________________________
COMPILATION ERROR in file to be executed
Error in code at line 51:
    menu_addedit_num('Volume', global.warnVolume, '
                      ^
at position 21: Symbol , or ) expected.

Basically I'm trying to do
InGameMenu>Plugins Options menu> My Plugin Menu > number to edit (0 to 1)
Logged

Phantom Brave

  • All Hail Classicwell
  • Moderator
  • *****
  • Karma: 70
  • Offline Offline
  • Posts: 12701
  • Another one --
Re: The incompetent's cry for help
« Reply #22 on: March 29, 2017, 03:46:42 pm »

object_event_add(global.pluginOptions,ev_create, 0, '
   menu_addlink("Random Settings", "
      menu_addedit_num('

Count the ' characters.
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 #23 on: March 29, 2017, 04:13:06 pm »

6

I know GML uses both " and ' but I really don't know how to do this
Pls help =/
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 #24 on: March 29, 2017, 04:45:30 pm »

Use chr(39) to inject quotes within your scripts. Like this:

object_event_add(Player, 0, 0, '
    execute_string("
        show_message("
+ chr(39) + "this is a string" + chr(39) + ");
    "
);
'
);

It resolves as
execute_string("show_message(" + "'" + "this is a string" + "'" + ");");

Or,
execute_string("show_message('this is a string');");

I was sure I already used this workaround in a few plugins, but actually can't find any example anywhere. Oh well. Maybe in one of Lorgan's plugins? chat_v2 maybe?

PrOF

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

It's in Lorgan's Damage indicator
But what does that have to do with this?
Logged

Phantom Brave

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

You can't nest ' characters. Every two ' characters is a string. Then the string ends after the second '.
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 #27 on: March 30, 2017, 06:31:00 am »

Yes, I know
But I don't know how to write the same code without messing up either ' or "
Logged

Phantom Brave

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

You "have to" mess up either ' or ". Basically you have to do what YB posted. This is a problem with GML, yes.
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 #29 on: March 30, 2017, 07:35:12 am »

I think I's best if you put an example with my code, please :z7:
Logged
Pages: 1 [2] 3 4 ... 10
 

Page created in 0.038 seconds with 36 queries.