Difference between revisions of "ScriptCore3.obj2menu"

From Soldat Community Wiki
Jump to: navigation, search
(Created page with " '''function obj2menu(Style: Byte): Byte''' Style: string that is to be converted into a number Result: conversion result ==Description== This converts a string into a nu...")
 
(Examples)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
  '''function obj2menu(Style: Byte): Byte'''
 
  '''function obj2menu(Style: Byte): Byte'''
   Style: string that is to be converted into a number
+
   Style: Position(Style) of the weapon in the [[TMapObject.Style]]
   Result: conversion result
+
   Result: Position(Style) of the weapon in the [[Weapons List]]
  
 
==Description==
 
==Description==
This converts a string into a number.
+
Translates the position of the weapon in the Style property of a Map Object - lying weapon ([[TMapObject.Style]]) to the corresponding position in the Weapon Menu ([[Weapons List]]).
  
 +
==Examples==
 +
<source lang="pascal">
 +
begin
 +
    WriteLn('obj2menu: '+inttostr(obj2menu(5))); //1
 +
    WriteLn('obj2menu: '+inttostr(obj2menu(26))); //14
 +
    WriteLn('obj2menu: '+inttostr(obj2menu(1))); //Exception: Invalid object style ( Unfortunately you can't choose flag in the weapon menu ;( )
 +
end.
 +
</source>
  
 
[[Category:Functions]]
 
[[Category:Functions]]

Latest revision as of 18:17, 1 May 2018

function obj2menu(Style: Byte): Byte
 Style: Position(Style) of the weapon in the TMapObject.Style
 Result: Position(Style) of the weapon in the Weapons List

Description

Translates the position of the weapon in the Style property of a Map Object - lying weapon (TMapObject.Style) to the corresponding position in the Weapon Menu (Weapons List).

Examples

begin
    WriteLn('obj2menu: '+inttostr(obj2menu(5))); //1
    WriteLn('obj2menu: '+inttostr(obj2menu(26))); //14
    WriteLn('obj2menu: '+inttostr(obj2menu(1))); //Exception: Invalid object style ( Unfortunately you can't choose flag in the weapon menu ;( )
end.